MAJ en Thelia 2.3.4
This commit is contained in:
@@ -19,7 +19,6 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpKernel\Exception\RedirectException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
|
||||
/**
|
||||
@@ -120,6 +119,53 @@ abstract class BasePaymentModuleController extends BaseFrontController
|
||||
|
||||
/**
|
||||
* Process the cancelation of a payment on the payment gateway. The order will go back to the
|
||||
* Save the transaction/payment ref in the order
|
||||
*
|
||||
* @param int $orderId the order ID
|
||||
* @param int $transactionRef the transaction reference
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function saveTransactionRef($orderId, $transactionRef)
|
||||
{
|
||||
try {
|
||||
$orderId = intval($orderId);
|
||||
|
||||
if (null !== $order = $this->getOrder($orderId)) {
|
||||
$event = new OrderEvent($order);
|
||||
|
||||
$event->setTransactionRef($transactionRef);
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_TRANSACTION_REF, $event);
|
||||
|
||||
$this->getLog()->addInfo(
|
||||
$this->getTranslator()->trans(
|
||||
"Payment transaction %transaction_ref for order ref. %ref, ID %id has been successfully saved.",
|
||||
[
|
||||
'%transaction_ref' => $transactionRef,
|
||||
'%ref' => $order->getRef(),
|
||||
'%id' => $order->getId()
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->getLog()->addError(
|
||||
$this->getTranslator()->trans(
|
||||
"Error occurred while saving payment transaction %transaction_ref for order ID %id.",
|
||||
[
|
||||
'%transaction_ref' => $transactionRef,
|
||||
'%id' => $orderId
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the cancellation of a payment on the payment gateway. The order will go back to the
|
||||
* "not paid" status.
|
||||
*
|
||||
* @param int $order_id the order ID
|
||||
@@ -138,7 +184,7 @@ abstract class BasePaymentModuleController extends BaseFrontController
|
||||
|
||||
$event = new OrderEvent($order);
|
||||
|
||||
$event->setStatus(OrderStatus::CODE_NOT_PAID);
|
||||
$event->setStatus(OrderStatusQuery::getNotPaidStatus()->getId());
|
||||
|
||||
$this->getLog()->addInfo(
|
||||
$this->getTranslator()->trans(
|
||||
|
||||
Reference in New Issue
Block a user