From 748b55adbbdac86de4211d833e11dc03ef7342fa Mon Sep 17 00:00:00 2001 From: "mayur.vachchewar" Date: Wed, 24 Aug 2022 17:21:29 +0530 Subject: [PATCH 1/2] fixed for payment failed issue --- src/Gateways/AbstractGateway.php | 12 +++++++++--- src/Gateways/Clients/SdkClient.php | 14 +++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Gateways/AbstractGateway.php b/src/Gateways/AbstractGateway.php index 7c08e07..6717c79 100644 --- a/src/Gateways/AbstractGateway.php +++ b/src/Gateways/AbstractGateway.php @@ -1070,9 +1070,15 @@ protected function handle_response( Requests\RequestInterface $request, Transact //check admin selected decline condtions if ( in_array( $response->avsResponseCode, $this->get_option( 'avs_reject_conditions' ) ) || in_array( $response->cvnResponseCode, $this->get_option( 'cvn_reject_conditions' ) ) ) { - Transaction::fromId( $response->transactionReference->transactionId ) - ->reverse( $request->order->data['total'] ) - ->execute(); + $data = $request->order->get_data(); + + if (!is_array($data)) { + $data = []; + } + + Transaction::fromId($response->transactionReference->transactionId) + ->reverse($data['total']) + ->execute(); return false; } diff --git a/src/Gateways/Clients/SdkClient.php b/src/Gateways/Clients/SdkClient.php index 15ce786..e4e70d8 100644 --- a/src/Gateways/Clients/SdkClient.php +++ b/src/Gateways/Clients/SdkClient.php @@ -114,7 +114,12 @@ public function execute() { $this->set_threedsecure_data(); } $response = $builder->execute(); - if ( ! is_null( $this->card_data ) && $response instanceof Transaction && $response->token ) { + if ( + $this->is_gateway(GatewayProvider::PORTICO) + && !is_null($this->card_data) + && $response instanceof Transaction + && $response->token + ) { $this->card_data->token = $response->token; $this->card_data->updateTokenExpiry(); } @@ -122,6 +127,13 @@ public function execute() { return $response; } + protected function is_gateway($gatewayProvider) + { + return isset($this->args['SERVICES_CONFIG']) + && isset($this->args['SERVICES_CONFIG']['gatewayProvider']) + && $this->args['SERVICES_CONFIG']['gatewayProvider'] === $gatewayProvider; + } + public function submit_request( RequestInterface $request ) { $this->prepare_request_args( $request ); $this->configure_sdk(); From 04d6a6326bb7569f8de3413e112ed7b1c4179271 Mon Sep 17 00:00:00 2001 From: "mayur.vachchewar" Date: Wed, 7 Sep 2022 16:54:50 +0530 Subject: [PATCH 2/2] Changelog updated --- globalpayments-gateway-provider-for-woocommerce.php | 2 +- readme.txt | 7 +++++-- src/Plugin.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/globalpayments-gateway-provider-for-woocommerce.php b/globalpayments-gateway-provider-for-woocommerce.php index 690dccd..e7db39a 100644 --- a/globalpayments-gateway-provider-for-woocommerce.php +++ b/globalpayments-gateway-provider-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: GlobalPayments WooCommerce * Plugin URI: https://github.com/globalpayments/globalpayments-woocommerce * Description: This extension allows WooCommerce to use the available Global Payments payment gateways. All card data is tokenized using the respective gateway's tokenization service. - * Version: 1.4.0 + * Version: 1.4.1 * Requires PHP: 7.1 * WC tested up to: 6.6.0 * Author: Global Payments diff --git a/readme.txt b/readme.txt index 41bc6b3..6b4c523 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: globalpayments Tags: woocommerce, woo, unified, commerce, platform, global, payments, heartland, payment, systems, tsys, genius, 3DS, gateway, token, tokenize, save cards Requires at least: 5.4 -Tested up to: 6.0 -Stable tag: 1.2.3 +Tested up to: 6.0.1 +Stable tag: 1.2.4 License: MIT License URI: https://github.com/globalpayments/globalpayments-woocommerce/blob/main/LICENSE @@ -48,6 +48,9 @@ Access to our Unified Payments requires sandbox credentials which you can retrie == Changelog == += 1.4.1 = +* Bug fix - fixed for payment failed issue (transIt) + = 1.4.0 = * Unified Payments - added Card Holder Name for Hosted Fields * Add Merchant Name option for the Google Pay gateway diff --git a/src/Plugin.php b/src/Plugin.php index c241c29..231f1cc 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -18,7 +18,7 @@ class Plugin { * * @var string */ - const VERSION = '1.4.0'; + const VERSION = '1.4.1'; /** * Init the package.