Skip to content

Commit

Permalink
Merge release/6.4.2 into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarcosta99 committed Sep 14, 2023
2 parents 4f75334 + 458e28f commit d169784
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*** WooPayments Changelog ***

= 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
* 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.
Expand Down
18 changes: 18 additions & 0 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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.
}
}
3 changes: 2 additions & 1 deletion includes/payment-methods/class-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 20 additions & 1 deletion includes/payment-methods/class-upe-split-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -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 ) );
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -94,6 +94,10 @@ Please note that our support for the checkout block is still experimental and th

== Changelog ==

= 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
* 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.
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit d169784

Please sign in to comment.