mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Refactor and CI
This commit is contained in:
parent
51a92b48a1
commit
d16f08fc7b
1 changed files with 12 additions and 16 deletions
|
@ -77,16 +77,12 @@ class ApplepayModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->loadAssets( $c );
|
$this->load_assets( $c );
|
||||||
$env = $c->get( 'onboarding.environment' );
|
$env = $c->get( 'onboarding.environment' );
|
||||||
/**
|
assert($env instanceof Environment);
|
||||||
* The environment.
|
|
||||||
*
|
|
||||||
* @var Environment $env
|
|
||||||
*/
|
|
||||||
$is_sandobx = $env->current_environment_is( Environment::SANDBOX );
|
$is_sandobx = $env->current_environment_is( Environment::SANDBOX );
|
||||||
$this->domain_association_file( $is_sandobx );
|
$this->load_domain_association_file( $is_sandobx );
|
||||||
$this->renderButtons( $c );
|
$this->render_buttons( $c );
|
||||||
|
|
||||||
$apple_payment_method->bootstrapAjaxRequest();
|
$apple_payment_method->bootstrapAjaxRequest();
|
||||||
}
|
}
|
||||||
|
@ -100,11 +96,11 @@ class ApplepayModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the assets.
|
* Loads the validation file.
|
||||||
*
|
*
|
||||||
* @param boolean $is_sandbox The environment for this merchant.
|
* @param boolean $is_sandbox The environment for this merchant.
|
||||||
*/
|
*/
|
||||||
protected function domain_association_file( $is_sandbox ): void {
|
protected function load_domain_association_file($is_sandbox ): void {
|
||||||
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
|
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +121,7 @@ class ApplepayModule implements ModuleInterface {
|
||||||
* @param ContainerInterface $c The container.
|
* @param ContainerInterface $c The container.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function loadAssets( ContainerInterface $c ): void {
|
public function load_assets(ContainerInterface $c ): void {
|
||||||
add_action(
|
add_action(
|
||||||
'init',
|
'init',
|
||||||
function () use ( $c ) {
|
function () use ( $c ) {
|
||||||
|
@ -165,7 +161,7 @@ class ApplepayModule implements ModuleInterface {
|
||||||
/**
|
/**
|
||||||
* ApplePay button markup
|
* ApplePay button markup
|
||||||
*/
|
*/
|
||||||
protected function applePayDirectButton(): void {
|
protected function apple_pay_direct_button(): void {
|
||||||
?>
|
?>
|
||||||
<div class="ppc-button-wrapper">
|
<div class="ppc-button-wrapper">
|
||||||
<div id="woocommerce_paypal_payments_applepayDirect-button">
|
<div id="woocommerce_paypal_payments_applepayDirect-button">
|
||||||
|
@ -176,12 +172,12 @@ class ApplepayModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the Apple Pay buttons.
|
* Renders the Apple Pay buttons in the enabled places.
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $c The container.
|
* @param ContainerInterface $c The container.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function renderButtons( ContainerInterface $c ): void {
|
public function render_buttons(ContainerInterface $c ): void {
|
||||||
$button_enabled_product = $c->get( 'applepay.setting_button_enabled_product' );
|
$button_enabled_product = $c->get( 'applepay.setting_button_enabled_product' );
|
||||||
$button_enabled_cart = $c->get( 'applepay.setting_button_enabled_cart' );
|
$button_enabled_cart = $c->get( 'applepay.setting_button_enabled_cart' );
|
||||||
if ( $button_enabled_product ) {
|
if ( $button_enabled_product ) {
|
||||||
|
@ -190,7 +186,7 @@ class ApplepayModule implements ModuleInterface {
|
||||||
add_action(
|
add_action(
|
||||||
$render_placeholder,
|
$render_placeholder,
|
||||||
function () {
|
function () {
|
||||||
$this->applePayDirectButton();
|
$this->apple_pay_direct_button();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +196,7 @@ class ApplepayModule implements ModuleInterface {
|
||||||
add_action(
|
add_action(
|
||||||
$render_placeholder,
|
$render_placeholder,
|
||||||
function () {
|
function () {
|
||||||
$this->applePayDirectButton();
|
$this->apple_pay_direct_button();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue