From 325ef035746c9c44bf6ff2a82968f5a574e04e20 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:00:29 +0000 Subject: [PATCH 1/3] Update version and add changelog entries for release 6.4.2 --- changelog.txt | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 5 ++++- woocommerce-payments.php | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4ea06d5753b..35e41948438 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ *** WooPayments Changelog *** += 6.4.2 - 2023-09-20 = + = 6.4.1 - 2023-09-06 = * Fix - checkout processing when fields are hidden via customizer * Fix - Potential fatal error when viewing WooCommerce home because we try to check if store has been fully onboarded but account service is not yet initialized. diff --git a/package-lock.json b/package-lock.json index 25a45ea4485..fcc0dc2f024 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-payments", - "version": "6.4.1", + "version": "6.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "woocommerce-payments", - "version": "6.4.1", + "version": "6.4.2", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 3e56b6f367b..f3c983d27ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-payments", - "version": "6.4.1", + "version": "6.4.2", "main": "webpack.config.js", "author": "Automattic", "license": "GPL-3.0-or-later", diff --git a/readme.txt b/readme.txt index 74cf3b8bde3..ecdacabe8c8 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: payment gateway, payment, apple pay, credit card, google pay, woocommerce Requires at least: 6.0 Tested up to: 6.2 Requires PHP: 7.3 -Stable tag: 6.4.1 +Stable tag: 6.4.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -94,6 +94,9 @@ Please note that our support for the checkout block is still experimental and th == Changelog == += 6.4.2 - 2023-09-20 = + + = 6.4.1 - 2023-09-06 = * Fix - checkout processing when fields are hidden via customizer * Fix - Potential fatal error when viewing WooCommerce home because we try to check if store has been fully onboarded but account service is not yet initialized. diff --git a/woocommerce-payments.php b/woocommerce-payments.php index 47198f4131a..07d9e9b01f7 100644 --- a/woocommerce-payments.php +++ b/woocommerce-payments.php @@ -12,7 +12,7 @@ * WC tested up to: 7.8.0 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 6.4.1 + * Version: 6.4.2 * * @package WooCommerce\Payments */ From ddbd33f228bd01ac7b8c8713397067f4561fbfef Mon Sep 17 00:00:00 2001 From: Miguel Gasca Date: Thu, 14 Sep 2023 17:35:47 +0200 Subject: [PATCH 2/3] Fix checkout error with Afterpay (#7214) This change fixes an error in the checkout due to missing shipping information in the request to create and confirm a payment intent. --- .../hotfix-7187-checkout-error-with-afterpay | 4 ++++ includes/class-wc-payment-gateway-wcpay.php | 18 ++++++++++++++++ .../class-upe-payment-gateway.php | 3 ++- .../class-upe-split-payment-gateway.php | 21 ++++++++++++++++++- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 changelog/hotfix-7187-checkout-error-with-afterpay diff --git a/changelog/hotfix-7187-checkout-error-with-afterpay b/changelog/hotfix-7187-checkout-error-with-afterpay new file mode 100644 index 00000000000..05ace389de8 --- /dev/null +++ b/changelog/hotfix-7187-checkout-error-with-afterpay @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix an error in the checkout when Afterpay is selected as payment method. diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 5f459e4c3a2..59f4d39527b 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -1128,6 +1128,9 @@ public function process_payment_for_order( $cart, $payment_information, $schedul $request->set_payment_methods( $payment_methods ); $request->set_cvc_confirmation( $payment_information->get_cvc_confirmation() ); + // Add specific payment method parameters to the request. + $this->modify_create_intent_parameters_when_processing_payment( $request, $payment_information, $order ); + // The below if-statement ensures the support for UPE payment methods. if ( $this->upe_needs_redirection( $payment_methods ) ) { $request->set_return_url( @@ -3599,4 +3602,19 @@ private function is_platform_payment_method( bool $is_using_saved_payment_method private function upe_needs_redirection( $payment_methods ) { return 1 === count( $payment_methods ) && 'card' !== $payment_methods[0]; } + + /** + * Modifies the create intent parameters when processing a payment. + * + * Currently used by child UPE_Split_Payment_Gateway to add required shipping information for Afterpay. + * + * @param Create_And_Confirm_Intention $request The request object for creating and confirming intention. + * @param Payment_Information $payment_information The payment information object. + * @param mixed $order The order object or data. + * + * @return void + */ + protected function modify_create_intent_parameters_when_processing_payment( Create_And_Confirm_Intention $request, Payment_Information $payment_information, $order ) { + // Do nothing. + } } diff --git a/includes/payment-methods/class-upe-payment-gateway.php b/includes/payment-methods/class-upe-payment-gateway.php index 8745cdefccf..305267c2786 100644 --- a/includes/payment-methods/class-upe-payment-gateway.php +++ b/includes/payment-methods/class-upe-payment-gateway.php @@ -45,7 +45,8 @@ use WCPay\Duplicate_Payment_Prevention_Service; use WP_User; use WC_Payments_Localization_Service; - +use WCPay\Payment_Information; +use WCPay\Core\Server\Request\Create_And_Confirm_Intention; /** * UPE Payment method extended from WCPay generic Gateway. diff --git a/includes/payment-methods/class-upe-split-payment-gateway.php b/includes/payment-methods/class-upe-split-payment-gateway.php index a8f77b4bd0b..dc5308fc829 100644 --- a/includes/payment-methods/class-upe-split-payment-gateway.php +++ b/includes/payment-methods/class-upe-split-payment-gateway.php @@ -28,7 +28,8 @@ use WCPay\Duplicate_Payment_Prevention_Service; use WP_User; use WC_Payments_Localization_Service; - +use WCPay\Payment_Information; +use WCPay\Core\Server\Request\Create_And_Confirm_Intention; /** @@ -529,4 +530,22 @@ public function get_payment_method() { public function get_stripe_id() { return $this->stripe_id; } + + + /** + * Modifies the create intent parameters when processing a payment. + * + * If the selected Stripe payment type is AFTERPAY, it updates the shipping data in the request. + * + * @param Create_And_Confirm_Intention $request The request object for creating and confirming intention. + * @param Payment_Information $payment_information The payment information object. + * @param mixed $order The order object or data. + * + * @return void + */ + protected function modify_create_intent_parameters_when_processing_payment( Create_And_Confirm_Intention $request, Payment_Information $payment_information, $order ) { + if ( Payment_Method::AFTERPAY === $this->get_selected_stripe_payment_type_id() ) { + $request->set_shipping( $this->get_shipping_data_from_order( $order ) ); + } + } } From 458e28f7821601a368017fb11515485b975fbc5f Mon Sep 17 00:00:00 2001 From: botwoo Date: Thu, 14 Sep 2023 15:39:54 +0000 Subject: [PATCH 3/3] Amend changelog entries for release 6.4.2 --- changelog.txt | 3 ++- changelog/hotfix-7187-checkout-error-with-afterpay | 4 ---- readme.txt | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 changelog/hotfix-7187-checkout-error-with-afterpay diff --git a/changelog.txt b/changelog.txt index 35e41948438..13f4ed780c8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ *** WooPayments Changelog *** -= 6.4.2 - 2023-09-20 = += 6.4.2 - 2023-09-14 = +* Fix - Fix an error in the checkout when Afterpay is selected as payment method. = 6.4.1 - 2023-09-06 = * Fix - checkout processing when fields are hidden via customizer diff --git a/changelog/hotfix-7187-checkout-error-with-afterpay b/changelog/hotfix-7187-checkout-error-with-afterpay deleted file mode 100644 index 05ace389de8..00000000000 --- a/changelog/hotfix-7187-checkout-error-with-afterpay +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fix - -Fix an error in the checkout when Afterpay is selected as payment method. diff --git a/readme.txt b/readme.txt index ecdacabe8c8..3cfeefbc70b 100644 --- a/readme.txt +++ b/readme.txt @@ -94,7 +94,8 @@ Please note that our support for the checkout block is still experimental and th == Changelog == -= 6.4.2 - 2023-09-20 = += 6.4.2 - 2023-09-14 = +* Fix - Fix an error in the checkout when Afterpay is selected as payment method. = 6.4.1 - 2023-09-06 =