Skip to content

Commit

Permalink
take client_id and secret into account when deciding whether DCC is e…
Browse files Browse the repository at this point in the history
…nabled
  • Loading branch information
websupporter committed Oct 1, 2020
1 parent 0a3acae commit fa1c2e4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions modules/ppcp-button/src/Assets/class-smartbutton.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,18 +828,23 @@ private function context(): string {
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException If a setting has not been found.
*/
private function dcc_is_enabled(): bool {
if ( ! is_checkout() ) {
return false;
}
if ( ! $this->dcc_applies->for_country_currency() ) {
return false;
}
$keys = array(
'dcc_enabled' => 'is_checkout',
'client_id',
'client_secret',
'dcc_enabled',
);
foreach ( $keys as $key => $callback ) {
if ( $this->settings->has( $key ) && $this->settings->get( $key ) && $callback() ) {
return true;
foreach ( $keys as $key ) {
if ( ! $this->settings->has( $key ) || ! $this->settings->get( $key ) ) {
return false;
}
}
return false;
return true;
}

/**
Expand Down

0 comments on commit fa1c2e4

Please sign in to comment.