Skip to content

Commit

Permalink
#2 order gets finalized on error
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubpolomsky committed Sep 27, 2016
1 parent e6ab6c4 commit 5471754
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ protected function _getNextStep($iSuccess)
$aFormattedErrors[] = $error->getConsumerMessage();
}

if($config->getDeleteFailedOrCanceledOrders())
if($config->getDeleteFailedOrCanceledOrders()) {
$oOrder->delete();
}
else {
$oOrder->cancelOrder();
$oOrder->oxorder__oxtransstatus = new oxField('FAILED');
$oOrder->save();
}

wirecardCheckoutSeamlessUtils::getInstance()->log(__METHOD__ . ':ERROR:' . print_r($aFormattedErrors, true));
return parent::_getNextStep(implode("<br/>\n", $aFormattedErrors));
Expand Down Expand Up @@ -304,27 +310,33 @@ public function wirecardConfirm()
case WirecardCEE_QMore_ReturnFactory::STATE_CANCEL:
/** @var $return WirecardCEE_QMore_Return_Cancel */
wirecardCheckoutSeamlessUtils::getInstance()->log(__METHOD__ . ':CANCEL');
$oOrder->oxorder__oxtransstatus = new oxField('CANCELED');
$oOrder->cancelOrder();
$oOrder->save();

$oDbOrder->delete($aOrderData['OXID']);

if($config->getDeleteFailedOrCanceledOrders())
if($config->getDeleteFailedOrCanceledOrders()) {
$oOrder->delete();
}
else {
$oOrder->cancelOrder();
$oOrder->oxorder__oxtransstatus = new oxField('CANCELED');
$oOrder->save();
}
break;

case WirecardCEE_QMore_ReturnFactory::STATE_FAILURE:
/** @var $return WirecardCEE_QMore_Return_Failure */
wirecardCheckoutSeamlessUtils::getInstance()->log(__METHOD__ . ':FAILURE:' . print_r($return->getErrors(),
true));
$oOrder->oxorder__oxtransstatus = new oxField('FAILED');
$oOrder->cancelOrder();
$oOrder->save();

$oDbOrder->delete($aOrderData['OXID']);
if($config->getDeleteFailedOrCanceledOrders())
if($config->getDeleteFailedOrCanceledOrders()) {
$oOrder->delete();
}
else {
$oOrder->cancelOrder();
$oOrder->oxorder__oxtransstatus = new oxField('CANCELED');
$oOrder->save();
}

$consumerMessage = '';
/** var $e WirecardCEE_QMore_Error */
Expand All @@ -347,7 +359,6 @@ public function wirecardConfirm()
die;
}


/**
* Returns current order object
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ public function getWcsPaymentError()
if (oxRegistry::getSession()->hasVariable('wcs_payerrortext')) {
$wcs_payment_error = oxRegistry::getSession()->getVariable('wcs_payerrortext');
oxRegistry::getSession()->deleteVariable('wcs_payerrortext');
oxRegistry::getSession()->deleteVariable('sess_challenge');
oxRegistry::getSession()->deleteVariable('wcpPaymentState');
}

return $wcs_payment_error;
Expand Down

0 comments on commit 5471754

Please sign in to comment.