mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix lint and tests
This commit is contained in:
parent
889df4d88c
commit
46b47dc97b
8 changed files with 181 additions and 164 deletions
|
@ -40,6 +40,7 @@ class ApplepayModule implements ModuleInterface {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
$module = $this;
|
||||
|
||||
// Clears product status when appropriate.
|
||||
add_action(
|
||||
|
@ -51,38 +52,44 @@ class ApplepayModule implements ModuleInterface {
|
|||
}
|
||||
);
|
||||
|
||||
// Check if the module is applicable, correct country, currency, ... etc.
|
||||
if ( ! $c->get( 'applepay.eligible' ) ) {
|
||||
return;
|
||||
}
|
||||
add_action(
|
||||
'init',
|
||||
static function () use ( $c, $module ) {
|
||||
|
||||
// Load the button handler.
|
||||
$apple_payment_method = $c->get( 'applepay.button' );
|
||||
// add onboarding and referrals hooks.
|
||||
assert( $apple_payment_method instanceof ApplepayButton );
|
||||
$apple_payment_method->initialize();
|
||||
// Check if the module is applicable, correct country, currency, ... etc.
|
||||
if ( ! $c->get( 'applepay.eligible' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show notice if there are product availability issues.
|
||||
$availability_notice = $c->get( 'applepay.availability_notice' );
|
||||
assert( $availability_notice instanceof AvailabilityNotice );
|
||||
$availability_notice->execute();
|
||||
// Load the button handler.
|
||||
$apple_payment_method = $c->get( 'applepay.button' );
|
||||
// add onboarding and referrals hooks.
|
||||
assert( $apple_payment_method instanceof ApplepayButton );
|
||||
$apple_payment_method->initialize();
|
||||
|
||||
// Return if server not supported.
|
||||
if ( ! $c->get( 'applepay.server_supported' ) ) {
|
||||
return;
|
||||
}
|
||||
// Show notice if there are product availability issues.
|
||||
$availability_notice = $c->get( 'applepay.availability_notice' );
|
||||
assert( $availability_notice instanceof AvailabilityNotice );
|
||||
$availability_notice->execute();
|
||||
|
||||
// Check if this merchant can activate / use the buttons.
|
||||
// We allow non referral merchants as they can potentially still use ApplePay, we just have no way of checking the capability.
|
||||
if ( ( ! $c->get( 'applepay.available' ) ) && $c->get( 'applepay.is_referral' ) ) {
|
||||
return;
|
||||
}
|
||||
// Return if server not supported.
|
||||
if ( ! $c->get( 'applepay.server_supported' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->load_assets( $c, $apple_payment_method );
|
||||
$this->handle_validation_file( $c );
|
||||
$this->render_buttons( $c, $apple_payment_method );
|
||||
// Check if this merchant can activate / use the buttons.
|
||||
// We allow non referral merchants as they can potentially still use ApplePay, we just have no way of checking the capability.
|
||||
if ( ( ! $c->get( 'applepay.available' ) ) && $c->get( 'applepay.is_referral' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$apple_payment_method->bootstrap_ajax_request();
|
||||
$module->load_assets( $c, $apple_payment_method );
|
||||
$module->handle_validation_file( $c );
|
||||
$module->render_buttons( $c, $apple_payment_method );
|
||||
|
||||
$apple_payment_method->bootstrap_ajax_request();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue