$url .= '&bic='.strip_tags($_GET['bic']); $url .= '&amount='.strip_tags($_GET['amount']); $url .= '&reason_1='.strip_tags($_GET['reason_1']); $url .= '&reason_2='.strip_tags($_GET['reason_2']); } */ //add sv-bankdata $param = ''; if ($_REQUEST['sofortcode'] == 'sofort_sofortvorkasse') { $param .= 'holder=' . strip_tags($_GET['holder']); $param .= '&account_number=' . strip_tags($_GET['account_number']); $param .= '&iban=' . strip_tags($_GET['iban']); $param .= '&bank_code=' . strip_tags($_GET['bank_code']); $param .= '&bic=' . strip_tags($_GET['bic']); $param .= '&amount=' . strip_tags($_GET['amount']); $param .= '&reason_1=' . strip_tags($_GET['reason_1']); $param .= '&reason_2=' . strip_tags($_GET['reason_2']); } $url = xtc_href_link(FILENAME_CHECKOUT_PROCESS, $param, 'SSL'); break; case 'cancel': //from this function we get a correct URL $url = HelperFunctions::getCancelUrl(strip_tags($_REQUEST['sofortcode'])); break; default: //$url = $server.DIR_WS_CATALOG; $url = xtc_href_link(FILENAME_DEFAULT); break; } $_SESSION['sofort']['checkout_process'] = false; xtc_redirect($url);
/** * manager for: save orderdata in shop-DB, emails, cleanup sofort-tables (if a notification has not done it before) * @return nothing (always redirects) */ function _finalizeOrderprocessAfterSuccessfulPayment($transactionId, $paymentSecret) { //get serialized session $savedSession = $this->SofortOrderhandling->getSavedSessionData($transactionId, $paymentSecret); //Order was already saved if (!$savedSession) { usleep(10000); //avoid race-conditions between success-url and notification and needless error-mails $orderId = $this->SofortOrderhandling->getOrderId($transactionId, $paymentSecret); if (!$orderId) { //saved sessiondata was not found and no order-id exists $errors = array('Description' => 'Order could not be saved in shop-DB and orderdata could not be found.', 'Transaction-ID' => $transactionId, 'Customer-ID' => $_SESSION['customer_id'], 'Paymentmethod' => $this->code); HelperFunctions::sendAdminErrorMail($errors); $errors = array(0 => array('code' => '10006')); //Fatal error: saving in sofort_orders failed, seller informed xtc_redirect(HelperFunctions::getCancelUrl($this->code, $errors)); } else { // order was saved by notification $this->SofortOrderhandling->deleteShopSessionData(); $this->SofortOrderhandling->deleteSofortSessionData(); $this->_redirectToSuccessPage($orderId); } } else { $this->SofortOrderhandling->restoreGivenSessionDataToSession($savedSession); $insertData = $this->SofortOrderhandling->insertOrderIntoShop(); $orderId = $insertData['orderId']; $sofortData = $insertData['sofortData']; if (!$orderId) { xtc_db_query('UPDATE sofort_orders SET data_acquired = "0" WHERE payment_secret = "' . HelperFunctions::escapeSql($paymentSecret) . '" AND transaction_id = "' . HelperFunctions::escapeSql($transactionId) . '"'); $errors = array('description' => 'Order may not have been successfully saved in shop-DB or Order-ID is unknown. Please check the order for completeness!', 'transactionId' => $transactionId, 'paymentmethod' => $this->code, 'customerId' => $_SESSION['customer_id'], 'orderdata' => $savedSession); HelperFunctions::sendAdminErrorMail($errors); $errors = array(0 => array('code' => '10005')); //Fatal error: saving in sofort_orders might have failed, seller informed xtc_redirect(HelperFunctions::getCancelUrl($this->code, $errors)); } else { //order was successfully saved, now delete serialized session from db, cleanup $_SESSION and send email to seller/customer //Notice: success-message will always be set by notification into history! $this->SofortOrderhandling->insertOrderIdInSofortTables($transactionId, $paymentSecret, $orderId); //save articleattributes (required for order-sync with SR) if ($this->code == 'sofort_sofortrechnung') { $this->SofortOrderhandling->insertOrderAttributesInSofortTables($orderId, $sofortData); } $this->SofortOrderhandling->deleteSavedSessionFromDb($transactionId, $paymentSecret); $this->SofortOrderhandling->insertTransIdInTableOrders($transactionId, $orderId); if ($this->code == 'sofort_sofortrechnung') { HelperFunctions::sendOrderIdToSofort(MODULE_PAYMENT_SOFORT_MULTIPAY_APIKEY, $transactionId, $orderId); } $this->SofortOrderhandling->deleteShopSessionData(); $this->SofortOrderhandling->deleteSofortSessionData(); if (SEND_EMAILS == 'true') { $this->SofortOrderhandling->sendOrderEmails($orderId); } $this->SofortOrderhandling->doSpecialThingsAfterSuccessfulInsertion(); $this->_redirectToSuccessPage($orderId); } } }