From 547175443f037fa9874bb87cd4dc7a4a0d136dba Mon Sep 17 00:00:00 2001 From: jakubpolomsky Date: Tue, 27 Sep 2016 08:26:53 +0200 Subject: [PATCH] #2 order gets finalized on error --- .../wirecardcheckoutseamlessorder.php | 31 +++++++++++++------ .../wirecardcheckoutseamlesspayment.php | 2 ++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlessorder.php b/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlessorder.php index 1356420..e302fba 100644 --- a/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlessorder.php +++ b/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlessorder.php @@ -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("
\n", $aFormattedErrors)); @@ -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 */ @@ -347,7 +359,6 @@ public function wirecardConfirm() die; } - /** * Returns current order object * diff --git a/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlesspayment.php b/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlesspayment.php index b433ff3..ac8b381 100644 --- a/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlesspayment.php +++ b/modules/wirecard/checkoutseamless/controllers/wirecardcheckoutseamlesspayment.php @@ -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;