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
116b58bbdb
commit
68785cab77
4 changed files with 19 additions and 21 deletions
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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' ),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue