Skip to content
New issue

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

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

Already on GitHub? # to your account

Add BECS Debit support for tokenization #4144

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

rafaelzaleski
Copy link
Contributor

@rafaelzaleski rafaelzaleski commented Mar 25, 2025

Closes #3965

Changes proposed in this Pull Request:

  • Make AU BECS Debit reusable and introduce tokenization.
  • Enhance unit test coverage for BECS Debit.

Testing instructions

Use the following bank account for testing:

BSB: 000-000
Account Number: 000123456
  • Store currency needs to be AUD.
  • Stripe Account should be located in Australia.

Test 1: Add, Remove and Mark the token as default in the my account page.

  1. Log in as a customer.
  2. Go to My Account > Payment methods.
  3. Add a new payment method and select “BECS Direct Debit”
  4. After successfully adding the BECS payment method, verify it shows up under Payment methods.
  5. Remove the BECS payment method by clicking “Delete” and confirm the token is removed.
  6. Add the BECS payment method again and a credit card payment option, then mark BECS as default by selecting “Make default.” Confirm it is set as the default payment method.

Test 2: Save the token at checkout, and use the saved token in a subsequent purchase.

  1. Add a product to your cart and proceed to checkout.
  2. In the Payment section, choose “BECS Direct Debit.”
  • Ensure there’s an option like “Save this payment method”, select it.
  1. Enter the required bank details (test routing and account numbers) and complete the checkout.
  2. After the order is placed, verify the order confirmation and note that a new BECS token should be created for your account.
  3. Start a new purchase (add another product to cart).
  4. At checkout, select the saved BECS token.
  5. Complete checkout without having to re-enter bank account details. Confirm the purchase is successful and uses the existing BECS token.
  6. Repeat for the shortcode and blocks checkout.
  7. Go to My Account > Payment methods and confirm the tokens created in this test are present.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@rafaelzaleski rafaelzaleski self-assigned this Mar 25, 2025
@rafaelzaleski rafaelzaleski requested review from a team and ricardo and removed request for a team March 27, 2025 18:42
Copy link
Member

@ricardo ricardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tests well, nice work!

I left 2 questions about the payment method display being inconsistent between My account and checkout, but otherwise everything is looking good.

  • ✅ Test 1: Add, Remove and Mark the token as default in the my account page.
  • ✅ Test 2: Save the token at checkout, and use the saved token in a subsequent purchase.
    • Note: Tested on blocks and checkout.

public function get_display_name( $deprecated = '' ) {
$display = sprintf(
/* translators: last 4 digits of account. */
__( 'Bank account ending in %s', 'woocommerce-gateway-stripe' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "BECS Direct Debit ending in %s" ?

@@ -425,6 +426,10 @@ public function get_account_saved_payment_methods_list_item( $item, $payment_tok
$item['method']['brand'] = $payment_token->get_bank_name();
$item['method']['last4'] = $payment_token->get_last4();
break;
case WC_Stripe_Payment_Methods::BECS_DEBIT:
$item['method']['brand'] = esc_html__( 'BECS Direct Debit', 'woocommerce-gateway-stripe' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the payment methods listing it appears like this for me:

Becs Direct Debit ending in 3456

Is it possible to enforce the capitalization for the method brand?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BECS: Process Payment with a Saved Payment Method and account PM management
2 participants