mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
✨ Add real DI services for eligibility checks
The existing “services” are actually configuration flags, but not services
This commit is contained in:
parent
407f33444e
commit
f9adf64d03
5 changed files with 38 additions and 0 deletions
|
@ -29,6 +29,14 @@ return array(
|
|||
|
||||
return $apm_applies->for_country() && $apm_applies->for_currency() && $apm_applies->for_merchant();
|
||||
},
|
||||
'applepay.eligibility.check' => static function ( ContainerInterface $container ): callable {
|
||||
$apm_applies = $container->get( 'applepay.helpers.apm-applies' );
|
||||
assert( $apm_applies instanceof ApmApplies );
|
||||
|
||||
return static function () use ( $apm_applies ) : bool {
|
||||
return $apm_applies->for_country() && $apm_applies->for_currency() && $apm_applies->for_merchant();
|
||||
};
|
||||
},
|
||||
'applepay.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
|
||||
return new ApmApplies(
|
||||
$container->get( 'applepay.supported-countries' ),
|
||||
|
|
|
@ -29,7 +29,14 @@ return array(
|
|||
|
||||
return $apm_applies->for_country_currency() && $apm_applies->for_merchant();
|
||||
},
|
||||
'axo.eligibility.check' => static function ( ContainerInterface $container ): callable {
|
||||
$apm_applies = $container->get( 'axo.helpers.apm-applies' );
|
||||
assert( $apm_applies instanceof ApmApplies );
|
||||
|
||||
return static function () use ( $apm_applies ) : bool {
|
||||
return $apm_applies->for_country_currency() && $apm_applies->for_merchant();
|
||||
};
|
||||
},
|
||||
'axo.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
|
||||
return new ApmApplies(
|
||||
$container->get( 'axo.supported-country-currency-matrix' ),
|
||||
|
|
|
@ -19,6 +19,14 @@ return array(
|
|||
|
||||
return $save_payment_methods_applies->for_country() && $save_payment_methods_applies->for_merchant();
|
||||
},
|
||||
'card-fields.eligibility.check' => static function ( ContainerInterface $container ): callable {
|
||||
$save_payment_methods_applies = $container->get( 'card-fields.helpers.save-payment-methods-applies' );
|
||||
assert( $save_payment_methods_applies instanceof CardFieldsApplies );
|
||||
|
||||
return static function () use ( $save_payment_methods_applies ) : bool {
|
||||
return $save_payment_methods_applies->for_country() && $save_payment_methods_applies->for_merchant();
|
||||
};
|
||||
},
|
||||
'card-fields.helpers.save-payment-methods-applies' => static function ( ContainerInterface $container ) : CardFieldsApplies {
|
||||
return new CardFieldsApplies(
|
||||
$container->get( 'card-fields.supported-country-matrix' ),
|
||||
|
|
|
@ -30,7 +30,14 @@ return array(
|
|||
|
||||
return $apm_applies->for_country() && $apm_applies->for_currency() && $apm_applies->for_merchant();
|
||||
},
|
||||
'googlepay.eligibility.check' => static function ( ContainerInterface $container ): callable {
|
||||
$apm_applies = $container->get( 'googlepay.helpers.apm-applies' );
|
||||
assert( $apm_applies instanceof ApmApplies );
|
||||
|
||||
return static function () use ( $apm_applies ) : bool {
|
||||
return $apm_applies->for_country() && $apm_applies->for_currency() && $apm_applies->for_merchant();
|
||||
};
|
||||
},
|
||||
'googlepay.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
|
||||
return new ApmApplies(
|
||||
$container->get( 'googlepay.supported-countries' ),
|
||||
|
|
|
@ -22,6 +22,14 @@ return array(
|
|||
|
||||
return $save_payment_methods_applies->for_country() && $save_payment_methods_applies->for_merchant();
|
||||
},
|
||||
'save-payment-methods.eligibility.check' => static function ( ContainerInterface $container ): callable {
|
||||
$save_payment_methods_applies = $container->get( 'save-payment-methods.helpers.save-payment-methods-applies' );
|
||||
assert( $save_payment_methods_applies instanceof SavePaymentMethodsApplies );
|
||||
|
||||
return static function () use ( $save_payment_methods_applies ) : bool {
|
||||
return $save_payment_methods_applies->for_country() && $save_payment_methods_applies->for_merchant();
|
||||
};
|
||||
},
|
||||
'save-payment-methods.helpers.save-payment-methods-applies' => static function ( ContainerInterface $container ) : SavePaymentMethodsApplies {
|
||||
return new SavePaymentMethodsApplies(
|
||||
$container->get( 'save-payment-methods.supported-countries' ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue