Skip to content

Commit f05ac42

Browse files
author
Dan Paun
committed
rename refund transaction id constant
1 parent 77bcca1 commit f05ac42

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Significance: minor
22
Type: add
33

4-
Expose WooCommerce transaction id for a refund on refund API endpoint
4+
Expose the refund transaction ID in WooCommerce Order Refund API

includes/class-wc-payment-gateway-wcpay.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ static function ( $refund ) use ( $refund_amount ) {
22852285
$wc_last_refund = WC_Payments_Utils::get_last_refund_from_order_id( $order_id );
22862286
if ( $wc_last_refund ) {
22872287
$this->order_service->set_wcpay_refund_id_for_order( $wc_last_refund, $refund['id'] );
2288-
$this->order_service->set_wcpay_transaction_id_for_order( $wc_last_refund, $refund['balance_transaction'] );
2288+
$this->order_service->set_wcpay_refund_transaction_id_for_order( $wc_last_refund, $refund['balance_transaction'] );
22892289
$wc_last_refund->save_meta_data();
22902290
}
22912291

includes/class-wc-payments-order-service.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class WC_Payments_Order_Service {
8888
*
8989
* @const string
9090
*/
91-
const WCPAY_TRANSACTION_ID_META_KEY = '_refund_transaction_id';
91+
const WCPAY_REFUND_TRANSACTION_ID_META_KEY = '_wcpay_refund_transaction_id';
9292

9393
/**
9494
* Meta key used to store WCPay refund status.
@@ -661,14 +661,14 @@ public function set_wcpay_refund_id_for_order( $order, $wcpay_refund_id ) {
661661
/**
662662
* Set the payment metadata for refund transaction id.
663663
*
664-
* @param mixed $order The order.
665-
* @param string $wcpay_transaction_id The value to be set.
664+
* @param WC_Order_Refund $order The order.
665+
* @param string $wcpay_transaction_id The value to be set.
666666
*
667667
* @throws Order_Not_Found_Exception
668668
*/
669-
public function set_wcpay_transaction_id_for_order( $order, $wcpay_transaction_id ) {
669+
public function set_wcpay_refund_transaction_id_for_order( WC_Order_Refund $order, string $wcpay_transaction_id ) {
670670
$order = $this->get_order( $order );
671-
$order->update_meta_data( self::WCPAY_TRANSACTION_ID_META_KEY, $wcpay_transaction_id );
671+
$order->update_meta_data( self::WCPAY_REFUND_TRANSACTION_ID_META_KEY, $wcpay_transaction_id );
672672
$order->save_meta_data();
673673
}
674674

tests/unit/test-class-wc-payments-order-service.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,10 +1155,10 @@ public function test_set_wcpay_refund_id() {
11551155
$this->assertEquals( $this->order->get_meta( '_wcpay_refund_id', true ), $wcpay_refund_id );
11561156
}
11571157

1158-
public function set_wcpay_transaction_id_for_order() {
1158+
public function set_wcpay_refund_transaction_id_for_order() {
11591159
$wcpay_refund_transaction_id = 'txn_mock';
1160-
$this->order_service->set_wcpay_transaction_id_for_order( $this->order, $wcpay_refund_transaction_id );
1161-
$this->assertSame( $this->order->get_meta( WC_Payments_Order_Service::WCPAY_TRANSACTION_ID_META_KEY, true ), $wcpay_refund_transaction_id );
1160+
$this->order_service->set_wcpay_refund_transaction_id_for_order( $this->order, $wcpay_refund_transaction_id );
1161+
$this->assertSame( $this->order->get_meta( WC_Payments_Order_Service::WCPAY_REFUND_TRANSACTION_ID_META_KEY, true ), $wcpay_refund_transaction_id );
11621162
}
11631163

11641164
public function test_get_wcpay_refund_id() {

0 commit comments

Comments
 (0)