Skip to content

Commit

Permalink
Merge pull request #471 from omise/release-v3.6.1
Browse files Browse the repository at this point in the history
Release v3.6.1
  • Loading branch information
aashishgurung authored Feb 12, 2024
2 parents 8880acf + 0676439 commit 7943203
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 45 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [v3.6.1 _(Feb, 12, 2024)_](https://github.com/omise/omise-magento/releases/tag/v3.6.1)
- Fixed redirect issue on cancelled card payment. (PR: [#470](https://github.com/omise/omise-magento/pull/470))

## [v3.6.0 _(Jan, 23, 2023)_](https://github.com/omise/omise-magento/releases/tag/v3.6.0)
- Add truemoney jumpapp. (PR: [#466](https://github.com/omise/omise-magento/pull/466))
- Updated README.md. (PR: [#464](https://github.com/omise/omise-magento/pull/464))
Expand Down
16 changes: 5 additions & 11 deletions Controller/Callback/Offsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@
use Omise\Payment\Model\Config\Cc as Config;
use Magento\Checkout\Model\Session as CheckoutSession;
use Psr\Log\LoggerInterface;
use Omise\Payment\Controller\Callback\Traits\FailedChargeTrait;
use Magento\Framework\App\Request\Http;
use Omise\Payment\Model\Config\Atome;

class Offsite extends Action
{
use FailedChargeTrait;

/**
* @var string
*/
Expand Down Expand Up @@ -118,10 +114,9 @@ public function execute()
}

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

if ($charge->isFailed() || $shopeePayFailed) {
return $this->handleFailure($charge, $shopeePayFailed);
if ($charge->isFailed()) {
return $this->handleFailure($charge);
}

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

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

/**
Expand Down
8 changes: 3 additions & 5 deletions Controller/Callback/Threedsecure.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@
use Magento\Sales\Model\Order\Payment\Transaction;
use Omise\Payment\Gateway\Validator\Message\Invalid;
use Omise\Payment\Model\Config\Cc as Config;
use Omise\Payment\Model\Config\CcGooglePay;
use Omise\Payment\Model\Validator\Payment\AuthorizeResultValidator;
use Omise\Payment\Model\Validator\Payment\CaptureResultValidator;
use Omise\Payment\Helper\OmiseEmailHelper;
use Omise\Payment\Helper\OmiseHelper;
use Magento\Checkout\Model\Session as CheckoutSession;
use Psr\Log\LoggerInterface;
use Omise\Payment\Controller\Callback\Traits\FailedChargeTrait;
use Magento\Framework\App\Request\Http;

class Threedsecure extends Action
{
use FailedChargeTrait;

/**
* @var string
*/
Expand Down Expand Up @@ -146,7 +142,9 @@ public function execute()
if ($result instanceof Invalid) {
// restoring the cart
$this->checkoutSession->restoreQuote();
return $this->processFailedCharge($result->getMessage());

// This cancels the order, logs error and displays message in cart page
throw new \Magento\Framework\Exception\LocalizedException($result->getMessage());
}

// Do not proceed if webhook is enabled
Expand Down
27 changes: 0 additions & 27 deletions Controller/Callback/Traits/FailedChargeTrait.php

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email": "[email protected]"
}
],
"version": "3.6.0",
"version": "3.6.1",
"minimum-stability": "stable",
"type": "magento2-module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Omise_Payment" setup_version="3.6.0">
<module name="Omise_Payment" setup_version="3.6.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down

0 comments on commit 7943203

Please sign in to comment.