mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Replace CurrencySupport class with a service
This commit is contained in:
parent
521cbf4e26
commit
c43a4999aa
3 changed files with 8 additions and 63 deletions
|
@ -40,7 +40,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Factory\ShippingFactory;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookEventFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencySupport;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\CartRepository;
|
||||
|
@ -321,12 +320,6 @@ return array(
|
|||
$container->get( 'api.shop.country' )
|
||||
);
|
||||
},
|
||||
'api.helpers.currency-support' => static function ( ContainerInterface $container ) : CurrencySupport {
|
||||
return new CurrencySupport(
|
||||
$container->get( 'api.supported-currencies' ),
|
||||
$container->get( 'api.shop.currency' )
|
||||
);
|
||||
},
|
||||
|
||||
'api.shop.currency' => static function ( ContainerInterface $container ) : string {
|
||||
return get_woocommerce_currency();
|
||||
|
@ -342,6 +335,13 @@ return array(
|
|||
true
|
||||
);
|
||||
},
|
||||
'api.shop.is-currency-supported' => static function ( ContainerInterface $container ) : bool {
|
||||
return in_array(
|
||||
$container->get( 'api.shop.currency' ),
|
||||
$container->get( 'api.supported-currencies' ),
|
||||
true
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Currencies supported by PayPal.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue