Skip to content

Commit e76ccdd

Browse files
committed
Deprecating additional metas from the helper class
1 parent b3c270f commit e76ccdd

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

includes/class-wc-stripe-helper.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,28 @@
1212
* @since 4.0.0
1313
*/
1414
class WC_Stripe_Helper {
15-
const SETTINGS_OPTION = 'woocommerce_stripe_settings';
16-
const LEGACY_META_NAME_FEE = 'Stripe Fee';
17-
const LEGACY_META_NAME_NET = 'Net Revenue From Stripe';
18-
const META_NAME_STRIPE_CURRENCY = '_stripe_currency';
15+
const SETTINGS_OPTION = 'woocommerce_stripe_settings';
16+
const LEGACY_META_NAME_FEE = 'Stripe Fee';
17+
const LEGACY_META_NAME_NET = 'Net Revenue From Stripe';
18+
19+
/**
20+
* Meta key for the Stripe awaiting action identifier.
21+
*
22+
* @var string
23+
*
24+
* @deprecated 9.5.0 Use WC_Stripe_Order_Metas::PAYMENT_AWAITING_ACTION_META instead.
25+
*/
1926
const PAYMENT_AWAITING_ACTION_META = '_stripe_payment_awaiting_action';
2027

28+
/**
29+
* Meta key for the Stripe currency.
30+
*
31+
* @var string
32+
*
33+
* @deprecated 9.5.0 Use WC_Stripe_Order_Metas::META_STRIPE_CURRENCY instead.
34+
*/
35+
const META_NAME_STRIPE_CURRENCY = '_stripe_currency';
36+
2137
/**
2238
* The identifier for the official Affirm gateway plugin.
2339
*
@@ -102,7 +118,7 @@ public static function get_stripe_currency( $order = null ) {
102118
return false;
103119
}
104120

105-
return $order->get_meta( self::META_NAME_STRIPE_CURRENCY, true );
121+
return $order->get_meta( WC_Stripe_Order_Metas::META_STRIPE_CURRENCY, true );
106122
}
107123

108124
/**
@@ -117,7 +133,7 @@ public static function update_stripe_currency( $order, $currency ) {
117133
return false;
118134
}
119135

120-
$order->update_meta_data( self::META_NAME_STRIPE_CURRENCY, $currency );
136+
$order->update_meta_data( WC_Stripe_Order_Metas::META_STRIPE_CURRENCY, $currency );
121137
}
122138

123139
/**
@@ -1455,7 +1471,7 @@ public static function get_stripe_gateway_ids() {
14551471
* @return void
14561472
*/
14571473
public static function set_payment_awaiting_action( $order, $save = true ) {
1458-
$order->update_meta_data( self::PAYMENT_AWAITING_ACTION_META, wc_bool_to_string( true ) );
1474+
$order->update_meta_data( WC_Stripe_Order_Metas::META_STRIPE_PAYMENT_AWAITING_ACTION, wc_bool_to_string( true ) );
14591475

14601476
if ( $save ) {
14611477
$order->save();
@@ -1471,7 +1487,7 @@ public static function set_payment_awaiting_action( $order, $save = true ) {
14711487
* @return void
14721488
*/
14731489
public static function remove_payment_awaiting_action( $order, $save = true ) {
1474-
$order->delete_meta_data( self::PAYMENT_AWAITING_ACTION_META );
1490+
$order->delete_meta_data( WC_Stripe_Order_Metas::META_STRIPE_PAYMENT_AWAITING_ACTION );
14751491

14761492
if ( $save ) {
14771493
$order->save();

includes/class-wc-stripe-order-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public function prevent_cancelling_orders_awaiting_action( $cancel_order, $order
476476
}
477477

478478
// If the order is awaiting action and was modified within the last day, don't cancel it.
479-
if ( wc_string_to_bool( $order->get_meta( WC_Stripe_Helper::PAYMENT_AWAITING_ACTION_META, true ) ) && $order->get_date_modified( 'edit' )->getTimestamp() > strtotime( '-1 day' ) ) {
479+
if ( wc_string_to_bool( $order->get_meta( WC_Stripe_Order_Metas::META_STRIPE_PAYMENT_AWAITING_ACTION, true ) ) && $order->get_date_modified( 'edit' )->getTimestamp() > strtotime( '-1 day' ) ) {
480480
$cancel_order = false;
481481
}
482482

0 commit comments

Comments
 (0)