Skip to content

Commit 9aebcee

Browse files
Revert order wrapper class (#4298)
* Revert "Implementing the order wrapper class in the new checkout (#4111)" This reverts commit 154f4df. * Revert "Implementing the order wrapper class in the root files (#4112)" This reverts commit f6cb1de. * Revert "Implementing the order wrapper class in compatibility classes (#4109)" This reverts commit 91167e3. * Revert "Implementing the order wrapper class in abstract classes and webhook handler (#4106)" This reverts commit 6e3fa25. * Revert "Implementing the order wrapper class in legacy checkout methods (#4107)" This reverts commit 7b74182. * Revert "Implementing the order wrapper class in express payment methods (#4110)" This reverts commit 893842d. * Revert "Implementing the order wrapper class in admin classes (#4108)" This reverts commit 3eda8c6. * Revert "Fix fatal error in subscription payment method switch in legacy checkout (#4222)" This reverts commit 0e90669. * Revert "Implementing the Stripe order class in unit tests (#4086)" This reverts commit 391719d. * Revert "Fix fatal error in subscription payment method switch (#4205)" This reverts commit 6aa4c89. * Remove remaining calls to to_instance --------- Co-authored-by: daledupreez <[email protected]>
1 parent 43da393 commit 9aebcee

File tree

46 files changed

+488
-585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+488
-585
lines changed

changelog.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
* Dev - Renames all references to "Smart Checkout" and "Single Payment Element" (and "SPE") to "Optimized Checkout" (and "OC"), following the feature rebranding.
77
* Tweak - Updates the "Smart Checkout" setting name to "Optimized Checkout", and the description accordingly.
88
* Fix - Checks for the existence of the WC_Stripe_Feature_Flags class before including it during extension initialization.
9-
* Dev - Implements the new Stripe order class into the new checkout experience files.
109
* Dev - Splits the code coverage GitHub Actions Workflow into two separate actions.
11-
* Dev - Implements the new Stripe order class into the root extension files.
1210
* Fix - Fixes the listing of payment methods in the Stripe settings page when the Smart Checkout is enabled.
1311
* Tweak - Passes the correct parent payment method configuration ID (retrieved from the backend) to the Smart Checkout payment element.
1412
* Tweak - Removes the Stripe icon beside the Smart Checkout payment element from the checkout pages.
1513
* Add - New setting to allow merchants to set their preferred title for the Smart Checkout payment element. Defaults to "Stripe".
16-
* Dev - Implements the new Stripe order class into the compatibility classes.
1714
* Dev - Updates the Code Sniffer package to version 1.0.0.
1815
* Update - Add ECE support for One Page Checkout and other dynamic cart update scenarios
1916
* Fix - Show error notice when 'Add payment method' fails on My Account page in block-based themes.
@@ -38,17 +35,12 @@
3835
* Dev - Improves Smart Checkout code with shared and new methods, on both front and backend.
3936
* Fix - Fixes the saving of payment methods when Smart Checkout is enabled.
4037
* Tweak - Correctly handles the display of payment method instructions when Smart Checkout is enabled.
41-
* Dev - Implements the new Stripe order class into abstract/base classes, and the webhook handler.
42-
* Dev - Implements the new Stripe order class into the legacy checkout classes.
4338
* Dev - Do not generate filenames with underscores.
4439
* Fix - Fixes the Stripe checkout container visuals when Smart Checkout is disabled.
45-
* Dev - Implements the new Stripe order class into the express checkout classes.
46-
* Dev - Implements the new Stripe order class into the wp-admin related classes.
4740
* Dev - Replaces references to order status values with their respective constants from the WooCommerce plugin.
4841
* Tweak - Updates the Smart Checkout (classic/shortcode checkout version) to make all the payment methods look as similar as possible to any other WooCommerce payment method.
4942
* Tweak - Updates the Smart Checkout (block checkout version) to make all the payment methods look as similar as possible to any other WooCommerce payment method.
5043
* Fix - Improves the subscriptions detached admin notice, making it less intrusive and limiting the querying to 5 subscriptions (avoiding slow loading times).
51-
* Dev - Implements the new Stripe order class into the PHP unit tests.
5244
* Dev - Introduces new payment method constants for the express methods: Google Pay, Apple Pay, Link, and Amazon Pay (backend version).
5345
* Dev - Introduces a new Stripe Order class to wrap Stripe-specific logic and data on the backend.
5446
* Dev - Improves how we handle express payment method titles by introducing new constants and methods to replace duplicate code.
@@ -89,8 +81,6 @@
8981
* Add - Support for BECS Direct Debit as a new payment method for Australian accounts.
9082
* Update - Back button on the settings pages.
9183
* Update - Use individual product tax status instead of storewide tax setup when determining express checkout availability.
92-
* Fix - Ensure the subscription object is not converted into a Stripe order object.
93-
* Fix - Ensure the subscription and pre-order objects are not converted into a Stripe order object in legacy experience.
9484
* Update - Credit and Bank (BECS and ACSS) icons on the Block checkout page.
9585
* Fix - Fix BLIK visibility based on account and billing countries.
9686
* Add - Use Stripe Configuration API to manage payment methods enabled/disabled states.

includes/abstracts/abstract-wc-stripe-payment-gateway-voucher.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function javascript_params() {
227227

228228
if ( $this->is_valid_pay_for_order_endpoint() ) {
229229
$order_id = absint( get_query_var( 'order-pay' ) );
230-
$stripe_params['stripe_order_key'] = ! empty( $order_id ) ? WC_Stripe_Order::get_by_id( $order_id )->get_order_key() : null;
230+
$stripe_params['stripe_order_key'] = ! empty( $order_id ) ? wc_get_order( $order_id )->get_order_key() : null;
231231
}
232232

233233
return $stripe_params;
@@ -256,19 +256,19 @@ public function init_form_fields() {
256256
*/
257257
public function process_payment( $order_id, $retry = true, $force_save_save = false ) {
258258
try {
259-
$order = WC_Stripe_Order::get_by_id( $order_id );
259+
$order = wc_get_order( $order_id );
260260

261261
if ( ! in_array( $order->get_billing_country(), $this->supported_countries ) ) {
262262
throw new \Exception( __( 'This payment method is not available in the selected country', 'woocommerce-gateway-stripe' ) );
263263
}
264264

265265
$intent = $this->create_or_update_payment_intent( $order );
266266

267-
$order->set_upe_payment_type( $this->stripe_id );
267+
$order->update_meta_data( '_stripe_upe_payment_type', $this->stripe_id );
268268
$order->update_status( OrderStatus::PENDING, __( 'Awaiting payment.', 'woocommerce-gateway-stripe' ) );
269269
$order->save();
270270

271-
$order->add_payment_intent_to_order( $intent->id );
271+
WC_Stripe_Helper::add_payment_intent_to_order( $intent->id, $order );
272272

273273
return [
274274
'result' => 'success',
@@ -375,7 +375,7 @@ public function update_payment_intent_ajax() {
375375
throw new \Exception( __( 'Order Id not found, send an order id', 'woocommerce-gateway-stripe' ) );
376376
}
377377

378-
$order = WC_Stripe_Order::get_by_id( $order_id );
378+
$order = wc_get_order( $order_id );
379379

380380
$order_key = isset( $_POST['stripe_order_key'] ) ? wc_clean( wp_unslash( $_POST['stripe_order_key'] ) ) : null;
381381
if ( $order->get_order_key() !== $order_key ) {
@@ -386,7 +386,7 @@ public function update_payment_intent_ajax() {
386386
$intent = $this->create_or_update_payment_intent( $order );
387387

388388
$order->update_status( OrderStatus::PENDING, __( 'Awaiting payment.', 'woocommerce-gateway-stripe' ) );
389-
$order->set_upe_payment_type( $this->stripe_id );
389+
$order->update_meta_data( '_stripe_upe_payment_type', $this->stripe_id );
390390
$order->save();
391391

392392
wp_send_json(

0 commit comments

Comments
 (0)