mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge pull request #2792 from woocommerce/PCP-3884-conditionally-add-local-apms
Add local APM gateways only if PayPal gateway is enabled (3884)
This commit is contained in:
commit
45f7b4fa97
1 changed files with 14 additions and 1 deletions
|
@ -47,7 +47,7 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
|
|||
$settings = $c->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
if ( ! $settings->has( 'allow_local_apm_gateways' ) || $settings->get( 'allow_local_apm_gateways' ) !== true ) {
|
||||
if ( ! self::should_add_local_apm_gateways( $settings ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -210,4 +210,17 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the local APMs should be added to the available payment gateways.
|
||||
*
|
||||
* @param Settings $settings PayPal gateway settings.
|
||||
* @return bool
|
||||
*/
|
||||
private function should_add_local_apm_gateways( Settings $settings ): bool {
|
||||
return $settings->has( 'enabled' )
|
||||
&& $settings->get( 'enabled' ) === true
|
||||
&& $settings->has( 'allow_local_apm_gateways' )
|
||||
&& $settings->get( 'allow_local_apm_gateways' ) === true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue