Skip to content

Commit 7943203

Browse files
Merge pull request #471 from omise/release-v3.6.1
Release v3.6.1
2 parents 8880acf + 0676439 commit 7943203

File tree

6 files changed

+13
-45
lines changed

6 files changed

+13
-45
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## [v3.6.1 _(Feb, 12, 2024)_](https://github.com/omise/omise-magento/releases/tag/v3.6.1)
4+
- Fixed redirect issue on cancelled card payment. (PR: [#470](https://github.com/omise/omise-magento/pull/470))
5+
36
## [v3.6.0 _(Jan, 23, 2023)_](https://github.com/omise/omise-magento/releases/tag/v3.6.0)
47
- Add truemoney jumpapp. (PR: [#466](https://github.com/omise/omise-magento/pull/466))
58
- Updated README.md. (PR: [#464](https://github.com/omise/omise-magento/pull/464))

Controller/Callback/Offsite.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
use Omise\Payment\Model\Config\Cc as Config;
1616
use Magento\Checkout\Model\Session as CheckoutSession;
1717
use Psr\Log\LoggerInterface;
18-
use Omise\Payment\Controller\Callback\Traits\FailedChargeTrait;
1918
use Magento\Framework\App\Request\Http;
20-
use Omise\Payment\Model\Config\Atome;
2119

2220
class Offsite extends Action
2321
{
24-
use FailedChargeTrait;
25-
2622
/**
2723
* @var string
2824
*/
@@ -118,10 +114,9 @@ public function execute()
118114
}
119115

120116
$paymentMethod = $payment->getMethod();
121-
$shopeePayFailed = $this->helper->hasShopeepayFailed($paymentMethod, $charge->isSuccessful());
122117

123-
if ($charge->isFailed() || $shopeePayFailed) {
124-
return $this->handleFailure($charge, $shopeePayFailed);
118+
if ($charge->isFailed()) {
119+
return $this->handleFailure($charge);
125120
}
126121

127122
// Do not proceed if webhook is enabled
@@ -148,9 +143,8 @@ public function execute()
148143
* Mark order as failed
149144
*
150145
* @param object $charge
151-
* @param boolean $shopeePayFailed {TODO: Remove this once backend issue is fixed}
152146
*/
153-
private function handleFailure($charge, $shopeePayFailed)
147+
private function handleFailure($charge)
154148
{
155149
// restoring the cart
156150
$this->checkoutSession->restoreQuote();
@@ -161,8 +155,8 @@ private function handleFailure($charge, $shopeePayFailed)
161155
"Payment failed. $failureMessage, please contact our support if you have any questions."
162156
);
163157

164-
// pass shopeePayFailed to avoid webhook to cancel payment
165-
return $this->processFailedCharge($errorMessage, $shopeePayFailed);
158+
// This cancels the order, logs error and displays message in cart page
159+
throw new \Magento\Framework\Exception\LocalizedException($errorMessage);
166160
}
167161

168162
/**

Controller/Callback/Threedsecure.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@
99
use Magento\Sales\Model\Order\Payment\Transaction;
1010
use Omise\Payment\Gateway\Validator\Message\Invalid;
1111
use Omise\Payment\Model\Config\Cc as Config;
12-
use Omise\Payment\Model\Config\CcGooglePay;
1312
use Omise\Payment\Model\Validator\Payment\AuthorizeResultValidator;
1413
use Omise\Payment\Model\Validator\Payment\CaptureResultValidator;
1514
use Omise\Payment\Helper\OmiseEmailHelper;
1615
use Omise\Payment\Helper\OmiseHelper;
1716
use Magento\Checkout\Model\Session as CheckoutSession;
1817
use Psr\Log\LoggerInterface;
19-
use Omise\Payment\Controller\Callback\Traits\FailedChargeTrait;
2018
use Magento\Framework\App\Request\Http;
2119

2220
class Threedsecure extends Action
2321
{
24-
use FailedChargeTrait;
25-
2622
/**
2723
* @var string
2824
*/
@@ -146,7 +142,9 @@ public function execute()
146142
if ($result instanceof Invalid) {
147143
// restoring the cart
148144
$this->checkoutSession->restoreQuote();
149-
return $this->processFailedCharge($result->getMessage());
145+
146+
// This cancels the order, logs error and displays message in cart page
147+
throw new \Magento\Framework\Exception\LocalizedException($result->getMessage());
150148
}
151149

152150
// Do not proceed if webhook is enabled

Controller/Callback/Traits/FailedChargeTrait.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"email": "support@omise.co"
1010
}
1111
],
12-
"version": "3.6.0",
12+
"version": "3.6.1",
1313
"minimum-stability": "stable",
1414
"type": "magento2-module",
1515
"license": "MIT",

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Omise_Payment" setup_version="3.6.0">
3+
<module name="Omise_Payment" setup_version="3.6.1">
44
<sequence>
55
<module name="Magento_Sales"/>
66
<module name="Magento_Payment"/>

0 commit comments

Comments
 (0)