mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
auto fix phpcs errors
This commit is contained in:
parent
6b61205474
commit
d04cd56cd9
3 changed files with 16 additions and 16 deletions
|
@ -180,9 +180,9 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
$this->validate_paynow_form( $data['form'] );
|
||||
}
|
||||
|
||||
//if we are here so the context is not 'checkout' as it exits before. Therefore, a PayPal order is not created yet.
|
||||
//It would be a good idea to refactor the checkout process in the future.
|
||||
$order = $this->create_paypal_order($wc_order);
|
||||
// if we are here so the context is not 'checkout' as it exits before. Therefore, a PayPal order is not created yet.
|
||||
// It would be a good idea to refactor the checkout process in the future.
|
||||
$order = $this->create_paypal_order( $wc_order );
|
||||
wp_send_json_success( $order->to_array() );
|
||||
return true;
|
||||
} catch ( \RuntimeException $error ) {
|
||||
|
@ -194,8 +194,8 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
'details' => is_a( $error, PayPalApiException::class ) ? $error->details() : array(),
|
||||
)
|
||||
);
|
||||
} catch (\Exception $exception){
|
||||
wc_add_notice($exception->getMessage(), 'error');
|
||||
} catch ( \Exception $exception ) {
|
||||
wc_add_notice( $exception->getMessage(), 'error' );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -208,7 +208,7 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
*
|
||||
* @throws RuntimeException If create order request fails.
|
||||
*/
|
||||
private function create_paypal_order(\WC_Order $wc_order = null): Order {
|
||||
private function create_paypal_order( \WC_Order $wc_order = null ): Order {
|
||||
$needs_shipping = WC()->cart && WC()->cart->needs_shipping();
|
||||
$shipping_address_is_fix = $needs_shipping && 'checkout' === $this->parsed_request_data['context'];
|
||||
|
||||
|
@ -280,7 +280,7 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
$payee_preferred = $this->settings->has( 'payee_preferred' ) && $this->settings->get( 'payee_preferred' ) ?
|
||||
PaymentMethod::PAYEE_PREFERRED_IMMEDIATE_PAYMENT_REQUIRED
|
||||
: PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED;
|
||||
} catch (NotFoundException $exception){
|
||||
} catch ( NotFoundException $exception ) {
|
||||
$payee_preferred = PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED;
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
*
|
||||
* @throws \Exception On Error.
|
||||
*/
|
||||
private function process_checkout_form(string $form_values ) {
|
||||
private function process_checkout_form( string $form_values ) {
|
||||
$form_values = explode( '&', $form_values );
|
||||
|
||||
$parsed_values = array();
|
||||
|
|
|
@ -33,7 +33,7 @@ trait ProcessPaymentTrait {
|
|||
$wc_order = wc_get_order( $order_id );
|
||||
if ( ! is_a( $wc_order, \WC_Order::class ) ) {
|
||||
wc_add_notice(
|
||||
__('Couldn\'t find order to process', 'woocommerce-paypal-payments' ),
|
||||
__( 'Couldn\'t find order to process', 'woocommerce-paypal-payments' ),
|
||||
'error'
|
||||
);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class OrderProcessor {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function process( \WC_Order $wc_order): bool {
|
||||
public function process( \WC_Order $wc_order ): bool {
|
||||
$order = $this->session_handler->order();
|
||||
if ( ! $order ) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue