From 3212858a92606a98d030ae751c85e921e4fbb41d Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Mon, 26 Feb 2024 19:05:16 +0530 Subject: [PATCH] PHPCS fixes. --- includes/Framework/PaymentGateway/Payment_Gateway.php | 6 +++--- includes/Gateway/Cash_App_Pay_Gateway.php | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/includes/Framework/PaymentGateway/Payment_Gateway.php b/includes/Framework/PaymentGateway/Payment_Gateway.php index cf746683..a1bfac54 100644 --- a/includes/Framework/PaymentGateway/Payment_Gateway.php +++ b/includes/Framework/PaymentGateway/Payment_Gateway.php @@ -1799,7 +1799,7 @@ protected function do_transaction( $order ) { if ( ! $this->verify_order_total( $order ) ) { Square_Helper::wc_add_notice( esc_html__( 'The sum of partial totals does not match the order total.', 'woocommerce-square' ), 'error' ); return false; - }; + } // Save the charge type as `PARTIAL`. $this->update_order_meta( $order, 'charge_type', self::CHARGE_TYPE_PARTIAL ); @@ -3947,10 +3947,10 @@ public function build_split_payment_order_note( $order, $square_order ) { if ( \Square\Models\TenderType::SQUARE_GIFT_CARD === $tender->getType() ) { $this->update_order_meta( $order, 'gift_card_partial_total', $tender_amount ); $message .= ' ' . sprintf( wp_kses_post( 'for an amount of %1$s on the gift card' ), wc_price( $tender_amount ) ); - } else if ( \Square\Models\TenderType::CARD === $tender->getType() ) { + } elseif ( \Square\Models\TenderType::CARD === $tender->getType() ) { $this->update_order_meta( $order, 'other_gateway_partial_total', $tender_amount ); $message .= ' ' . sprintf( wp_kses_post( 'and %1$s on the credit card' ), wc_price( $tender_amount ) ); - } else if ( \Square\Models\TenderType::WALLET === $tender->getType() ) { + } elseif ( \Square\Models\TenderType::WALLET === $tender->getType() ) { $this->update_order_meta( $order, 'other_gateway_partial_total', $tender_amount ); $message .= ' ' . sprintf( wp_kses_post( 'and %1$s on the cash app pay' ), wc_price( $tender_amount ) ); } diff --git a/includes/Gateway/Cash_App_Pay_Gateway.php b/includes/Gateway/Cash_App_Pay_Gateway.php index 8c2b3e85..e46ba733 100644 --- a/includes/Gateway/Cash_App_Pay_Gateway.php +++ b/includes/Gateway/Cash_App_Pay_Gateway.php @@ -481,7 +481,7 @@ public function get_guest_customer_id( \WC_Order $order ) { public function get_order( $order_id ) { $order = parent::get_order( $order_id ); - $order->payment->nonce = new \stdClass(); + $order->payment->nonce = new \stdClass(); if ( $this->is_gift_card_applied() ) { $order->payment->nonce->gift_card = Square_Helper::get_post( 'square-gift-card-payment-nonce' ); @@ -760,7 +760,7 @@ public function get_payment_request() { $amount = WC()->cart->total; // Check if a gift card is applied. - $check_for_giftcard = isset( $_POST['check_for_giftcard'] ) ? 'true' === sanitize_text_field( wp_unslash( $_POST['check_for_giftcard'] ) ) : false; + $check_for_giftcard = isset( $_POST['check_for_giftcard'] ) ? 'true' === sanitize_text_field( wp_unslash( $_POST['check_for_giftcard'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Missing $gift_card_applied = false; if ( $check_for_giftcard ) { $partial_amount = $this->get_partial_cash_app_amount(); @@ -789,7 +789,7 @@ public function get_partial_cash_app_amount() { if ( ! Gift_Card::does_checkout_support_gift_card() || ! $payment_token ) { return $amount; } - + $is_sandbox = wc_square()->get_settings_handler()->is_sandbox(); if ( $is_sandbox ) { // The card allowed for testing with the Sandbox account has fund of $1. @@ -806,7 +806,6 @@ public function get_partial_cash_app_amount() { $amount = $amount - $balance; } } - return $amount; }