Skip to content

Commit

Permalink
Merge branch 'develop' into add/e2e-tests-for-express-checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
annemirasol authored Feb 7, 2025
2 parents 3136200 + 344996f commit f1f6244
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
* Fix - Improve the appearance of Stripe elements in checkout pages to match the store theme.
* Fix - Hide ECE button for synced subscription variations.
* Fix - Use the original shipping address for Amazon Pay pay for orders.
* Tweak - Improve slow query for legacy SEPA subscriptions on WC status tools page by caching the data.
* Tweak - Improve settings page load by delaying oauth URL generation.
* Tweak - Update the Woo logo in the Configure connection modal
* Add - Add currency restriction pill on Amazon Pay.

= 9.1.1 - 2025-01-10 =
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.
Expand Down
8 changes: 8 additions & 0 deletions client/settings/payment-request-section/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '../../data';
import './styles.scss';
import AmazonPayIcon from '../../payment-method-icons/amazon-pay';
import PaymentMethodMissingCurrencyPill from '../../components/payment-method-missing-currency-pill';
import {
PAYMENT_METHOD_CARD,
PAYMENT_METHOD_LINK,
Expand Down Expand Up @@ -259,6 +260,13 @@ const PaymentRequestSection = () => {
'Amazon Pay',
'woocommerce-gateway-stripe'
) }
<PaymentMethodMissingCurrencyPill
id="amazon_pay"
label={ __(
'Amazon Pay',
'woocommerce-gateway-stripe'
) }
/>
</div>
<div className="express-checkout__description">
{
Expand Down
13 changes: 13 additions & 0 deletions client/utils/use-payment-method-currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
PAYMENT_METHOD_ALIPAY,
PAYMENT_METHOD_KLARNA,
PAYMENT_METHOD_WECHAT_PAY,
PAYMENT_METHOD_AMAZON_PAY,
} from 'wcstripe/stripe-utils/constants';

const accountCountry =
Expand Down Expand Up @@ -152,6 +153,7 @@ const getWechatPayCurrencies = () => {
'PT',
'ES',
];

if ( EuroSupportedCountries.includes( accountCountry ) ) {
upeCurrencies = [ 'EUR', 'CNY' ];
}
Expand Down Expand Up @@ -206,6 +208,15 @@ const getKlarnaCurrencies = () => {
);
};

const getAmazonPayCurrencies = () => {
switch ( accountCountry ) {
case 'US':
return [ 'USD' ];
default:
return [ 'USD' ];
}
};

export const usePaymentMethodCurrencies = ( paymentMethodId ) => {
const { isUpeEnabled } = useContext( UpeToggleContext );

Expand All @@ -216,6 +227,8 @@ export const usePaymentMethodCurrencies = ( paymentMethodId ) => {
return getWechatPayCurrencies();
case PAYMENT_METHOD_KLARNA:
return getKlarnaCurrencies();
case PAYMENT_METHOD_AMAZON_PAY:
return getAmazonPayCurrencies();
default:
return PaymentMethodsMap[ paymentMethodId ]?.currencies || [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
class WC_Stripe_Subscriptions_Repairer_Legacy_SEPA_Tokens extends WCS_Background_Repairer {

const LEGACY_SEPA_SUBSCRIPTIONS_COUNT = 'woocommerce_stripe_subscriptions_with_legacy_sepa';

/**
* The transient key used to store the progress of the repair.
*
Expand Down Expand Up @@ -341,6 +343,12 @@ public function add_debug_tool( $tools ) {
* @return bool True if there are subscriptions using the Legacy SEPA payment method, false otherwise.
*/
private function has_legacy_sepa_subscriptions() {
$cached_legacy_sepa_subscriptions_count = get_transient( self::LEGACY_SEPA_SUBSCRIPTIONS_COUNT );

if ( false !== $cached_legacy_sepa_subscriptions_count ) {
return $cached_legacy_sepa_subscriptions_count > 0;
}

$subscriptions = wc_get_orders(
[
'return' => 'ids',
Expand All @@ -350,8 +358,11 @@ private function has_legacy_sepa_subscriptions() {
'payment_method' => WC_Gateway_Stripe_Sepa::ID,
]
);
$subscriptions_count = count( $subscriptions );

set_transient( self::LEGACY_SEPA_SUBSCRIPTIONS_COUNT, $subscriptions_count, 12 * HOUR_IN_SECONDS );

return ! empty( $subscriptions );
return $subscriptions_count > 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Fix - Improve the appearance of Stripe elements in checkout pages to match the store theme.
* Fix - Hide ECE button for synced subscription variations.
* Fix - Use the original shipping address for Amazon Pay pay for orders.
* Tweak - Improve slow query for legacy SEPA subscriptions on WC status tools page by caching the data.
* Tweak - Improve settings page load by delaying oauth URL generation.
* Tweak - Update the Woo logo in the Configure connection modal
* Add - Add currency restriction pill on Amazon Pay.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public function set_up() {

update_option( WC_Stripe_Feature_Flags::LPM_ACH_FEATURE_FLAG_NAME, 'yes' );

$stripe_settings = WC_Stripe_Helper::get_stripe_settings();
$stripe_settings['sepa_tokens_for_other_methods'] = 'yes';
WC_Stripe_Helper::update_main_stripe_settings( $stripe_settings );

$mock_account = $this->getMockBuilder( 'WC_Stripe_Account' )
->disableOriginalConstructor()
->getMock();
Expand Down

0 comments on commit f1f6244

Please sign in to comment.