Skip to content

Commit

Permalink
Publication 2.3.7 (#70)
Browse files Browse the repository at this point in the history
* Removed exceptions showed to enduser
  • Loading branch information
ed007m authored Sep 9, 2020
1 parent 960af7a commit dcbfe8f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Controller/Payment/Fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Vipps\Payment\Api\QuoteRepositoryInterface;
use Vipps\Payment\Gateway\Command\PaymentDetailsProvider;
use Vipps\Payment\Gateway\Transaction\Transaction;
use Vipps\Payment\Model\Exception\AcquireLockException;
use Vipps\Payment\Model\Gdpr\Compliance;
use Vipps\Payment\Model\TransactionProcessor;
use Vipps\Payment\Gateway\Exception\VippsException;
Expand Down Expand Up @@ -153,6 +154,9 @@ public function execute()
$this->logger->critical($this->enlargeMessage($e));
$this->messageManager->addErrorMessage($e->getMessage());
$resultRedirect->setPath('checkout/onepage/failure', ['_secure' => true]);
} catch (AcquireLockException $e) {
$this->logger->critical($e->getMessage());
$resultRedirect->setPath('checkout/onepage/failure', ['_secure' => true]);
} catch (\Exception $e) {
$this->logger->critical($this->enlargeMessage($e));
$this->messageManager->addErrorMessage(
Expand Down
27 changes: 27 additions & 0 deletions Model/Exception/AcquireLockException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

namespace Vipps\Payment\Model\Exception;

/**
* Aims to mark acquire lock exception in a code to have custom processing
*
* Class AcquireLockException
* @package Vipps\Payment\Model\Exception
*/
class AcquireLockException extends \Exception
{
}
5 changes: 4 additions & 1 deletion Model/TransactionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use Vipps\Payment\Gateway\Transaction\Transaction;
use Vipps\Payment\Gateway\Exception\WrongAmountException;
use Vipps\Payment\Model\Adminhtml\Source\PaymentAction;
use Vipps\Payment\Model\Exception\AcquireLockException;
use Vipps\Payment\Model\Method\Vipps;

/**
Expand Down Expand Up @@ -160,6 +161,7 @@ public function __construct(
* @throws NoSuchEntityException
* @throws VippsException
* @throws WrongAmountException
* @throws AcquireLockException
* @throws \Exception
*/
public function process(QuoteInterface $vippsQuote, Transaction $transaction)
Expand Down Expand Up @@ -269,6 +271,7 @@ private function processAction($action, OrderInterface $order, Transaction $tran
* @return string
* @throws AlreadyExistsException
* @throws InputException
* @throws AcquireLockException
* @throws \Exception
*/
private function acquireLock($reservedOrderId)
Expand All @@ -277,7 +280,7 @@ private function acquireLock($reservedOrderId)
if ($reservedOrderId && $this->lockManager->lock($lockName, 10)) {
return $lockName;
}
throw new \Exception(__('Can not acquire lock for order "%1"', $reservedOrderId)); //@codingStandardsIgnoreLine
throw new AcquireLockException(__('Can not acquire lock for order "%1"', $reservedOrderId)); //@codingStandardsIgnoreLine
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "magento2-module",
"description": "Vipps Payment Method",
"license": "proprietary",
"version": "2.3.6",
"version": "2.3.7",
"require": {
"magento/framework": "102.0.*",
"magento/module-sales": "102.0.*",
Expand Down

0 comments on commit dcbfe8f

Please sign in to comment.