mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 16:24:33 +08:00
phpcs
This commit is contained in:
parent
f74773952c
commit
cbba3e39c1
3 changed files with 19 additions and 14 deletions
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Inpsyde\PayPalCommerce\Onboarding\Assets;
|
namespace Inpsyde\PayPalCommerce\Onboarding\Assets;
|
||||||
|
|
||||||
|
|
||||||
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
|
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
|
||||||
use Inpsyde\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
use Inpsyde\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
||||||
use Inpsyde\PayPalCommerce\Onboarding\State;
|
use Inpsyde\PayPalCommerce\Onboarding\State;
|
||||||
|
@ -19,12 +19,13 @@ class OnboardingAssets
|
||||||
State $state,
|
State $state,
|
||||||
LoginSellerEndpoint $loginSellerEndpoint
|
LoginSellerEndpoint $loginSellerEndpoint
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$this->moduleUrl = $moduleUrl;
|
$this->moduleUrl = $moduleUrl;
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
$this->loginSellerEndpoint = $loginSellerEndpoint;
|
$this->loginSellerEndpoint = $loginSellerEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register() : bool
|
public function register(): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!$this->shouldRender()) {
|
if (!$this->shouldRender()) {
|
||||||
|
@ -51,8 +52,8 @@ class OnboardingAssets
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enqueue() : bool {
|
public function enqueue(): bool
|
||||||
|
{
|
||||||
if (! $this->shouldRender()) {
|
if (! $this->shouldRender()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,9 @@ class OnboardingAssets
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function shouldRender() : bool {
|
private function shouldRender(): bool
|
||||||
|
{
|
||||||
|
// phpcs:disable Inpsyde.CodeQuality.VariablesName.SnakeCaseVar
|
||||||
global $current_section;
|
global $current_section;
|
||||||
if ($current_section !== 'ppcp-gateway') {
|
if ($current_section !== 'ppcp-gateway') {
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,4 +73,4 @@ class OnboardingAssets
|
||||||
$shouldRender = $this->state->currentState() === State::STATE_PROGRESSIVE;
|
$shouldRender = $this->state->currentState() === State::STATE_PROGRESSIVE;
|
||||||
return $shouldRender;
|
return $shouldRender;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,6 @@ class OnboardingModule implements ModuleInterface
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_form_field',
|
'woocommerce_form_field',
|
||||||
static function ($field, $key, $config) use ($container) {
|
static function ($field, $key, $config) use ($container) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Inpsyde\PayPalCommerce\Onboarding\Render;
|
namespace Inpsyde\PayPalCommerce\Onboarding\Render;
|
||||||
|
|
||||||
|
|
||||||
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
|
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
|
||||||
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ class OnboardingRenderer
|
||||||
$this->partnerReferrals = $partnerReferrals;
|
$this->partnerReferrals = $partnerReferrals;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$url = add_query_arg(
|
$url = add_query_arg(
|
||||||
[
|
[
|
||||||
|
@ -32,18 +33,21 @@ class OnboardingRenderer
|
||||||
href="<?php echo esc_url($url); ?>"
|
href="<?php echo esc_url($url); ?>"
|
||||||
data-paypal-button="true"
|
data-paypal-button="true"
|
||||||
><?php
|
><?php
|
||||||
esc_html_e('Sign up for PayPal', 'woocommerce-paypal-commerce-gateway');
|
esc_html_e(
|
||||||
|
'Sign up for PayPal',
|
||||||
|
'woocommerce-paypal-commerce-gateway'
|
||||||
|
);
|
||||||
?></a>
|
?></a>
|
||||||
<script
|
<script
|
||||||
id="paypal-js"
|
id="paypal-js"
|
||||||
src="https://www.sandbox.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js"
|
src="https://www.sandbox.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js"
|
||||||
></script>
|
></script>
|
||||||
<?php
|
<?php
|
||||||
} catch(RuntimeException $exception) {
|
} catch (RuntimeException $exception) {
|
||||||
esc_html_e(
|
esc_html_e(
|
||||||
'We could not properly connect to PayPal. Please reload the page to continue',
|
'We could not properly connect to PayPal. Please reload the page to continue',
|
||||||
'woocommerce-paypal-commerce-gateway'
|
'woocommerce-paypal-commerce-gateway'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue