-
Notifications
You must be signed in to change notification settings - Fork 72
update: payment method interface to determine countries based on account country #11190
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
base: develop
Are you sure you want to change the base?
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: 0 B Total Size: 927 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the payment method definition interface to support account country-based filtering of eligible checkout countries. The primary motivation is to properly handle payment methods like Affirm that have domestic transaction restrictions, ensuring they only show the merchant's account country as eligible when applicable.
- Updated the
PaymentMethodDefinitionInterface::get_supported_countries()signature to accept an optional$account_countryparameter - Implemented domestic transaction logic in
AffirmDefinitionto return only the account country when provided and supported - Updated all payment method definitions and test mocks to comply with the new interface signature
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
includes/payment-methods/Configs/Interfaces/PaymentMethodDefinitionInterface.php |
Added optional $account_country parameter to get_supported_countries() with documentation explaining its purpose for domestic transaction restrictions |
includes/payment-methods/Configs/Definitions/AffirmDefinition.php |
Implemented domestic transaction logic that returns only the account country when provided and in the supported list |
includes/payment-methods/Configs/Definitions/WechatPayDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/SofortDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/P24Definition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/IdealDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/GooglePayDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/GiropayDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/EpsDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/BancontactDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/ApplePayDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/Configs/Definitions/AlipayDefinition.php |
Updated signature to accept optional $account_country parameter and pass it through in is_available_for() |
includes/payment-methods/class-upe-payment-method.php |
Modified get_countries() to call the definition's get_supported_countries() with account country, delegating country filtering to the definition |
tests/unit/payment-methods/Configs/mocks/class-mock-payment-method-definition.php |
Updated mock to match the new interface signature |
tests/unit/payment-methods/Configs/mocks/class-mock-payment-method-definition-two.php |
Updated mock to match the new interface signature |
changelog/fix-affirm-domestic-transactions |
Added changelog entry for this update |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #
Changes proposed in this Pull Request
I'd like to ensure the payment method definition accounts for the Stripe account's country when checking for the eligible checkout countries.
I think this logic will simplify some of the other checks in the codebase. This logic seems to be in line with other methods.
Testing instructions
npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge