diff --git a/modules.local/ppcp-button/src/Assets/SmartButton.php b/modules.local/ppcp-button/src/Assets/SmartButton.php index a44cc632e..2068a0946 100644 --- a/modules.local/ppcp-button/src/Assets/SmartButton.php +++ b/modules.local/ppcp-button/src/Assets/SmartButton.php @@ -19,6 +19,7 @@ use Inpsyde\PayPalCommerce\Session\SessionHandler; use Inpsyde\PayPalCommerce\Subscription\Helper\SubscriptionHelper; use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings; +//phpcs:disable Inpsyde.CodeQuality.PropertyPerClassLimit.TooMuchProperties class SmartButton implements SmartButtonInterface { private $moduleUrl; @@ -92,7 +93,8 @@ class SmartButton implements SmartButtonInterface return true; } - private function renderMessageWrapperRegistrar() : bool { + private function renderMessageWrapperRegistrar(): bool + { $notEnabledOnCart = $this->settings->has('message_cart_enabled') && !$this->settings->get('message_cart_enabled'); @@ -126,7 +128,6 @@ class SmartButton implements SmartButtonInterface ); } - $notEnabledOnCheckout = $this->settings->has('message_enabled') && !$this->settings->get('message_enabled'); if (! $notEnabledOnCheckout) { @@ -141,7 +142,9 @@ class SmartButton implements SmartButtonInterface } return true; } - private function renderButtonWrapperRegistrar() : bool { + + private function renderButtonWrapperRegistrar(): bool + { $notEnabledOnCart = $this->settings->has('button_cart_enabled') && !$this->settings->get('button_cart_enabled'); @@ -178,7 +181,7 @@ class SmartButton implements SmartButtonInterface $notEnabledOnMiniCart = $this->settings->has('button_mini_cart_enabled') && !$this->settings->get('button_mini_cart_enabled'); if ( - ! $notEnabledOnMiniCart + ! $notEnabledOnMiniCart ) { add_action( 'woocommerce_widget_shopping_cart_after_buttons', @@ -189,14 +192,7 @@ class SmartButton implements SmartButtonInterface ); } - add_action( - 'woocommerce_review_order_after_submit', - [ - $this, - 'buttonRenderer', - ], - 10 - ); + add_action('woocommerce_review_order_after_submit', [$this, 'buttonRenderer'], 10); return true; } @@ -248,11 +244,15 @@ class SmartButton implements SmartButtonInterface echo '
'; } - public function messageRenderer() { + public function messageRenderer() + { + echo '
'; } - private function messageValues() : array { + //phpcs:disable Inpsyde.CodeQuality.FunctionLength.TooLong + private function messageValues(): array + { if ( $this->settings->has('disable_funding') @@ -338,6 +338,7 @@ class SmartButton implements SmartButtonInterface return $values; } + //phpcs:enable Inpsyde.CodeQuality.FunctionLength.TooLong public function dccRenderer() { diff --git a/modules.local/ppcp-button/src/Endpoint/CreateOrderEndpoint.php b/modules.local/ppcp-button/src/Endpoint/CreateOrderEndpoint.php index 9efc879e8..0d9aaa1b7 100644 --- a/modules.local/ppcp-button/src/Endpoint/CreateOrderEndpoint.php +++ b/modules.local/ppcp-button/src/Endpoint/CreateOrderEndpoint.php @@ -66,8 +66,10 @@ class CreateOrderEndpoint implements EndpointInterface $this->sessionHandler->replaceBnCode($bnCode); $this->apiEndpoint->withBnCode($bnCode); } - $payeePreferred = $this->settings->has('payee_preferred') && $this->settings->get('payee_preferred') ? - PaymentMethod::PAYEE_PREFERRED_IMMEDIATE_PAYMENT_REQUIRED :PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED; + $payeePreferred = $this->settings->has('payee_preferred') + && $this->settings->get('payee_preferred') ? + PaymentMethod::PAYEE_PREFERRED_IMMEDIATE_PAYMENT_REQUIRED + : PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED; $paymentMethod = new PaymentMethod($payeePreferred); $order = $this->apiEndpoint->createForPurchaseUnits( $purchaseUnits, diff --git a/modules.local/ppcp-button/src/Helper/MessagesApply.php b/modules.local/ppcp-button/src/Helper/MessagesApply.php index 8ab6372a3..b8c604c06 100644 --- a/modules.local/ppcp-button/src/Helper/MessagesApply.php +++ b/modules.local/ppcp-button/src/Helper/MessagesApply.php @@ -1,22 +1,20 @@ countries, true); } -} \ No newline at end of file +} diff --git a/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php b/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php index 7ff130f41..991fac1d0 100644 --- a/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php +++ b/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php @@ -12,6 +12,8 @@ use Psr\Container\ContainerInterface; //phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps //phpcs:disable Inpsyde.CodeQuality.ArgumentTypeDeclaration.NoArgumentType +//phpcs:disable Inpsyde.CodeQuality.NoAccessors.NoGetter +//phpcs:disable Inpsyde.CodeQuality.ReturnTypeDeclaration.NoReturnType class CreditCardGateway extends PayPalGateway { public const ID = 'ppcp-credit-card-gateway'; @@ -32,7 +34,12 @@ class CreditCardGateway extends PayPalGateway $this->notice = $notice; $this->settingsRenderer = $settingsRenderer; $this->config = $config; - if (defined('PPCP_FLAG_SUBSCRIPTION') && PPCP_FLAG_SUBSCRIPTION && $this->config->has('vault_enabled') && $this->config->get('vault_enabled')) { + if ( + defined('PPCP_FLAG_SUBSCRIPTION') + && PPCP_FLAG_SUBSCRIPTION + && $this->config->has('vault_enabled') + && $this->config->get('vault_enabled') + ) { $this->supports = [ 'products', 'subscriptions', @@ -97,7 +104,9 @@ class CreditCardGateway extends PayPalGateway return $content; } - public function get_title() { + public function get_title() + { + if (is_admin()) { return parent::get_title(); } @@ -117,7 +126,7 @@ class CreditCardGateway extends PayPalGateway 'hiper' => _x('Hiper', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'), ]; $images = array_map( - function(string $type) use ($titleOptions) : string { + function (string $type) use ($titleOptions): string { return 'notice = $notice; $this->settingsRenderer = $settingsRenderer; $this->config = $config; - if (defined('PPCP_FLAG_SUBSCRIPTION') && PPCP_FLAG_SUBSCRIPTION && $this->config->has('vault_enabled') && $this->config->get('vault_enabled')) { + if ( + defined('PPCP_FLAG_SUBSCRIPTION') + && PPCP_FLAG_SUBSCRIPTION + && $this->config->has('vault_enabled') + && $this->config->get('vault_enabled') + ) { $this->supports = [ 'products', 'subscriptions', diff --git a/modules.local/ppcp-wc-gateway/src/Settings/Settings.php b/modules.local/ppcp-wc-gateway/src/Settings/Settings.php index ccb393a68..e47d060b0 100644 --- a/modules.local/ppcp-wc-gateway/src/Settings/Settings.php +++ b/modules.local/ppcp-wc-gateway/src/Settings/Settings.php @@ -82,7 +82,10 @@ class Settings implements ContainerInterface 'button_cart_enabled' => true, 'brand_name' => get_bloginfo('name'), 'dcc_gateway_title' => __('Credit Cards', 'woocommerce-paypal-commerce-gateway'), - 'dcc_gateway_description' => __('Pay with your credit card.', 'woocommerce-paypal-commerce-gateway'), + 'dcc_gateway_description' => __( + 'Pay with your credit card.', + 'woocommerce-paypal-commerce-gateway' + ), ]; foreach ($defaults as $key => $value) { if (isset($this->settings[$key])) { diff --git a/modules.local/ppcp-wc-gateway/src/Settings/SettingsListener.php b/modules.local/ppcp-wc-gateway/src/Settings/SettingsListener.php index 04a997b84..86f77dd81 100644 --- a/modules.local/ppcp-wc-gateway/src/Settings/SettingsListener.php +++ b/modules.local/ppcp-wc-gateway/src/Settings/SettingsListener.php @@ -93,7 +93,8 @@ class SettingsListener $this->webhookRegistrar->register(); } if ($this->settings->has('client_id')) { - $currentSecret = $this->settings->has('client_secret') ? $this->settings->get('client_secret') : ''; + $currentSecret = $this->settings->has('client_secret') ? + $this->settings->get('client_secret') : ''; if ( $settings['client_id'] !== $this->settings->get('client_id') || $settings['client_secret'] !== $currentSecret diff --git a/modules.local/ppcp-wc-gateway/src/Settings/SettingsRenderer.php b/modules.local/ppcp-wc-gateway/src/Settings/SettingsRenderer.php index ffab43153..c5b922220 100644 --- a/modules.local/ppcp-wc-gateway/src/Settings/SettingsRenderer.php +++ b/modules.local/ppcp-wc-gateway/src/Settings/SettingsRenderer.php @@ -45,8 +45,8 @@ class SettingsRenderer $selected = (in_array($optionKey, $value, true)) ? 'selected="selected"' : ''; $options[] = ''; + esc_html($optionValue) . + ''; } $html = sprintf( @@ -127,6 +127,7 @@ class SettingsRenderer //phpcs:enable Inpsyde.CodeQuality.ArgumentTypeDeclaration.NoArgumentType //phpcs:disable Inpsyde.CodeQuality.NestingLevel.High + //phpcs:disable Inpsyde.CodeQuality.FunctionLength.TooLong public function render(bool $isDcc) { @@ -187,31 +188,32 @@ class SettingsRenderer + ?>

', - '' - ) - ); ?> + sprintf( + // translators: %1$s and %2$s is a link tag. + __( + '3D Secure benefits cardholders and merchants by providing an additional + layer of verification using Verified by Visa, MasterCard SecureCode and + American Express SafeKey. %1$sLearn more about 3D Secure.%2$s', + 'woocommerce - paypal - commerce - gateway' + ), + '', + '' + ) + ); ?>

- settings->has($config['hidden']) ? (string) $this->settings->get($config['hidden']) : ''; - echo ''; + echo ' < input + type = "hidden" + name = "ppcp[' . esc_attr($config['hidden']) . ']" + value = "' . esc_attr($value) . '" + > '; } } } \ No newline at end of file