Fix phpcs

This commit is contained in:
Emili Castells Guasch 2024-03-11 09:25:33 +01:00
parent 81826fbd61
commit 3801a8f838
3 changed files with 14 additions and 11 deletions

View file

@ -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
);

View file

@ -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() );