Skip to content

Commit

Permalink
Merge pull request #39 from OnTap/master
Browse files Browse the repository at this point in the history
Version 2.3.1 in the context of November Release
  • Loading branch information
BlainMaguire authored Dec 2, 2021
2 parents 6e8c88f + fa0ba94 commit 0edcd73
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.3.0",
"version": "2.3.1",
"type": "woocommerce-plugin"
}
39 changes: 26 additions & 13 deletions includes/class-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) {
Expand Down Expand Up @@ -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 ) {
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-simplify-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 0edcd73

Please sign in to comment.