Add ApplePay validation file display conditions

This commit is contained in:
Pedro Silva 2023-11-02 09:48:33 +00:00
parent 37104d1646
commit 4de7191d7c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3

View file

@ -84,11 +84,12 @@ class ApplepayModule implements ModuleInterface {
return;
}
$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();
if ( $apple_payment_method->is_enabled() ) {
$module->load_assets( $c, $apple_payment_method );
$module->handle_validation_file( $c, $apple_payment_method );
$module->render_buttons( $c, $apple_payment_method );
$apple_payment_method->bootstrap_ajax_request();
}
}
);
@ -214,9 +215,13 @@ class ApplepayModule implements ModuleInterface {
* Handles the validation file.
*
* @param ContainerInterface $c The container.
* @param ApplePayButton $button The button.
* @return void
*/
public function handle_validation_file( ContainerInterface $c ): void {
public function handle_validation_file( ContainerInterface $c, ApplePayButton $button ): void {
if ( ! $button->is_enabled() ) {
return;
}
$env = $c->get( 'onboarding.environment' );
assert( $env instanceof Environment );
$is_sandobx = $env->current_environment_is( Environment::SANDBOX );