mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
🎨 Code-style, apply phpcs rules
This commit is contained in:
parent
60ab51a2f8
commit
8153026e22
1 changed files with 18 additions and 16 deletions
|
@ -24,7 +24,6 @@ use WooCommerce\PayPalCommerce\Button\Helper\WooCommerceOrderCreator;
|
||||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ApproveOrderEndpoint
|
* Class ApproveOrderEndpoint
|
||||||
|
@ -171,7 +170,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
||||||
*/
|
*/
|
||||||
public function handle_request() : bool {
|
public function handle_request() : bool {
|
||||||
try {
|
try {
|
||||||
$data = $this->request_data->read_request( $this->nonce() );
|
$data = $this->request_data->read_request( self::nonce() );
|
||||||
if ( ! isset( $data['order_id'] ) ) {
|
if ( ! isset( $data['order_id'] ) ) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
__( 'No order id given', 'woocommerce-paypal-payments' )
|
__( 'No order id given', 'woocommerce-paypal-payments' )
|
||||||
|
@ -181,6 +180,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
||||||
$order = $this->api_endpoint->order( $data['order_id'] );
|
$order = $this->api_endpoint->order( $data['order_id'] );
|
||||||
|
|
||||||
$payment_source = $order->payment_source();
|
$payment_source = $order->payment_source();
|
||||||
|
|
||||||
if ( $payment_source && $payment_source->name() === 'card' ) {
|
if ( $payment_source && $payment_source->name() === 'card' ) {
|
||||||
if ( $this->settings->has( 'disable_cards' ) ) {
|
if ( $this->settings->has( 'disable_cards' ) ) {
|
||||||
$disabled_cards = (array) $this->settings->get( 'disable_cards' );
|
$disabled_cards = (array) $this->settings->get( 'disable_cards' );
|
||||||
|
@ -250,6 +250,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
||||||
wp_send_json_success( array( 'order_received_url' => $order_received_url ) );
|
wp_send_json_success( array( 'order_received_url' => $order_received_url ) );
|
||||||
}
|
}
|
||||||
wp_send_json_success();
|
wp_send_json_success();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch ( Exception $error ) {
|
} catch ( Exception $error ) {
|
||||||
$this->logger->error( 'Order approve failed: ' . $error->getMessage() );
|
$this->logger->error( 'Order approve failed: ' . $error->getMessage() );
|
||||||
|
@ -262,6 +263,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
||||||
'details' => is_a( $error, PayPalApiException::class ) ? $error->details() : array(),
|
'details' => is_a( $error, PayPalApiException::class ) ? $error->details() : array(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue