diff --git a/CHANGELOG.md b/CHANGELOG.md index 45c062b..7a1d212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## [2.3.1] - 2021-12-01 +### Fixed +- Fixed a "false" Transaction Description issue that happened for some types of transactions + + ## [2.3.0] - 2021-10-19 ### Changed - Add Embedded Payment Option diff --git a/composer.json b/composer.json index ba4d139..e757bb7 100644 --- a/composer.json +++ b/composer.json @@ -1,4 +1,4 @@ { - "version": "2.3.0", + "version": "2.3.1", "type": "woocommerce-plugin" } diff --git a/includes/class-payment-gateway.php b/includes/class-payment-gateway.php index da28194..23c806f 100644 --- a/includes/class-payment-gateway.php +++ b/includes/class-payment-gateway.php @@ -160,7 +160,11 @@ public function capture_authorized_order() { 'authorization' => $authCode, 'reference' => $order->get_id(), 'currency' => strtoupper( $order->get_currency() ), - 'amount' => $this->get_total( $order ) + 'amount' => $this->get_total( $order ), + 'description' => sprintf( + __( 'Order #%s', 'woocommerce-gateway-simplify-commerce' ), + $order->get_order_number() + ), ) ); if ( $payment->paymentStatus === 'APPROVED' ) { @@ -277,7 +281,7 @@ public function void_authorized_order() { 'reason' => 'Reverse', 'refund_payment' => false, 'restock_items' => true, - 'amount' => $order->get_remaining_refund_amount() + 'amount' => $order->get_remaining_refund_amount(), ) ); } catch ( Simplify_ApiException $e ) { @@ -301,14 +305,14 @@ protected function init_simplify_sdk() { try { // try to extract version from main plugin file - $plugin_path = dirname( __FILE__ , 2 ) . '/woocommerce-simplify-payment-gateway.php' ; - $plugin_data = get_file_data($plugin_path, array('Version' => 'Version')); + $plugin_path = dirname( __FILE__, 2 ) . '/woocommerce-simplify-payment-gateway.php'; + $plugin_data = get_file_data( $plugin_path, array( 'Version' => 'Version' ) ); $plugin_version = $plugin_data['Version'] ?: 'Unknown'; } catch ( Exception $e ) { $plugin_version = 'UnknownError'; } - Simplify::$userAgent = 'SimplifyWooCommercePlugin/' . WC()->version . '/' . $plugin_version; + Simplify::$userAgent = 'SimplifyWooCommercePlugin/' . WC()->version . '/' . $plugin_version; } /** @@ -974,10 +978,14 @@ protected function authorize( $order, $card_token, $amount ) { } $authorization = Simplify_Authorization::createAuthorization( array( - 'amount' => $amount, - 'token' => $card_token, - 'reference' => $order->get_id(), - 'currency' => strtoupper( $order->get_currency() ), + 'amount' => $amount, + 'token' => $card_token, + 'reference' => $order->get_id(), + 'currency' => strtoupper( $order->get_currency() ), + 'description' => sprintf( + __( 'Order #%s', 'woocommerce-gateway-simplify-commerce' ), + $order->get_order_number() + ), ) ); return $this->process_authorization_order_status( @@ -1059,11 +1067,16 @@ public function process_refund( $order_id, $amount = null, $reason = '' ) { ); } + $defaultRefundReason = sprintf( + __( 'Refund for Order #%s', 'woocommerce-gateway-simplify-commerce' ), + $order->get_order_number() + ); + $refund_data = array( - 'amount' => (int) round( (float) $amount * 100 ), - 'payment' => $payment_id, - 'reason' => $reason, - 'reference' => $order_id + 'amount' => (int) round( (float) $amount * 100 ), + 'payment' => $payment_id, + 'reason' => $reason ?: $defaultRefundReason, + 'reference' => $order_id, ); $refund = Simplify_Refund::createRefund( $refund_data ); diff --git a/woocommerce-simplify-payment-gateway.php b/woocommerce-simplify-payment-gateway.php index 1393fcc..0beb76f 100644 --- a/woocommerce-simplify-payment-gateway.php +++ b/woocommerce-simplify-payment-gateway.php @@ -6,7 +6,7 @@ * Author: Mastercard Payment Gateway Services - Simplify * Author URI: http://www.simplify.com/ * Text Domain: woocommerce-gateway-simplify-commerce - * Version: 2.3.0 + * Version: 2.3.1 * * Copyright (c) 2017-2021 Mastercard *