Skip to content

Commit

Permalink
when re-activating order, discard old svea order
Browse files Browse the repository at this point in the history
  • Loading branch information
iesus committed Nov 28, 2017
1 parent 85f1048 commit 9757f2e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/code/community/Svea/Checkout/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected function _restoreQuote($id)
) {

return $oldQuote;
} else {
$sveaOrderId = null;
}

$quote = Mage::getModel('sales/quote')->setStore(Mage::app()->getStore());
Expand All @@ -70,8 +72,16 @@ protected function _restoreQuote($id)
->unsLastRealOrderId();
$sveaOrder = $svea->createSveaOrderFromQuote($quote);

//Create a new order in Sveas end, to reset URIs.
if (!$sveaOrderId) {
$response = $sveaOrder->createOrder();
$sveaOrderId = $response['OrderId'];
$quote->setPaymentReference($sveaOrderId)->save();
}

//Fetch Order
$response = $sveaOrder->setCheckoutOrderId((int)$sveaOrderId)->getOrder();

//Run update.
$hasErrors = $svea->sveaOrderHasErrors($sveaOrder, $quote, $response);
if(!$hasErrors) {
Expand Down

0 comments on commit 9757f2e

Please sign in to comment.