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

Enable the use of saved SEPA payments #1540

Merged
merged 19 commits into from
Apr 19, 2021
Merged

Conversation

harriswong
Copy link
Contributor

@harriswong harriswong commented Apr 9, 2021

Fixes #1471

Changes proposed in this Pull Request

  • Introduced a SEPA token class to "save SEPA payment details". Details are stored in
  • Introduced a Payment_Method class for card, sepa_debit. Planning on adding sofort and giropay later.
  • Customers can now save SEPA payment information by clicking this checkbox:
    image
  • Customers can now use saved SEPA payments to checkout:
    image

Concerns

  • SEPA token class name overlaps existing plugin's.

Testing instructions

Similar to the setup in #1537

  1. Set store currency to euro
  2. Enable feature flag wp option, update _wcpay_feature_sepa to 1
  3. Enable SEPA in checkbox at bottom of /wp-admin/admin.php?page=wc-settings&tab=checkout&section=woocommerce_payments
  4. Add item to cart and go to checkout
  5. You should see this screen, type in SEPA debit card number, click "Save payment...". Checkout
    image
  6. Checkout should be successful. Purchase another item. Now select the SEPA payment we just saved,
    image
  7. The checkout should proceed successfully with the saved SEPA card.

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

@harriswong harriswong changed the base branch from develop to sepa/1441-sepa-classic April 9, 2021 17:36
@harriswong harriswong force-pushed the add/1471-save-sepa-payments branch from 19e5fb2 to a4c0527 Compare April 12, 2021 19:24
@harriswong harriswong marked this pull request as ready for review April 13, 2021 18:33
@harriswong harriswong requested a review from a team April 13, 2021 18:35
@vbelolapotkov
Copy link
Collaborator

vbelolapotkov commented Apr 14, 2021

Hey @harriswong ! Have you requested a review for this within your team? There is a recent change in approach discussed in slack (p1618348326004200-slack-C01JC3PBZL6). So @Automattic/gamma will be happy to review it at the final stage 🙂

cc @c-shultz

@harriswong
Copy link
Contributor Author

Hi @vbelolapotkov ! Nope, not yet. I will wait for our team to review first, then I will add gamma back to the final stage. Thanks!

@harriswong harriswong removed the request for review from a team April 14, 2021 15:22
@brezocordero brezocordero self-requested a review April 14, 2021 18:28
Base automatically changed from sepa/1441-sepa-classic to develop April 14, 2021 20:32
@harriswong harriswong force-pushed the add/1471-save-sepa-payments branch from 3b65b61 to 7b12572 Compare April 14, 2021 20:48
@harriswong harriswong force-pushed the add/1471-save-sepa-payments branch from 7b12572 to 89e04f2 Compare April 14, 2021 20:55
Copy link
Contributor

@brezocordero brezocordero left a comment

Choose a reason for hiding this comment

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

I have tested different scenarios and all worked:

  • Save SEPA for existing customer
  • Save SEPA for guest customer creating account on checkout
  • Payment using the saved method
  • Verify CC was still working

The code is also good, the structure is similar to what Stripe plugin is doing, which makes sense.

A couple of points:

  • Compatibility with Stripe plugin. Thanks for pointing it out. We can create a separate issue but I think we need to address it.
  • On My Account: Add SEPA Payment method, delete payment method and set as default will be handled on Fix Add payment method on My Account for SEPA #1538

@harriswong harriswong requested a review from a team April 15, 2021 17:01
Copy link
Contributor

@kalessil kalessil left a comment

Choose a reason for hiding this comment

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

Thank you for enabling the saved SEPA payment @harriswong! Worked like a charm 🎉 !

Architecture-wise looks also good. I left a few comments, which should make the changes consistent with the existing codebase, but overall great job here!

changelog.txt Outdated Show resolved Hide resolved
includes/class-payment-information.php Outdated Show resolved Hide resolved
includes/class-wc-payments-token-service.php Outdated Show resolved Hide resolved
includes/class-wc-payments-token-service.php Outdated Show resolved Hide resolved
/**
* Controls the output for SEPA on the my account page.
*
* @param array $item Individual list item from woocommerce_saved_payment_methods_list.
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc-block alignment.

Copy link
Contributor

@kalessil kalessil Apr 19, 2021

Choose a reason for hiding this comment

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

I meant to add one more space in $item (before 'Individual'), so the descriptions get aligned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woops. Fixed. Added spaces so variable and description are aligned vertically.

tests/unit/test-class-payment-information.php Outdated Show resolved Hide resolved
tests/unit/test-class-payment-information.php Outdated Show resolved Hide resolved
includes/constants/class-payment-method.php Show resolved Hide resolved
tests/unit/test-class-wc-payment-token-sepa.php Outdated Show resolved Hide resolved
@kalessil
Copy link
Contributor

On it 👀

Copy link
Contributor

@kalessil kalessil left a comment

Choose a reason for hiding this comment

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

@harriswong: LGTM, :shipit:

PS: See also my responses on doc-blocks.

@kalessil kalessil added pr: ready to merge type: good for architectural review This issue/PR is related to / good for architectural review. and removed pr: needs author reply labels Apr 19, 2021
@harriswong
Copy link
Contributor Author

@kalessil Thanks for taking another look. I added some spaces between the variable name and description. Now it should be vertically aligned.

@kalessil
Copy link
Contributor

@harriswong, thanks! Let's merge it then 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: sepa pr: ready to merge type: good for architectural review This issue/PR is related to / good for architectural review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable the use of saved SEPA payments
5 participants