Closed guzzilar closed 4 years ago
Would this not be better achieved using the Capability API? This would make it more future proof by preventing the need to change the code should the country availability of a payment method change.
Admittedly, the downside to this is that some payment methods still do not appear in the capability API, so we'd need to wait for that to be done before release (but I believe it should be done soon).
Arguably, the best solution would be a combination of using the Capability API, and what you have done. We could show all the payment methods available for the merchant country overall, and grey out the ones that are not currently available to that particular merchant
@jonrandy Thanks for the input 👍 The use case of this approach is slightly different from using Capability API.
The Capability API is to list out available payment methods of that particular Omise account "at the moment". But what this pull request is trying to achieve here is to list all the payment methods that is available for that "country" regardless of if it can be used on that particular account or not.
However, I would love to implement the Capability API once it done, to maximize this feature so the output can be:
TH Account:
- Available payment methods
- Alipay
- Bill Payment [disabled] (please contact Omise support to enable this payment)
- Credit Card
- Internet Banking
- Installment
- TrueMoney Wallet
JP Account:
- Available payment methods
- Credit Card
- Konbini [disabled] (please contact Omise support to enable this payment)
"Here are 5 payment methods that you may use with the account that is registered under Thailand, currently 3 enabled and 2 disabled. To enable these 2 payment methods, please contact our support team".
Yup, that was my arguable 'best solution' above that is the best of both worlds
@jonrandy ah sorry I miss-read the whole sentence of and grey out the ones that are not currently available to that particular merchant
. You've already mentioned what I've explained in a shorter and better sentence. Yeah, exactly like that, in my opinion.
works great..
@jacstn @jonrandy Thanks for the review! 👍
1. Objective
Previously all the payment methods that have been implemented to the plugin will be shown at WooCommerce Payment Setting page, regardless on a given Omise account.
For instance, using Omise Japan account at Omise-WooCommerce plugin, you will see all the payment methods, including those that can be used only for Omise Thailand.
This, is believed to cause a bad user-experience and a confusion for all the merchants outside Thailand.
Related information: Related issue(s): T18705
2. Description of change
At WordPress's
wp_options
table, option_name:woocommerce_omise_settings
, there will be 3 new parameters:account_id
,account_email
, andaccount_country
.Before
After
.
Before The below screenshot: all the payment methods are listed at the payment setting page regardless on a given Omise account.
After The below screenshot: hide all the payment methods if Omise account's credential hasn't been set.
The below screenshot: Once the Omise account has been set, the payment methods will be shown accordingly to the given account (in this case, Thailand account).
The below screenshot: Once the Omise account has been set, the payment methods will be shown accordingly to the given account (in this case, Japan account).
3. Quality assurance
🔧 Environments:
✏️ Details:
There are 2 possible cases.
As for user perspective, they wouldn't need to do any extra step.
4. Impact of the change
As described at the section 2. Description of change, [1]. There will be 3 new parameters saved at WordPress's
wp_options
table, option_name:woocommerce_omise_settings
.5. Priority of change
Normal
6. Additional Notes
No