Skip to content

Commit

Permalink
check for financing decision outcome before creating the order
Browse files Browse the repository at this point in the history
  • Loading branch information
netzkollektiv committed Jan 2, 2024
1 parent 537e596 commit fde4977
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,21 @@ public function getTransactionInfoBySecuredTransaction($transactionId, $secToken

public function indexAction()
{
$transactionId = $this->helper->getPluginSession()["transaction_id"];
$paymentUniqueId = $this->createPaymentUniqueId();
try {
$checkout = $this->container->get('easyCreditCheckout');

$orderNumber = $this->saveOrder($transactionId, $paymentUniqueId, null, false);
$orderId = $this->getOrderId($transactionId, $paymentUniqueId);
if (!$checkout->isApproved()) {
throw new \Exception('The transaction is not approved.');
}

$this->saveOrderAttributes($orderId);
$transactionId = $this->helper->getPluginSession()["transaction_id"];
$paymentUniqueId = $this->createPaymentUniqueId();

$orderNumber = $this->saveOrder($transactionId, $paymentUniqueId, null, false);
$orderId = $this->getOrderId($transactionId, $paymentUniqueId);

$this->saveOrderAttributes($orderId);

try {
$checkout = $this->container->get('easyCreditCheckout');
if (!$checkout->authorize($orderNumber)) {
throw new \Exception('The transaction could not be authorized.');
}
Expand Down

0 comments on commit fde4977

Please sign in to comment.