mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Use api currency service
This commit is contained in:
parent
013ffb5213
commit
356fc38698
2 changed files with 15 additions and 14 deletions
|
@ -211,9 +211,9 @@ return array(
|
|||
},
|
||||
'wcgateway.notice.currency-unsupported' => static function ( ContainerInterface $container ): UnsupportedCurrencyAdminNotice {
|
||||
$state = $container->get( 'onboarding.state' );
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
$shop_currency = $container->get( 'api.shop.currency' );
|
||||
$supported_currencies = $container->get( 'api.supported-currencies' );
|
||||
return new UnsupportedCurrencyAdminNotice( $state, $settings, $supported_currencies );
|
||||
return new UnsupportedCurrencyAdminNotice( $state, $shop_currency, $supported_currencies );
|
||||
},
|
||||
'wcgateway.notice.dcc-without-paypal' => static function ( ContainerInterface $container ): GatewayWithoutPayPalAdminNotice {
|
||||
return new GatewayWithoutPayPalAdminNotice(
|
||||
|
|
|
@ -26,12 +26,6 @@ class UnsupportedCurrencyAdminNotice {
|
|||
*/
|
||||
private $state;
|
||||
|
||||
/**
|
||||
* The settings.
|
||||
*
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $settings;
|
||||
/**
|
||||
* The supported currencies.
|
||||
*
|
||||
|
@ -39,16 +33,23 @@ class UnsupportedCurrencyAdminNotice {
|
|||
*/
|
||||
private $supported_currencies;
|
||||
|
||||
/**
|
||||
* The shop currency.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $shop_currency;
|
||||
|
||||
/**
|
||||
* ConnectAdminNotice constructor.
|
||||
*
|
||||
* @param State $state The state.
|
||||
* @param ContainerInterface $settings The settings.
|
||||
* @param array $supported_currencies The supported currencies.
|
||||
* @param State $state The state.
|
||||
* @param string $shop_currency The shop currency.
|
||||
* @param array $supported_currencies The supported currencies.
|
||||
*/
|
||||
public function __construct( State $state, ContainerInterface $settings, array $supported_currencies ) {
|
||||
public function __construct( State $state, string $shop_currency, array $supported_currencies ) {
|
||||
$this->state = $state;
|
||||
$this->settings = $settings;
|
||||
$this->shop_currency = $shop_currency;
|
||||
$this->supported_currencies = $supported_currencies;
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,7 @@ class UnsupportedCurrencyAdminNotice {
|
|||
* @return bool
|
||||
*/
|
||||
private function currency_supported(): bool {
|
||||
$currency = get_woocommerce_currency();
|
||||
$currency = $this->shop_currency;
|
||||
$supported_currencies = $this->supported_currencies;
|
||||
return in_array( $currency, $supported_currencies, true );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue