mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Fix phpcs
This commit is contained in:
parent
06c000b42b
commit
fbe13cb7dd
5 changed files with 13 additions and 10 deletions
|
@ -258,7 +258,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
|
||||||
'icons_directory' => esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/',
|
'icons_directory' => esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/',
|
||||||
'module_url' => untrailingslashit( $this->module_url ),
|
'module_url' => untrailingslashit( $this->module_url ),
|
||||||
'ajax' => array(
|
'ajax' => array(
|
||||||
'frontend_logger' => array(
|
'frontend_logger' => array(
|
||||||
'endpoint' => \WC_AJAX::get_endpoint( FrontendLogger::ENDPOINT ),
|
'endpoint' => \WC_AJAX::get_endpoint( FrontendLogger::ENDPOINT ),
|
||||||
'nonce' => wp_create_nonce( FrontendLogger::nonce() ),
|
'nonce' => wp_create_nonce( FrontendLogger::nonce() ),
|
||||||
),
|
),
|
||||||
|
|
|
@ -293,7 +293,7 @@ return array(
|
||||||
return new AxoScriptAttributes(
|
return new AxoScriptAttributes(
|
||||||
$container->get( 'button.request-data' ),
|
$container->get( 'button.request-data' ),
|
||||||
$container->get( 'woocommerce.logger.woocommerce' ),
|
$container->get( 'woocommerce.logger.woocommerce' ),
|
||||||
$container->get('api.sdk-client-token')
|
$container->get( 'api.sdk-client-token' )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ class AxoManager {
|
||||||
'icons_directory' => esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/',
|
'icons_directory' => esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/',
|
||||||
'module_url' => untrailingslashit( $this->module_url ),
|
'module_url' => untrailingslashit( $this->module_url ),
|
||||||
'ajax' => array(
|
'ajax' => array(
|
||||||
'frontend_logger' => array(
|
'frontend_logger' => array(
|
||||||
'endpoint' => \WC_AJAX::get_endpoint( FrontendLogger::ENDPOINT ),
|
'endpoint' => \WC_AJAX::get_endpoint( FrontendLogger::ENDPOINT ),
|
||||||
'nonce' => wp_create_nonce( FrontendLogger::nonce() ),
|
'nonce' => wp_create_nonce( FrontendLogger::nonce() ),
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,6 +8,9 @@ use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||||
use WooCommerce\PayPalCommerce\Button\Endpoint\EndpointInterface;
|
use WooCommerce\PayPalCommerce\Button\Endpoint\EndpointInterface;
|
||||||
use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the request for the PayPal Axo script attributes.
|
||||||
|
*/
|
||||||
class AxoScriptAttributes implements EndpointInterface {
|
class AxoScriptAttributes implements EndpointInterface {
|
||||||
|
|
||||||
const ENDPOINT = 'ppc-axo-script-attributes';
|
const ENDPOINT = 'ppc-axo-script-attributes';
|
||||||
|
@ -21,8 +24,8 @@ class AxoScriptAttributes implements EndpointInterface {
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
SdkClientToken $sdk_client_token
|
SdkClientToken $sdk_client_token
|
||||||
) {
|
) {
|
||||||
$this->request_data = $request_data;
|
$this->request_data = $request_data;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->sdk_client_token = $sdk_client_token;
|
$this->sdk_client_token = $sdk_client_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,15 +38,15 @@ class AxoScriptAttributes implements EndpointInterface {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$token = $this->sdk_client_token->sdk_client_token();
|
$token = $this->sdk_client_token->sdk_client_token();
|
||||||
} catch (PayPalApiException $exception) {
|
} catch ( PayPalApiException $exception ) {
|
||||||
$this->logger->error($exception->getMessage());
|
$this->logger->error( $exception->getMessage() );
|
||||||
wp_send_json_error($exception->getMessage());
|
wp_send_json_error( $exception->getMessage() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_send_json_success(
|
wp_send_json_success(
|
||||||
array(
|
array(
|
||||||
'sdk_client_token' => $token,
|
'sdk_client_token' => $token,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
||||||
public function process_payment( $order_id ) {
|
public function process_payment( $order_id ) {
|
||||||
$wc_order = wc_get_order( $order_id );
|
$wc_order = wc_get_order( $order_id );
|
||||||
// phpcs:disable WordPress.Security.NonceVerification
|
// phpcs:disable WordPress.Security.NonceVerification
|
||||||
$birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) );
|
$birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) );
|
||||||
$pay_for_order = wc_clean( wp_unslash( $_GET['pay_for_order'] ?? '' ) );
|
$pay_for_order = wc_clean( wp_unslash( $_GET['pay_for_order'] ?? '' ) );
|
||||||
if ( 'true' === $pay_for_order ) {
|
if ( 'true' === $pay_for_order ) {
|
||||||
if ( ! $this->checkout_helper->validate_birth_date( $birth_date ) ) {
|
if ( ! $this->checkout_helper->validate_birth_date( $birth_date ) ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue