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:
Emili Castells 2025-02-24 11:20:08 +01:00 committed by GitHub
commit 6a4c99325c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 ] );