Fix phpcs

This commit is contained in:
Emili Castells Guasch 2024-08-02 15:24:26 +02:00
parent f3b4a317c8
commit 2815fcbb91
3 changed files with 9 additions and 9 deletions

View file

@ -1293,8 +1293,8 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
'early_checkout_validation_enabled' => $this->early_validation_enabled,
'funding_sources_without_redirect' => $this->funding_sources_without_redirect,
'user' => array(
'is_logged' => is_user_logged_in(),
'has_wc_card_payment_tokens' => $this->user_has_wc_card_payment_tokens(get_current_user_id()),
'is_logged' => is_user_logged_in(),
'has_wc_card_payment_tokens' => $this->user_has_wc_card_payment_tokens( get_current_user_id() ),
),
'should_handle_shipping_in_paypal' => $this->should_handle_shipping_in_paypal && ! $this->is_checkout(),
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
@ -2138,12 +2138,12 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
/**
* Whether the given user has WC card payment tokens.
*
* @param int $user_id
* @param int $user_id The user ID.
* @return bool
*/
private function user_has_wc_card_payment_tokens(int $user_id): bool {
private function user_has_wc_card_payment_tokens( int $user_id ): bool {
$tokens = WC_Payment_Tokens::get_customer_tokens( $user_id, CreditCardGateway::ID );
if($tokens) {
if ( $tokens ) {
return true;
}

View file

@ -117,7 +117,7 @@ class CreatePaymentToken implements EndpointInterface {
$wc_token_id = $this->wc_payment_tokens->create_payment_token_card( $current_user_id, $result );
$is_free_trial_cart = $data['is_free_trial_cart'] ?? '';
if($is_free_trial_cart === '1') {
if ( $is_free_trial_cart === '1' ) {
WC()->session->set( 'ppcp_card_payment_token_for_free_trial', $wc_token_id );
}
}

View file

@ -436,7 +436,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
$guest_card_payment_for_free_trial = WC()->session->get( 'ppcp_guest_payment_for_free_trial' ) ?? null;
WC()->session->get( 'ppcp_guest_payment_for_free_trial', null );
if($guest_card_payment_for_free_trial) {
if ( $guest_card_payment_for_free_trial ) {
$customer_id = $guest_card_payment_for_free_trial->customer->id ?? '';
if ( $customer_id ) {
update_user_meta( $wc_order->get_customer_id(), '_ppcp_target_customer_id', $customer_id );
@ -450,9 +450,9 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
}
}
$card_payment_token_for_free_trial = WC()->session->get( 'ppcp_card_payment_token_for_free_trial') ?? null;
$card_payment_token_for_free_trial = WC()->session->get( 'ppcp_card_payment_token_for_free_trial' ) ?? null;
WC()->session->set( 'ppcp_card_payment_token_for_free_trial', null );
if($card_payment_token_for_free_trial) {
if ( $card_payment_token_for_free_trial ) {
$tokens = WC_Payment_Tokens::get_customer_tokens( get_current_user_id() );
foreach ( $tokens as $token ) {
if ( $token->get_id() === (int) $card_payment_token_for_free_trial ) {