mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +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\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
|
||||
/**
|
||||
* Class ApproveOrderEndpoint
|
||||
|
@ -171,7 +170,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
|||
*/
|
||||
public function handle_request() : bool {
|
||||
try {
|
||||
$data = $this->request_data->read_request( $this->nonce() );
|
||||
$data = $this->request_data->read_request( self::nonce() );
|
||||
if ( ! isset( $data['order_id'] ) ) {
|
||||
throw new RuntimeException(
|
||||
__( 'No order id given', 'woocommerce-paypal-payments' )
|
||||
|
@ -181,6 +180,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
|||
$order = $this->api_endpoint->order( $data['order_id'] );
|
||||
|
||||
$payment_source = $order->payment_source();
|
||||
|
||||
if ( $payment_source && $payment_source->name() === 'card' ) {
|
||||
if ( $this->settings->has( '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();
|
||||
|
||||
return true;
|
||||
} catch ( Exception $error ) {
|
||||
$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(),
|
||||
)
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue