Add real DI services for eligibility checks

The existing “services” are actually configuration flags, but not services
This commit is contained in:
Philipp Stracker 2025-03-25 21:21:44 +01:00
parent 407f33444e
commit f9adf64d03
No known key found for this signature in database
5 changed files with 38 additions and 0 deletions

View file

@ -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' ),

View file

@ -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' ),

View file

@ -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' ),

View file

@ -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' ),

View file

@ -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' ),