mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #3141 from woocommerce/PCP-4229-cannot-activate-oxxo-and-pui
Settings UI: Restrict OXXO and PUI based on merchant country (4229)
This commit is contained in:
commit
6a4c99325c
1 changed files with 16 additions and 0 deletions
|
@ -341,6 +341,12 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
assert( $dcc_applies instanceof DCCApplies );
|
||||
|
||||
$general_settings = $container->get( 'settings.data.general' );
|
||||
assert( $general_settings instanceof GeneralSettings );
|
||||
|
||||
$merchant_data = $general_settings->get_merchant_data();
|
||||
$merchant_country = $merchant_data->merchant_country;
|
||||
|
||||
// Unset BCDC if merchant is eligible for ACDC and country is eligible for card fields.
|
||||
$card_fields_eligible = $container->get( 'card-fields.eligible' );
|
||||
if ( $dcc_product_status->is_active() && $card_fields_eligible ) {
|
||||
|
@ -367,6 +373,16 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
unset( $payment_methods['ppcp-axo-gateway'] );
|
||||
}
|
||||
|
||||
// Unset OXXO if merchant country is not Mexico.
|
||||
if ( 'MX' !== $merchant_country ) {
|
||||
unset( $payment_methods[ OXXO::ID ] );
|
||||
}
|
||||
|
||||
// Unset Pay Unon Invoice if merchant country is not Germany.
|
||||
if ( 'DE' !== $merchant_country ) {
|
||||
unset( $payment_methods[ PayUponInvoiceGateway::ID ] );
|
||||
}
|
||||
|
||||
// For non-ACDC regions unset ACDC, local APMs and set BCDC.
|
||||
if ( ! $dcc_applies ) {
|
||||
unset( $payment_methods[ CreditCardGateway::ID ] );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue