Skip to content

Commit

Permalink
Merge branch 'trunk' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrosa committed Jan 10, 2025
2 parents c26c8c5 + a39dc9f commit bcb7673
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 70 deletions.
12 changes: 3 additions & 9 deletions assets/js/stripe.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
/* global wc_stripe_params, Stripe */

import {
PAYMENT_METHOD_BOLETO,
PAYMENT_METHOD_OXXO,
PAYMENT_METHOD_SEPA,
} from 'wcstripe/stripe-utils/constants';

jQuery( function($ ) {
'use strict';

Expand Down Expand Up @@ -544,7 +538,7 @@ jQuery( function($ ) {
if ( wc_stripe_form.isSepaChosen() ) {
extra_details.currency = $( '#stripe-sepa_debit-payment-data' ).data( 'currency' );
extra_details.mandate = { notification_method: wc_stripe_params.sepa_mandate_notification };
extra_details.type = PAYMENT_METHOD_SEPA;
extra_details.type = 'sepa_debit';

return stripe.createSource( iban, extra_details ).then( wc_stripe_form.sourceResponse );
}
Expand Down Expand Up @@ -701,7 +695,7 @@ jQuery( function($ ) {
* After the customer closes the modal proceeds with checkout normally
*/
handleBoleto: function () {
wc_stripe_form.executeCheckout( PAYMENT_METHOD_BOLETO, function ( checkout_response ) {
wc_stripe_form.executeCheckout( 'boleto', function ( checkout_response ) {
stripe.confirmBoletoPayment(
checkout_response.client_secret,
checkout_response.confirm_payment_data
Expand Down Expand Up @@ -785,7 +779,7 @@ jQuery( function($ ) {
* After the customer closes the modal proceeds with checkout normally
*/
handleOxxo: function () {
wc_stripe_form.executeCheckout( PAYMENT_METHOD_OXXO, function ( checkout_response ) {
wc_stripe_form.executeCheckout( 'oxxo', function ( checkout_response ) {
stripe.confirmOxxoPayment(
checkout_response.client_secret,
checkout_response.confirm_payment_data
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

= 9.2.0 - xxxx-xx-xx =

= 9.1.1 - 2025-01-10 =
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.
* Fix - Payment request button fails to display when the legacy checkout experience is enabled.
* Fix - Resolves the payment element loading issue in the legacy checkout experience.

= 9.1.0 - 2025-01-09 =
* Fix - Fixes the new checkout experience not being enabled by default due to conflict with a migration.
* Fix - Prevents duplicated credit cards to be added to the customer's account through the My Account page, the shortcode checkout and the block checkout.
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-stripe-blocks-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private function register_legacy_payment_method_script_handles() {
* @return array
*/
public function get_payment_method_data() {
$js_params = WC_Stripe_Feature_Flags::is_stripe_ece_enabled()
$js_params = WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && WC_Stripe_Feature_Flags::is_stripe_ece_enabled()
? $this->get_express_checkout_javascript_params()
: $this->get_payment_request_javascript_params();
// We need to call array_merge_recursive so the blocks 'button' setting doesn't overwrite
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-stripe-webhook-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1316,8 +1316,8 @@ private function get_order_from_intent( $intent ) {
// Try to retrieve from the charges array.
if ( ! empty( $intent->charges ) ) {
$charge = $intent->charges[0] ?? [];
$order_id = $charge['metadata']['order_id'] ?? null;
return wc_get_order( $order_id );
$order_id = $charge->metadata->order_id ?? null;
return $order_id ? wc_get_order( $order_id ) : false;
}

// Fall back to finding the order via the intent ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function is_account_creation_possible() {
* @return string
*/
public function get_button_type() {
return isset( $this->stripe_settings['express_checkout_button_type'] ) ? $this->stripe_settings['express_checkout_button_type'] : 'default';
return isset( $this->stripe_settings['payment_request_button_type'] ) ? $this->stripe_settings['payment_request_button_type'] : 'default';
}

/**
Expand All @@ -94,7 +94,7 @@ public function get_button_type() {
* @return string
*/
public function get_button_theme() {
return isset( $this->stripe_settings['express_checkout_button_theme'] ) ? $this->stripe_settings['express_checkout_button_theme'] : 'dark';
return isset( $this->stripe_settings['payment_request_button_theme'] ) ? $this->stripe_settings['payment_request_button_theme'] : 'dark';
}

/**
Expand All @@ -103,7 +103,7 @@ public function get_button_theme() {
* @return string
*/
public function get_button_height() {
$height = isset( $this->stripe_settings['express_checkout_button_size'] ) ? $this->stripe_settings['express_checkout_button_size'] : 'default';
$height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default';
if ( 'small' === $height ) {
return '40';
}
Expand All @@ -121,7 +121,7 @@ public function get_button_height() {
* @return string
*/
public function get_button_radius() {
$height = isset( $this->stripe_settings['express_checkout_button_size'] ) ? $this->stripe_settings['express_checkout_button_size'] : 'default';
$height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default';
if ( 'small' === $height ) {
return '2';
}
Expand Down Expand Up @@ -1329,18 +1329,18 @@ public function get_login_confirmation_settings() {
*/
public function get_button_locations() {
// If the locations have not been set return the default setting.
if ( ! isset( $this->stripe_settings['express_checkout_button_locations'] ) ) {
if ( ! isset( $this->stripe_settings['payment_request_button_locations'] ) ) {
return [ 'product', 'cart' ];
}

// If all locations are removed through the settings UI the location config will be set to
// an empty string "". If that's the case (and if the settings are not an array for any
// other reason) we should return an empty array.
if ( ! is_array( $this->stripe_settings['express_checkout_button_locations'] ) ) {
if ( ! is_array( $this->stripe_settings['payment_request_button_locations'] ) ) {
return [];
}

return $this->stripe_settings['express_checkout_button_locations'];
return $this->stripe_settings['payment_request_button_locations'];
}

/**
Expand All @@ -1351,7 +1351,7 @@ public function get_button_locations() {
* @return boolean
*/
public function is_express_checkout_enabled() {
return isset( $this->stripe_settings['express_checkout'] ) && 'yes' === $this->stripe_settings['express_checkout'];
return isset( $this->stripe_settings['payment_request'] ) && 'yes' === $this->stripe_settings['payment_request'];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct() {
add_action( 'woocommerce_stripe_updated', [ $this, 'migrate_button_size' ] );

// Check if ECE feature flag is enabled.
if ( WC_Stripe_Feature_Flags::is_stripe_ece_enabled() ) {
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && WC_Stripe_Feature_Flags::is_stripe_ece_enabled() ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion 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,7 +1,7 @@
{
"name": "woocommerce-gateway-stripe",
"title": "WooCommerce Gateway Stripe",
"version": "9.1.0",
"version": "9.1.1",
"license": "GPL-3.0",
"homepage": "http://wordpress.org/plugins/woocommerce-gateway-stripe/",
"repository": {
Expand Down
40 changes: 1 addition & 39 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, bancont
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 9.1.0
Stable tag: 9.1.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Attributions: thorsten-stripe
Expand Down Expand Up @@ -112,42 +112,4 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o

= 9.2.0 - xxxx-xx-xx =

= 9.1.0 - 2025-01-09 =
* Fix - Fixes the new checkout experience not being enabled by default due to conflict with a migration.
* Fix - Prevents duplicated credit cards to be added to the customer's account through the My Account page, the shortcode checkout and the block checkout.
* Fix - Return to the correct page when redirect-based payment method fails.
* Fix - Show default recipient for Payment Authentication Requested email.
* Fix - Correctly handles IPP failed payments webhook calls by extracting the order ID from the payment intent metadata.
* Dev - Fix lint issues raised by WordPress code standards.
* Fix - Fix ECE crash in classic cart and checkout pages for non-English language sites.
* Fix - Correctly handles UK postcodes redacted by Apple Pay.
* Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute.
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.
* Fix - Don't update canceled order status to on-hold when a dispute is opened.
* Fix - Correctly sets the dispute opened note when a dispute does not require any further action.
* Add - Display Multibanco payment instruction details in Order Received page and Order Confirmation email.
* Tweak - Add the transaction limit information to the Afterpay/Clearpay method when listing payment methods.
* Tweak - Add transaction threshold information to Affirm when listing payment methods.
* Fix - Handles additional fields when checking out using ECE on the block checkout.
* Dev - Introduces new payment method name constants for the frontend.
* Dev - Improves the missing intent params error log by appending the payment information array.
* Tweak - Improve error message displayed when payment method creation fails in classic checkout.
* Tweak - Display email address for Link saved payment methods.
* Fix - Only update order status for a Radar review closed event when the order was already captured.
* Dev - Introduces a new class with payment intent statuses constants.
* Add - Correctly handles charge expired webhook events, setting the order status to failed and adding a note.
* Fix - Allow account creation on checkout, if enabled, when purchasing subscriptions using ECE.
* Tweak - Add empty check for cart when checking for allowed products for express checkout.
* Tweak - Improve webhook status related messages on the settings page.
* Update - Prevent editing of orders awaiting payment capture.
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
* Dev - Add a GitHub Action workflow to run QIT E2E Integrations tests.
* Fix - Check billing interval and period to set in mandate options.
* Fix - Check order currency on pay for order page to display supported payment methods.
* Update - Migrate payment request settings data to express checkout settings data.
* Update - Make the new Stripe Express Checkout Element enabled by default in all accounts.
* Fix - Duplicate emails when enabling the gateway.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
18 changes: 12 additions & 6 deletions tests/phpunit/test-wc-stripe-webhook-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,21 +433,27 @@ public function test_process_payment_intent(
$order->save_meta_data();
$order->save();

$notification = (object) [
$notification = [
'type' => $event_type,
'data' => (object) [
'object' => (object) [
'data' => [
'object' => [
'id' => 'pi_mock',
'metadata' => (object) [
'order_id' => $order->get_id(),
'charges' => [
[
'metadata' => [
'order_id' => $order->get_id(),
],
],
],
'last_payment_error' => (object) [
'last_payment_error' => [
'message' => 'Your card was declined. You can call your bank for details.',
],
],
],
];

$notification = json_decode( wp_json_encode( $notification ) );

$this->mock_webhook_handler->process_payment_intent( $notification );

$final_order = wc_get_order( $order->get_id() );
Expand Down
4 changes: 2 additions & 2 deletions woocommerce-gateway-stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Take credit card payments on your store using Stripe.
* Author: Stripe
* Author URI: https://stripe.com/
* Version: 9.1.0
* Version: 9.1.1
* Requires Plugins: woocommerce
* Requires at least: 6.5
* Tested up to: 6.7
Expand All @@ -22,7 +22,7 @@
/**
* Required minimums and constants
*/
define( 'WC_STRIPE_VERSION', '9.1.0' ); // WRCS: DEFINED_VERSION.
define( 'WC_STRIPE_VERSION', '9.1.1' ); // WRCS: DEFINED_VERSION.
define( 'WC_STRIPE_MIN_PHP_VER', '7.3.0' );
define( 'WC_STRIPE_MIN_WC_VER', '7.4' );
define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '7.5' );
Expand Down

0 comments on commit bcb7673

Please sign in to comment.