Fix phpcs

This commit is contained in:
Emili Castells Guasch 2025-04-29 15:42:25 +02:00
parent 116b58bbdb
commit 68785cab77
No known key found for this signature in database
4 changed files with 19 additions and 21 deletions

View file

@ -13,7 +13,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
/**
* CardCaptureValidator constructor.
* CardCaptureValidator class.
*/
class CardCaptureValidator {
@ -31,22 +31,21 @@ class CardCaptureValidator {
}
$payment_source = $order->payment_source();
if ( $payment_source ) {
if ( $payment_source->name() !== 'card' ) {
return true;
}
/**
* LiabilityShift determines how to proceed with authentication.
*
* @link https://developer.paypal.com/docs/checkout/advanced/customize/3d-secure/response-parameters/
*/
$liability_shift = $payment_source->properties()->authentication_result->liability_shift ?? '';
if ( in_array( $liability_shift, array( 'POSSIBLE', 'YES' ), true ) ) {
return true;
}
if ( ! $payment_source ) {
return false;
}
return false;
if ( $payment_source->name() !== 'card' ) {
return true;
}
/**
* LiabilityShift determines how to proceed with authentication.
*
* @link https://developer.paypal.com/docs/checkout/advanced/customize/3d-secure/response-parameters/
*/
$liability_shift = $payment_source->properties()->authentication_result->liability_shift ?? '';
return in_array( $liability_shift, array( 'POSSIBLE', 'YES' ), true );
}
}

View file

@ -538,7 +538,7 @@ class PayPalSubscriptionsModule implements ServiceModule, ExtendingModule, Execu
),
'product_id' => $product->get_id(),
'i18n' => array(
'prices_must_be_above_zero' => __( 'Prices must be above zero for PayPal Subscriptions!', 'woocommerce-paypal-payments' ),
'prices_must_be_above_zero' => __( 'Prices must be above zero for PayPal Subscriptions!', 'woocommerce-paypal-payments' ),
'not_allowed_period_interval' => __( 'Not allowed period interval combination for PayPal Subscriptions!', 'woocommerce-paypal-payments' ),
),
)

View file

@ -546,8 +546,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
);
} catch ( DomainException $error ) {
return $this->handle_payment_failure( $wc_order, $error, true );
}
catch ( Exception $error ) {
} catch ( Exception $error ) {
return $this->handle_payment_failure( $wc_order, $error );
}
}

View file

@ -24,7 +24,7 @@ trait ProcessPaymentTrait {
*
* @param WC_Order|null $wc_order The order.
* @param Exception $error The error causing the failure.
* @param bool $delete_order Whether to delete the order.
* @param bool $delete_order Whether to delete the order.
* @return array The data that can be returned by the gateway process_payment method.
*/
protected function handle_payment_failure( ?WC_Order $wc_order, Exception $error, bool $delete_order = false ): array {
@ -36,7 +36,7 @@ trait ProcessPaymentTrait {
$this->format_exception( $error )
);
if($delete_order) {
if ( $delete_order ) {
$wc_order->delete( true );
}
}