/** * get link to bottom part of orders.php * @return string */ function shopGetBottom() { return DIR_FS_CATALOG . 'callback/sofort/ressources/scripts/' . HelperFunctions::getIniValue('shopsystemVersion') . '_ordersBottom.php'; }
function getSofortOrderhandlingLink() { $shopsystemVersion = HelperFunctions::getIniValue('shopsystemVersion'); if (!$shopsystemVersion) { return ''; } $shopsystemVersion = str_replace('..', '', $shopsystemVersion); return DIR_FS_CATALOG . 'callback/sofort/ressources/scripts/' . $shopsystemVersion . '_sofortOrderhandling.php'; }
/** * add discounts or agio (e.g. ot_sofort, loworderfee, discount...) to $this->invoice */ function _addPriceModificatorsToInvoice($customer_id, $orderTotals) { //check optional price-modificators if (is_array($orderTotals)) { foreach ($orderTotals as $totalModule) { $itemId = 'discount|' . substr($totalModule['code'], 0, 22); if ($totalModule['code'] == 'ot_sofort') { $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_SOFORT_TAX_CLASS); $amountValue = $totalModule['value']; $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax); continue; } if ($totalModule['code'] == 'ot_discount') { $tax = 19; $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value']; $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax); continue; } if ($totalModule['code'] == 'ot_gv') { $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_GV_TAX_CLASS); $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value']; $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax); continue; } if ($totalModule['code'] == 'ot_coupon') { $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_COUPON_TAX_CLASS); $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value']; $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax); continue; } $itemId = 'agio|' . substr($totalModule['code'], 0, 26); if ($totalModule['code'] == 'ot_loworderfee') { $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS); $amountValue = $totalModule['value']; $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax); continue; } } } }
$contents[] = array('align' => 'left', 'text' => '<div align="center"><span><img src="https://images.sofort.com/de/sv/prepayment_small.png" alt="vorkasse" /></span></div>'); break; case 'sofort_sofortrechnung': $contents[] = array('align' => 'left', 'text' => '<div align="center"><span><img src="https://images.sofort.com/de/sr/logo_155x50.png" alt="Rechnung by sofort" /></span></div>'); break; case 'sofort_sofortueberweisung': $contents[] = array('align' => 'left', 'text' => '<div align="center"><span><img src="https://images.sofort.com/de/su/logo_155x50.png" alt="sofortüberweisung" /></span></div>'); break; case 'sofort_lastschrift': $contents[] = array('align' => 'left', 'text' => '<div align="center"><span><img src="https://images.sofort.com/de/ls/logo_155x50.png" alt="Lastschrift by sofort" /></span></div>'); break; case 'sofort_sofortlastschrift': $contents[] = array('align' => 'left', 'text' => '<div align="center"><span><img src="https://images.sofort.com/de/sl/logo_155x50.png" alt="sofortlastschrift" /></span></div>'); break; } $shopsystem = HelperFunctions::getIniValue('shopsystemVersion'); switch ($shopsystem) { case 'xtc3_sp2': $contents[] = array('align' => 'center', 'text' => '<a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . BUTTON_EDIT . '</a>'); break; case 'cseo_2.0': $contents[] = array('align' => 'center', 'text' => '<br /><a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action', 'print_oID')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . BUTTON_EDIT . '</a><br /><br />'); break; case 'cseo_2.1': $contents[] = array('align' => 'center', 'text' => '<br /><a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action', 'print_oID')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . BUTTON_EDIT . '</a><br /><br />'); break; case 'modified_1.06': $contents[] = array('align' => 'center', 'text' => '<a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . BUTTON_EDIT . '</a>'); break; } }
if (!$_SESSION['sofort']['sofort_payment_url']) { $sofortPaymentUrl = $errorUrl; } else { $sofortHost = getenv('sofortApiUrl') != '' ? getenv('sofortApiUrl') : 'https://www.sofort.com'; $hostToCheck = parse_url($sofortHost, PHP_URL_HOST); $paymentHost = parse_url($_SESSION['sofort']['sofort_payment_url'], PHP_URL_HOST); if (strpos($paymentHost, $hostToCheck) === false) { $sofortPaymentUrl = $errorUrl; } else { $sofortPaymentUrl = $_SESSION['sofort']['sofort_payment_url']; } unset($_SESSION['sofort']['sofort_payment_url']); unset($_SESSION['sofort']['sofort_payment_method']); $_SESSION['sofort']['checkout_process'] = true; } echo ' <head> <meta http-equiv="refresh" content="0; URL=' . $sofortPaymentUrl . '/"> <meta content="text/html; charset=' . HelperFunctions::getIniValue('shopEncoding') . '" http-equiv="Content-Type"> </head> <body> <div style="text-align:center;"> <div style="height:50px;"> </div> <div style="height:50px;"> <img src="' . DIR_WS_CATALOG . 'callback/sofort/ressources/images/loader.gif" alt="" /> </div> <div style="height:50px;"> ' . MODULE_PAYMENT_SOFORT_MULTIPAY_FORWARDING . ' </div> </div> </body>';
/** * replace special chars in $reason e.g. ä=>ae, ß=>ss incl. foreign non-ascii-signs etc. * @param string $reason like 'Käufer A. Müller' * @return string - converted String */ function _convertReason($reason) { $oldLocale = setlocale(LC_ALL, 0); setlocale(LC_ALL, "de_DE.utf8"); $shopEncoding = HelperFunctions::getIniValue('shopEncoding'); //$encoding = mb_detect_encoding('aaa'.$reason, "ISO-8859-1, UTF-8"); $convertedReason = substr(iconv($shopEncoding, "ASCII//TRANSLIT", 'aaa' . $reason), 3); setlocale(LC_ALL, $oldLocale); return $convertedReason; }
/** * restock shop articles during cartsynchronization, cancelation etc. * @param string $itemId * @param int $ordersId * @param int $newQty * @param int $oldQty */ protected function _sofortRestock($itemId, $ordersId, $newQty, $oldQty = 'aaaa') { if (!is_numeric($oldQty)) { $oldQty = $this->_getLatestQuantity($itemId, $ordersId); } $splitItemId = explode('{', $itemId); $productId = $splitItemId[0]; for ($i = 1; $i < count($splitItemId); ++$i) { $attrId = explode('}', $splitItemId[$i]); $optionsId[] = $attrId[0]; $optionsValuesId[] = $attrId[1]; } $diff = $oldQty - $newQty; $updateTP = "UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity + " . $diff . " WHERE products_id = '" . $productId . "'"; shopDbQuery($updateTP); if (isset($optionsId) && isset($optionsValuesId) && substr(HelperFunctions::getIniValue('shopsystemVersion'), 0, 3) != 'osc' && substr(HelperFunctions::getIniValue('shopsystemVersion'), 0, 3) != 'zen') { for ($i = 0; $i < count($optionsId); ++$i) { $updateTPA = "UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " SET attributes_stock = attributes_stock + " . $diff . " WHERE products_id = '" . $productId . "' AND options_id = '" . $optionsId[$i] . "' AND options_values_id ='" . $optionsValuesId[$i] . "'"; shopDbQuery($updateTPA); } } }