Skip to content

Commit 344996f

Browse files
Add currency restriction pill on Amazon Pay (#3856)
* Add currency restriction pill on Amazon Pay * Add changelog entry --------- Co-authored-by: Diego Curbelo <[email protected]>
1 parent 38e94a5 commit 344996f

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* Tweak - Improve slow query for legacy SEPA subscriptions on WC status tools page by caching the data.
4545
* Tweak - Improve settings page load by delaying oauth URL generation.
4646
* Tweak - Update the Woo logo in the Configure connection modal
47+
* Add - Add currency restriction pill on Amazon Pay.
4748

4849
= 9.1.1 - 2025-01-10 =
4950
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.

client/settings/payment-request-section/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from '../../data';
1717
import './styles.scss';
1818
import AmazonPayIcon from '../../payment-method-icons/amazon-pay';
19+
import PaymentMethodMissingCurrencyPill from '../../components/payment-method-missing-currency-pill';
1920
import {
2021
PAYMENT_METHOD_CARD,
2122
PAYMENT_METHOD_LINK,
@@ -259,6 +260,13 @@ const PaymentRequestSection = () => {
259260
'Amazon Pay',
260261
'woocommerce-gateway-stripe'
261262
) }
263+
<PaymentMethodMissingCurrencyPill
264+
id="amazon_pay"
265+
label={ __(
266+
'Amazon Pay',
267+
'woocommerce-gateway-stripe'
268+
) }
269+
/>
262270
</div>
263271
<div className="express-checkout__description">
264272
{

client/utils/use-payment-method-currencies.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
PAYMENT_METHOD_ALIPAY,
66
PAYMENT_METHOD_KLARNA,
77
PAYMENT_METHOD_WECHAT_PAY,
8+
PAYMENT_METHOD_AMAZON_PAY,
89
} from 'wcstripe/stripe-utils/constants';
910

1011
const accountCountry =
@@ -152,6 +153,7 @@ const getWechatPayCurrencies = () => {
152153
'PT',
153154
'ES',
154155
];
156+
155157
if ( EuroSupportedCountries.includes( accountCountry ) ) {
156158
upeCurrencies = [ 'EUR', 'CNY' ];
157159
}
@@ -206,6 +208,15 @@ const getKlarnaCurrencies = () => {
206208
);
207209
};
208210

211+
const getAmazonPayCurrencies = () => {
212+
switch ( accountCountry ) {
213+
case 'US':
214+
return [ 'USD' ];
215+
default:
216+
return [ 'USD' ];
217+
}
218+
};
219+
209220
export const usePaymentMethodCurrencies = ( paymentMethodId ) => {
210221
const { isUpeEnabled } = useContext( UpeToggleContext );
211222

@@ -216,6 +227,8 @@ export const usePaymentMethodCurrencies = ( paymentMethodId ) => {
216227
return getWechatPayCurrencies();
217228
case PAYMENT_METHOD_KLARNA:
218229
return getKlarnaCurrencies();
230+
case PAYMENT_METHOD_AMAZON_PAY:
231+
return getAmazonPayCurrencies();
219232
default:
220233
return PaymentMethodsMap[ paymentMethodId ]?.currencies || [];
221234
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
154154
* Tweak - Improve slow query for legacy SEPA subscriptions on WC status tools page by caching the data.
155155
* Tweak - Improve settings page load by delaying oauth URL generation.
156156
* Tweak - Update the Woo logo in the Configure connection modal
157+
* Add - Add currency restriction pill on Amazon Pay.
157158

158159
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)