Skip to content

Commit

Permalink
Merge pull request #3 from wirecard/config_canceled_or_failed_orders
Browse files Browse the repository at this point in the history
#2 added new behaviour for canceled and failed orders
  • Loading branch information
rinnhofer authored Sep 28, 2016
2 parents fb742b2 + 5471754 commit fa0bfb5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ protected function _getNextStep($iSuccess)
$aFormattedErrors[] = $error->getConsumerMessage();
}

$oOrder->delete();
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 @@ -196,6 +203,8 @@ public function wirecardConfirm()
{
wirecardCheckoutSeamlessUtils::getInstance()->log(__METHOD__ . ':' . print_r($_POST, true));

$config = wirecardCheckoutSeamlessConfig::getInstance();

$out = WirecardCEE_QMore_ReturnFactory::generateConfirmResponseString();

if (!isset($_POST['oxid_orderid'])) {
Expand Down Expand Up @@ -301,16 +310,33 @@ public function wirecardConfirm()
case WirecardCEE_QMore_ReturnFactory::STATE_CANCEL:
/** @var $return WirecardCEE_QMore_Return_Cancel */
wirecardCheckoutSeamlessUtils::getInstance()->log(__METHOD__ . ':CANCEL');

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

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));

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

$consumerMessage = '';
/** var $e WirecardCEE_QMore_Error */
Expand All @@ -333,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
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public function getPassword()
}
}

public function getDeleteFailedOrCanceledOrders(){
return $this->_getConfig()->getConfigParam('sDeleteFailedOrCanceledOrders');
}

public function getServiceUrl()
{
return $this->_getConfig()->getConfigParam('sServiceUrl');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ public static function onDeactivate()
public static function addWirecardCheckoutSeamlessOrderTable()
{
$sSql = "CREATE TABLE IF NOT EXISTS `wirecardcheckoutseamless_order` (
`OXID` char(32) NOT NULL,
`OXORDERID` char(32) NOT NULL,
`OXID` char(32) NOT NULL COLLATE 'latin1_general_ci',
`OXORDERID` char(32) NOT NULL COLLATE 'latin1_general_ci',
`BASKET` TEXT NULL,
`TIMESTAMP` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`OXID`),
KEY `WIRECARDCHECKOUTSEAMLESS_ORDER_OXORDERID` (`OXORDERID`)
);";
) COLLATE='utf8_general_ci'";

oxDb::getDb()->execute($sSql);
}
Expand Down
3 changes: 2 additions & 1 deletion modules/wirecard/checkoutseamless/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'en' => 'Module for payment using Wirecard Checkout Seamless.<br /><br /><div id="helpPanel"><div class="bd"><strong>Support and sales information</strong><br /><a href="https://guides.wirecard.at/support" target="_blank">support</a><br /><a href="https://guides.wirecard.at/sales" target="_blank">sales</a></div></div>',
),
'thumbnail' => 'picture.jpg',
'version' => '2.1.4',
'version' => '2.1.5',
'author' => 'Wirecard CEE',
'url' => 'http://www.wirecard.at',
'email' => '[email protected]',
Expand Down Expand Up @@ -113,6 +113,7 @@
array('group' => 'wcs_plugin', 'name' => 'bSendAdditionalCustomerData', 'type' => 'bool', 'value' => '1'),
array('group' => 'wcs_plugin', 'name' => 'bSendAdditionalBasketData', 'type' => 'bool', 'value' => '1'),
array('group' => 'wcs_plugin', 'name' => 'bUseIframe', 'type' => 'bool', 'value' => '1'),
array('group' => 'wcs_plugin', 'name' => 'sDeleteFailedOrCanceledOrders', 'type' => 'bool', 'value' => '1'),

array('group' => 'wcs_installment_invoice_settings', 'name' => 'sInvoiceInstallmentProvider', 'type' => 'select', 'value' => 'PAYOLUTION', 'constraints' => 'PAYOLUTION|RATEPAY|WIRECARD'),
array('group' => 'wcs_installment_invoice_settings', 'name' => 'sPayolutionMId', 'type' => 'str', 'value' => ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
'HELP_SHOP_MODULE_sPluginMode' => 'Zum Testen der Integration eine vordefinierte Konfiguration ausw&auml;hlen. F&uuml;r Produktivsysteme "Production" ausw&auml;hlen.',
'SHOP_MODULE_bUseIframe' => 'Seite von Finanzdienstleistern in iFrame anzeigen',
'HELP_SHOP_MODULE_bUseIframe' => 'Andernfalls wird Ihr Konsument auf diese Seite weitergeleitet und danach zur&uuml;ck zu Ihrem Onlineshop geleitet.',
'SHOP_MODULE_sDeleteFailedOrCanceledOrders' => 'Bestellungen bei fehlgeschlagener oder abgebrochener Zahlung löschen',
'HELP_SHOP_MODULE_sDeleteFailedOrCanceledOrders' => 'Falls aktiviert, werden die Bestellungen bei fehlgeschlagener oder abgebrochener Zahlung gelöscht. Achtung: Diese Einstellung gilt für alle Wirecard-Zahlungsmittel.',
'SHOP_MODULE_bDssSaqAEnable' => 'SAQ A konform',
'HELP_SHOP_MODULE_bDssSaqAEnable' => 'Falls kein H&auml;kchen gesetzt ist, gilt der strengere SAQ A-EP. Falls ein H&auml;kchen gesetzt ist, wird in Wirecard Checkout Seamless das "PCI DSS SAQ A Compliance"-Feature verwendet und es gilt der SAQ A. <a href="https://guides.wirecard.at/wcs:pci3_fallback:start" target="_blank">Weitere Informationen</a>',
'SHOP_MODULE_bShowCreditcardCardholder' => 'Feld f&uuml;r Karteninhaber anzeigen',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
'HELP_SHOP_MODULE_sPluginMode' => 'For integration, select predefined configuration settings or "Production" for live systems.',
'SHOP_MODULE_bUseIframe' => 'Display page from financial service provides in an iframe',
'HELP_SHOP_MODULE_bUseIframe' => 'Otherwise your consumer will be forwarded to this page and then redirected to your online shop.',
'SHOP_MODULE_sDeleteFailedOrCanceledOrders' => 'Delete orders if payment fails or is canceled',
'HELP_SHOP_MODULE_sDeleteFailedOrCanceledOrders' => 'If enabled, pending orders will be deleted in the order list if payment fails or if payment gets canceled. Note that this setting applies to all Wirecard payment methods.',
'SHOP_MODULE_bDssSaqAEnable' => 'SAQ A compliance',
'HELP_SHOP_MODULE_bDssSaqAEnable' => 'Not checked, the stringent SAQ A-EP is applicable. Checked, Wirecard Checkout Seamless is integrated with the "PCI DSS SAQ A Compliance" feature and SAQ A is applicable. <a href="https://guides.wirecard.at/wcs:pci3_fallback:start" target="_blank">More information</a>',
'SHOP_MODULE_bShowCreditcardCardholder' => 'Display card holder field',
Expand Down

0 comments on commit fa0bfb5

Please sign in to comment.