diff --git a/modules/ppcp-save-payment-methods/src/Endpoint/CaptureCardPayment.php b/modules/ppcp-save-payment-methods/src/Endpoint/CaptureCardPayment.php index 554c6edcb..73df58a70 100644 --- a/modules/ppcp-save-payment-methods/src/Endpoint/CaptureCardPayment.php +++ b/modules/ppcp-save-payment-methods/src/Endpoint/CaptureCardPayment.php @@ -132,6 +132,8 @@ class CaptureCardPayment { * Creates PayPal order from the given card vault id. * * @param string $vault_id Vault id. + * @param string $custom_id Custom id. + * @param string $invoice_id Invoice id. * @return stdClass * @throws RuntimeException When request fails. */ @@ -157,8 +159,8 @@ class CaptureCardPayment { ), ), ), - 'custom_id' => $custom_id, - 'invoice_id' => $invoice_id, + 'custom_id' => $custom_id, + 'invoice_id' => $invoice_id, ); $bearer = $this->bearer->bearer(); diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 57197065f..3f20d12dd 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -131,7 +131,7 @@ return array( $vaulted_credit_card_handler, $container->get( 'onboarding.environment' ), $container->get( 'api.endpoint.order' ), - $container->get('save-payment-methods.endpoint.capture-card-payment'), + $container->get( 'save-payment-methods.endpoint.capture-card-payment' ), $container->get( 'api.prefix' ), $logger ); diff --git a/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php b/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php index a15d80975..f2903d239 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php @@ -177,8 +177,8 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC { * @param VaultedCreditCardHandler $vaulted_credit_card_handler The vaulted credit card handler. * @param Environment $environment The environment. * @param OrderEndpoint $order_endpoint The order endpoint. - * @param CaptureCardPayment $capture_card_payment Capture card payment. - * @param string $prefix The prefix. + * @param CaptureCardPayment $capture_card_payment Capture card payment. + * @param string $prefix The prefix. * @param LoggerInterface $logger The logger. */ public function __construct( @@ -213,8 +213,8 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC { $this->vaulted_credit_card_handler = $vaulted_credit_card_handler; $this->environment = $environment; $this->order_endpoint = $order_endpoint; - $this->capture_card_payment = $capture_card_payment; - $this->prefix = $prefix; + $this->capture_card_payment = $capture_card_payment; + $this->prefix = $prefix; $this->logger = $logger; if ( $state->current_state() === State::STATE_ONBOARDED ) { @@ -411,14 +411,15 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC { ); } + // phpcs:ignore WordPress.Security.NonceVerification.Missing $card_payment_token_id = wc_clean( wp_unslash( $_POST['wc-ppcp-credit-card-gateway-payment-token'] ?? '' ) ); - if($card_payment_token_id) { + if ( $card_payment_token_id ) { $tokens = WC_Payment_Tokens::get_customer_tokens( get_current_user_id() ); foreach ( $tokens as $token ) { if ( $token->get_id() === (int) $card_payment_token_id ) { - $custom_id = $wc_order->get_order_number(); - $invoice_id = $this->prefix . $wc_order->get_order_number(); - $create_order = $this->capture_card_payment->create_order($token->get_token(), $custom_id, $invoice_id); + $custom_id = $wc_order->get_order_number(); + $invoice_id = $this->prefix . $wc_order->get_order_number(); + $create_order = $this->capture_card_payment->create_order( $token->get_token(), $custom_id, $invoice_id ); $order = $this->order_endpoint->order( $create_order->id ); $wc_order->update_meta_data( PayPalGateway::INTENT_META_KEY, $order->intent() );