mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Add China to GPay support, simplify country-currency matrix
This commit is contained in:
parent
f52b01b275
commit
548c0082eb
2 changed files with 105 additions and 771 deletions
|
@ -29,12 +29,13 @@ return array(
|
||||||
$apm_applies = $container->get( 'googlepay.helpers.apm-applies' );
|
$apm_applies = $container->get( 'googlepay.helpers.apm-applies' );
|
||||||
assert( $apm_applies instanceof ApmApplies );
|
assert( $apm_applies instanceof ApmApplies );
|
||||||
|
|
||||||
return $apm_applies->for_country_currency();
|
return $apm_applies->for_country() && $apm_applies->for_currency();
|
||||||
},
|
},
|
||||||
|
|
||||||
'googlepay.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
|
'googlepay.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
|
||||||
return new ApmApplies(
|
return new ApmApplies(
|
||||||
$container->get( 'googlepay.supported-country-currency-matrix' ),
|
$container->get( 'googlepay.supported-countries' ),
|
||||||
|
$container->get( 'googlepay.supported-currencies' ),
|
||||||
$container->get( 'api.shop.currency' ),
|
$container->get( 'api.shop.currency' ),
|
||||||
$container->get( 'api.shop.country' )
|
$container->get( 'api.shop.country' )
|
||||||
);
|
);
|
||||||
|
@ -81,767 +82,84 @@ return array(
|
||||||
),
|
),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The matrix which countries and currency combinations can be used for GooglePay.
|
* The list of which countries can be used for GooglePay.
|
||||||
*/
|
*/
|
||||||
'googlepay.supported-country-currency-matrix' => static function ( ContainerInterface $container ) : array {
|
'googlepay.supported-countries' => static function ( ContainerInterface $container) : array {
|
||||||
/**
|
/**
|
||||||
* Returns which countries and currency combinations can be used for GooglePay.
|
* Returns which countries can be used for GooglePay.
|
||||||
*/
|
*/
|
||||||
return apply_filters(
|
return apply_filters(
|
||||||
'woocommerce_paypal_payments_googlepay_supported_country_currency_matrix',
|
'woocommerce_paypal_payments_googlepay_supported_countries',
|
||||||
array(
|
array(
|
||||||
'AU' => array(
|
'AU', // Australia
|
||||||
'AUD',
|
'AT', // Austria
|
||||||
'BRL',
|
'BE', // Belgium
|
||||||
'CAD',
|
'BG', // Bulgaria
|
||||||
'CHF',
|
'CA', // Canada
|
||||||
'CZK',
|
'CN', // China
|
||||||
'DKK',
|
'CY', // Cyprus
|
||||||
'EUR',
|
'CZ', // Czech Republic
|
||||||
'GBP',
|
'DK', // Denmark
|
||||||
'HKD',
|
'EE', // Estonia
|
||||||
'HUF',
|
'FI', // Finland
|
||||||
'ILS',
|
'FR', // France
|
||||||
'JPY',
|
'DE', // Germany
|
||||||
'MXN',
|
'GR', // Greece
|
||||||
'NOK',
|
'HU', // Hungary
|
||||||
'NZD',
|
'IE', // Ireland
|
||||||
'PHP',
|
'IT', // Italy
|
||||||
'PLN',
|
'LV', // Latvia
|
||||||
'SEK',
|
'LI', // Liechtenstein
|
||||||
'SGD',
|
'LT', // Lithuania
|
||||||
'THB',
|
'LU', // Luxembourg
|
||||||
'TWD',
|
'MT', // Malta
|
||||||
'USD',
|
'NL', // Netherlands
|
||||||
),
|
'NO', // Norway
|
||||||
'AT' => array(
|
'PL', // Poland
|
||||||
'AUD',
|
'PT', // Portugal
|
||||||
'BRL',
|
'RO', // Romania
|
||||||
'CAD',
|
'SK', // Slovakia
|
||||||
'CHF',
|
'SI', // Slovenia
|
||||||
'CZK',
|
'ES', // Spain
|
||||||
'DKK',
|
'SE', // Sweden
|
||||||
'EUR',
|
'US', // United States
|
||||||
'GBP',
|
'GB' // United Kingdom
|
||||||
'HKD',
|
)
|
||||||
'HUF',
|
);
|
||||||
'ILS',
|
},
|
||||||
'JPY',
|
|
||||||
'MXN',
|
/**
|
||||||
'NOK',
|
* The list of which currencies can be used for GooglePay.
|
||||||
'NZD',
|
*/
|
||||||
'PHP',
|
'googlepay.supported-currencies' => static function ( ContainerInterface $container ) : array {
|
||||||
'PLN',
|
/**
|
||||||
'SEK',
|
* Returns which currencies can be used for GooglePay.
|
||||||
'SGD',
|
*/
|
||||||
'THB',
|
return apply_filters(
|
||||||
'TWD',
|
'woocommerce_paypal_payments_googlepay_supported_currencies',
|
||||||
'USD',
|
array(
|
||||||
),
|
'AUD', // Australian Dollar
|
||||||
'BE' => array(
|
'BRL', // Brazilian Real
|
||||||
'AUD',
|
'CAD', // Canadian Dollar
|
||||||
'BRL',
|
'CHF', // Swiss Franc
|
||||||
'CAD',
|
'CZK', // Czech Koruna
|
||||||
'CHF',
|
'DKK', // Danish Krone
|
||||||
'CZK',
|
'EUR', // Euro
|
||||||
'DKK',
|
'GBP', // British Pound Sterling
|
||||||
'EUR',
|
'HKD', // Hong Kong Dollar
|
||||||
'GBP',
|
'HUF', // Hungarian Forint
|
||||||
'HKD',
|
'ILS', // Israeli New Shekel
|
||||||
'HUF',
|
'JPY', // Japanese Yen
|
||||||
'ILS',
|
'MXN', // Mexican Peso
|
||||||
'JPY',
|
'NOK', // Norwegian Krone
|
||||||
'MXN',
|
'NZD', // New Zealand Dollar
|
||||||
'NOK',
|
'PHP', // Philippine Peso
|
||||||
'NZD',
|
'PLN', // Polish Zloty
|
||||||
'PHP',
|
'SEK', // Swedish Krona
|
||||||
'PLN',
|
'SGD', // Singapore Dollar
|
||||||
'SEK',
|
'THB', // Thai Baht
|
||||||
'SGD',
|
'TWD', // New Taiwan Dollar
|
||||||
'THB',
|
'USD' // United States Dollar
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'BG' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'CA' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'CY' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'CZ' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'DK' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'EE' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'FI' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'FR' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'DE' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'GR' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'HU' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'IE' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'IT' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'LV' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'LI' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'LT' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'LU' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'MT' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'NO' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'NL' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'PL' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'PT' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'RO' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'SK' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'SI' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'ES' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'SE' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'GB' => array(
|
|
||||||
'AUD',
|
|
||||||
'BRL',
|
|
||||||
'CAD',
|
|
||||||
'CHF',
|
|
||||||
'CZK',
|
|
||||||
'DKK',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'HKD',
|
|
||||||
'HUF',
|
|
||||||
'ILS',
|
|
||||||
'JPY',
|
|
||||||
'MXN',
|
|
||||||
'NOK',
|
|
||||||
'NZD',
|
|
||||||
'PHP',
|
|
||||||
'PLN',
|
|
||||||
'SEK',
|
|
||||||
'SGD',
|
|
||||||
'THB',
|
|
||||||
'TWD',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
'US' => array(
|
|
||||||
'AUD',
|
|
||||||
'CAD',
|
|
||||||
'EUR',
|
|
||||||
'GBP',
|
|
||||||
'JPY',
|
|
||||||
'USD',
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,11 +16,18 @@ namespace WooCommerce\PayPalCommerce\Googlepay\Helper;
|
||||||
class ApmApplies {
|
class ApmApplies {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The matrix which countries and currency combinations can be used for GooglePay.
|
* The list of which countries can be used for GooglePay.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $allowed_country_currency_matrix;
|
private $allowed_countries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of which currencies can be used for GooglePay.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $allowed_currencies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3-letter currency code of the shop.
|
* 3-letter currency code of the shop.
|
||||||
|
@ -39,30 +46,39 @@ class ApmApplies {
|
||||||
/**
|
/**
|
||||||
* DccApplies constructor.
|
* DccApplies constructor.
|
||||||
*
|
*
|
||||||
* @param array $allowed_country_currency_matrix The matrix which countries and currency combinations can be used for GooglePay.
|
* @param array $allowed_countries The list of which countries can be used for GooglePay.
|
||||||
|
* @param array $allowed_currencies The list of which currencies can be used for GooglePay.
|
||||||
* @param string $currency 3-letter currency code of the shop.
|
* @param string $currency 3-letter currency code of the shop.
|
||||||
* @param string $country 2-letter country code of the shop.
|
* @param string $country 2-letter country code of the shop.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
array $allowed_country_currency_matrix,
|
array $allowed_countries,
|
||||||
|
array $allowed_currencies,
|
||||||
string $currency,
|
string $currency,
|
||||||
string $country
|
string $country
|
||||||
) {
|
) {
|
||||||
$this->allowed_country_currency_matrix = $allowed_country_currency_matrix;
|
$this->allowed_countries = $allowed_countries;
|
||||||
$this->currency = $currency;
|
$this->allowed_currencies = $allowed_currencies;
|
||||||
$this->country = $country;
|
$this->currency = $currency;
|
||||||
|
$this->country = $country;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether GooglePay can be used in the current country and the current currency used.
|
* Returns whether GooglePay can be used in the current country used.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function for_country_currency(): bool {
|
public function for_country(): bool {
|
||||||
if ( ! in_array( $this->country, array_keys( $this->allowed_country_currency_matrix ), true ) ) {
|
return in_array( $this->country, $this->allowed_countries, true );
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
return in_array( $this->currency, $this->allowed_country_currency_matrix[ $this->country ], true );
|
/**
|
||||||
|
* Returns whether GooglePay can be used in the current currency used.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function for_currency(): bool {
|
||||||
|
return in_array( $this->currency, $this->allowed_currencies, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue