mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-10 23:42:39 +08:00
take client_id and secret into account when deciding whether DCC is enabled
This commit is contained in:
parent
0a3acae98e
commit
fa1c2e4246
1 changed files with 10 additions and 5 deletions
|
@ -828,18 +828,23 @@ class SmartButton implements SmartButtonInterface {
|
||||||
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException If a setting has not been found.
|
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException If a setting has not been found.
|
||||||
*/
|
*/
|
||||||
private function dcc_is_enabled(): bool {
|
private function dcc_is_enabled(): bool {
|
||||||
|
if ( ! is_checkout() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ( ! $this->dcc_applies->for_country_currency() ) {
|
if ( ! $this->dcc_applies->for_country_currency() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$keys = array(
|
$keys = array(
|
||||||
'dcc_enabled' => 'is_checkout',
|
'client_id',
|
||||||
|
'client_secret',
|
||||||
|
'dcc_enabled',
|
||||||
);
|
);
|
||||||
foreach ( $keys as $key => $callback ) {
|
foreach ( $keys as $key ) {
|
||||||
if ( $this->settings->has( $key ) && $this->settings->get( $key ) && $callback() ) {
|
if ( ! $this->settings->has( $key ) || ! $this->settings->get( $key ) ) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue