Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using constants in payment methods map file #3852

Merged
merged 36 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3831008
PoC: Add ACSS Debit payment method
ricardo Jan 22, 2025
5c7b815
Work around deferred intents
ricardo Jan 23, 2025
b65e7d2
Changes required for ACSS
ricardo Jan 25, 2025
838f9b3
Merge branch 'develop' into poc/3708-enable-pre-auth-pm
ricardo Jan 30, 2025
b2d42b5
Some code cleanup for ACSS
ricardo Jan 30, 2025
09fbf6e
Only mount UPE when the payment element is selected on the classic ch…
ricardo Jan 31, 2025
4471721
Refactor create intent and mandate options
ricardo Jan 31, 2025
c6b920c
Refactor payment processing
ricardo Feb 1, 2025
c409cc1
Cleanup
ricardo Feb 3, 2025
4984b33
Merge branch 'develop' into fix/3804-refactor-deferred-intent
ricardo Feb 3, 2025
ac22800
Fix PHP lint issue
ricardo Feb 3, 2025
b536123
Fix JS lint errors
ricardo Feb 3, 2025
d14ca72
Fix PHP unit tests
ricardo Feb 3, 2025
531d2f5
Fix missing customer and metadata from PI
ricardo Feb 3, 2025
fac59c4
Standardizing feature flag condition in direct debit PMs
ricardo Feb 4, 2025
fae34f6
Fix icon
ricardo Feb 4, 2025
3788184
Add tests / Fix tests
ricardo Feb 4, 2025
fe861c3
Merge branch 'develop' into fix/3804-refactor-deferred-intent
ricardo Feb 4, 2025
9542421
Handle "payment_intent.processing" webhooks.
ricardo Feb 5, 2025
af3d876
Merge branch 'develop' into fix/3804-refactor-deferred-intent
ricardo Feb 5, 2025
6c4ca4a
Using constants in payment methods map file
wjrosa Feb 6, 2025
e166763
Add unit test to payment_intent.processing
ricardo Feb 6, 2025
e066659
Merge branch 'develop' into fix/3804-refactor-deferred-intent
wjrosa Feb 6, 2025
825ecea
Add ifs for better coverage
ricardo Feb 6, 2025
c67e0fb
Merge branch 'develop' into fix/3804-refactor-deferred-intent
ricardo Feb 6, 2025
a0ad301
Merge branch 'fix/3804-refactor-deferred-intent' of github.com:woocom…
ricardo Feb 6, 2025
f539b4c
Fix PHP lint issue
ricardo Feb 6, 2025
35dd03b
Update client/stripe-utils/utils.js
ricardo Feb 7, 2025
e2add2c
Changelog and readme entries
wjrosa Feb 10, 2025
f071d5a
Merge branch 'fix/3804-refactor-deferred-intent' into dev/using-const…
wjrosa Feb 10, 2025
c97dec5
Update includes/class-wc-stripe-intent-controller.php
ricardo Feb 10, 2025
c198db4
Merge branch 'develop' into fix/3804-refactor-deferred-intent
ricardo Feb 10, 2025
87f4feb
Fix restrict payment method to country
ricardo Feb 10, 2025
8abb06c
Merge branch 'fix/3804-refactor-deferred-intent' of github.com:woocom…
ricardo Feb 10, 2025
1794606
Merge branch 'fix/3804-refactor-deferred-intent' into dev/using-const…
diegocurbelo Feb 10, 2025
58824e2
Merge branch 'develop' into dev/using-constants-in-payment-methods-ma…
wjrosa Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*** Changelog ***

= 9.2.0 - xxxx-xx-xx =
* Dev - Adds the payment method constants to the payment methods map file (frontend side).
* Add - Adds a new notice for store admins when there are subscriptions without a payment method attached.
* Fix - Hides "pay" and "cancel" buttons on the order received page when an Amazon Pay order is pending, since it may take a while to be confirmed.
* Fix - Fix the quantity parameter for the express checkout add-to-cart API call.
Expand Down
62 changes: 42 additions & 20 deletions client/payment-methods-map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import { __ } from '@wordpress/i18n';
import icons from './payment-method-icons';
import {
PAYMENT_METHOD_ACH,
PAYMENT_METHOD_ACSS,
PAYMENT_METHOD_AFFIRM,
PAYMENT_METHOD_AFTERPAY_CLEARPAY,
PAYMENT_METHOD_ALIPAY,
PAYMENT_METHOD_BACS,
PAYMENT_METHOD_BANCONTACT,
PAYMENT_METHOD_BOLETO,
PAYMENT_METHOD_CARD,
PAYMENT_METHOD_CASHAPP,
PAYMENT_METHOD_EPS,
PAYMENT_METHOD_GIROPAY,
PAYMENT_METHOD_IDEAL,
PAYMENT_METHOD_KLARNA,
PAYMENT_METHOD_MULTIBANCO,
PAYMENT_METHOD_OXXO,
PAYMENT_METHOD_P24,
PAYMENT_METHOD_SEPA,
PAYMENT_METHOD_SOFORT,
PAYMENT_METHOD_WECHAT_PAY,
} from 'wcstripe/stripe-utils/constants';

const accountCountry =
window.wc_stripe_settings_params?.account_country || 'US';
Expand All @@ -9,7 +31,7 @@ const isBacsEnabled = window.wc_stripe_settings_params?.is_bacs_enabled === '1';

const paymentMethodsMap = {
card: {
id: 'card',
id: PAYMENT_METHOD_CARD,
label: __( 'Credit card / debit card', 'woocommerce-gateway-stripe' ),
description: __(
'Let your customers pay with major credit and debit cards without leaving your store.',
Expand All @@ -20,7 +42,7 @@ const paymentMethodsMap = {
allows_manual_capture: true,
},
giropay: {
id: 'giropay',
id: PAYMENT_METHOD_GIROPAY,
label: __( 'giropay', 'woocommerce-gateway-stripe' ),
description: __(
'Expand your business with giropay — Germany’s second most popular payment system.',
Expand All @@ -30,7 +52,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
klarna: {
id: 'klarna',
id: PAYMENT_METHOD_KLARNA,
label: __( 'Klarna', 'woocommerce-gateway-stripe' ),
description: __(
'Allow customers to pay over time with Klarna.',
Expand All @@ -54,7 +76,7 @@ const paymentMethodsMap = {
allows_manual_capture: true,
},
affirm: {
id: 'affirm',
id: PAYMENT_METHOD_AFFIRM,
label: __( 'Affirm', 'woocommerce-gateway-stripe' ),
// translators: %s is the store currency.
description: __(
Expand All @@ -67,7 +89,7 @@ const paymentMethodsMap = {
},
// Clearpay and Afterpay are the same payment method, but with different strings and icon.
afterpay_clearpay: {
id: 'afterpay_clearpay',
id: PAYMENT_METHOD_AFTERPAY_CLEARPAY,
label:
accountCountry === 'GB'
? __( 'Clearpay', 'woocommerce-gateway-stripe' )
Expand All @@ -87,7 +109,7 @@ const paymentMethodsMap = {
allows_manual_capture: true,
},
sepa_debit: {
id: 'sepa_debit',
id: PAYMENT_METHOD_SEPA,
label: __( 'Direct debit payment', 'woocommerce-gateway-stripe' ),
description: __(
'Reach 500 million customers and over 20 million businesses across the European Union.',
Expand All @@ -107,7 +129,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
sofort: {
id: 'sofort',
id: PAYMENT_METHOD_SOFORT,
label: __( 'Sofort', 'woocommerce-gateway-stripe' ),
description: __(
'Accept secure bank transfers from Austria, Belgium, Germany, Italy, Netherlands, and Spain.',
Expand All @@ -117,7 +139,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
eps: {
id: 'eps',
id: PAYMENT_METHOD_EPS,
label: __( 'EPS', 'woocommerce-gateway-stripe' ),
description: __(
'EPS is an Austria-based payment method that allows customers to complete transactions online using their bank credentials.',
Expand All @@ -127,7 +149,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
bancontact: {
id: 'bancontact',
id: PAYMENT_METHOD_BANCONTACT,
label: __( 'Bancontact', 'woocommerce-gateway-stripe' ),
description: __(
'Bancontact is the most popular online payment method in Belgium, with over 15 million cards in circulation.',
Expand All @@ -137,7 +159,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
ideal: {
id: 'ideal',
id: PAYMENT_METHOD_IDEAL,
label: __( 'iDEAL', 'woocommerce-gateway-stripe' ),
description: __(
'iDEAL is a Netherlands-based payment method that allows customers to complete transactions online using their bank credentials.',
Expand All @@ -147,7 +169,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
p24: {
id: 'p24',
id: PAYMENT_METHOD_P24,
label: __( 'Przelewy24', 'woocommerce-gateway-stripe' ),
description: __(
'Przelewy24 is a Poland-based payment method aggregator that allows customers to complete transactions online using bank transfers and other methods.',
Expand All @@ -157,7 +179,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR', 'PLN' ],
},
boleto: {
id: 'boleto',
id: PAYMENT_METHOD_BOLETO,
label: __( 'Boleto', 'woocommerce-gateway-stripe' ),
description: __(
'Boleto is an official payment method in Brazil. Customers receive a voucher that can be paid at authorized agencies or banks, ATMs, or online bank portals.',
Expand All @@ -167,7 +189,7 @@ const paymentMethodsMap = {
currencies: [ 'BRL' ],
},
oxxo: {
id: 'oxxo',
id: PAYMENT_METHOD_OXXO,
label: __( 'OXXO', 'woocommerce-gateway-stripe' ),
description: __(
'OXXO is a Mexican chain of convenience stores that allows customers to pay bills and online purchases in-store with cash.',
Expand All @@ -177,7 +199,7 @@ const paymentMethodsMap = {
currencies: [ 'MXN' ],
},
alipay: {
id: 'alipay',
id: PAYMENT_METHOD_ALIPAY,
label: __( 'Alipay', 'woocommerce-gateway-stripe' ),
description: __(
'Alipay is a popular wallet in China, operated by Ant Financial Services Group, a financial services provider affiliated with Alibaba.',
Expand All @@ -198,7 +220,7 @@ const paymentMethodsMap = {
],
},
multibanco: {
id: 'multibanco',
id: PAYMENT_METHOD_MULTIBANCO,
label: __( 'Multibanco', 'woocommerce-gateway-stripe' ),
description: __(
'Multibanco is an interbank network that links the ATMs of all major banks in Portugal, allowing customers to pay through either their ATM or online banking environment.',
Expand All @@ -208,7 +230,7 @@ const paymentMethodsMap = {
currencies: [ 'EUR' ],
},
wechat_pay: {
id: 'wechat_pay',
id: PAYMENT_METHOD_WECHAT_PAY,
label: __( 'WeChat Pay', 'woocommerce-gateway-stripe' ),
description: __(
'WeChat Pay is a popular mobile payment and digital wallet service by WeChat in China.',
Expand All @@ -232,7 +254,7 @@ const paymentMethodsMap = {
],
},
cashapp: {
id: 'cashapp',
id: PAYMENT_METHOD_CASHAPP,
label: __( 'Cash App Pay', 'woocommerce-gateway-stripe' ),
description: __(
'Cash App is a popular consumer app in the US that allows customers to bank, invest, send, and receive money using their digital wallet.',
Expand All @@ -247,7 +269,7 @@ const paymentMethodsMap = {
// Enable ACH according to feature flag value.
if ( isAchEnabled ) {
paymentMethodsMap.us_bank_account = {
id: 'us_bank_account',
id: PAYMENT_METHOD_ACH,
label: __( 'ACH Direct Debit', 'woocommerce-gateway-stripe' ),
description: __(
'ACH lets you accept payments from customers with a US bank account.',
Expand All @@ -261,7 +283,7 @@ if ( isAchEnabled ) {
// Enable ACSS according to feature flag value.
if ( isAcssEnabled ) {
paymentMethodsMap.acss_debit = {
id: 'acss_debit',
id: PAYMENT_METHOD_ACSS,
label: __( 'Pre-Authorized Debit', 'woocommerce-gateway-stripe' ),
description: __(
'Canadian Pre-Authorized Debit is a payment method that allows customers to pay using their Canadian bank account.',
Expand All @@ -275,7 +297,7 @@ if ( isAcssEnabled ) {
// Enable Bacs according to feature flag value.
if ( isBacsEnabled ) {
paymentMethodsMap.bacs_debit = {
id: 'bacs_debit',
id: PAYMENT_METHOD_BACS,
label: 'Bacs Direct Debit',
description: __(
'Bacs Direct Debit enables customers in the UK to pay by providing their bank account details.',
Expand Down
3 changes: 3 additions & 0 deletions client/stripe-utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const PAYMENT_METHOD_WECHAT_PAY = 'wechat_pay';
export const PAYMENT_METHOD_CASHAPP = 'cashapp';
export const PAYMENT_METHOD_LINK = 'link';
export const PAYMENT_METHOD_AMAZON_PAY = 'amazon_pay';
export const PAYMENT_METHOD_ACH = 'us_bank_account';
export const PAYMENT_METHOD_ACSS = 'acss_debit';
export const PAYMENT_METHOD_BACS = 'bacs_debit';

/**
* Payment method names constants with the `stripe` prefix
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
== Changelog ==

= 9.2.0 - xxxx-xx-xx =
* Dev - Adds the payment method constants to the payment methods map file (frontend side).
* Add - Adds a new notice for store admins when there are subscriptions without a payment method attached.
* Fix - Hides "pay" and "cancel" buttons on the order received page when an Amazon Pay order is pending, since it may take a while to be confirmed.
* Fix - Fix the quantity parameter for the express checkout add-to-cart API call.
Expand Down
Loading