static function getOrderId() { if (empty($_REQUEST['handler'])) { //DBG::log("PaymentProcessing::getOrderId(): No handler, fail"); return false; } switch ($_REQUEST['handler']) { case 'saferpay': return \Saferpay::getOrderId(); case 'paypal': return \PayPal::getOrderId(); case 'yellowpay': return \Yellowpay::getOrderId(); case 'payrexx': return \PayrexxProcessor::getOrderId(); // Added 20100222 -- Reto Kohli // Added 20100222 -- Reto Kohli case 'mobilesolutions': //DBG::log("getOrderId(): mobilesolutions"); $order_id = \PostfinanceMobile::getOrderId(); //DBG::log("getOrderId(): mobilesolutions, Order ID $order_id"); return $order_id; // Added 20081117 -- Reto Kohli // Added 20081117 -- Reto Kohli case 'datatrans': return \Datatrans::getOrderId(); // For the remaining types, there's no need to check in, so we // return true and jump over the validation of the order ID // directly to success! // Note: A backup of the order ID is kept in the session // for payment methods that do not return it. This is used // to cancel orders in all cases where false is returned. // For the remaining types, there's no need to check in, so we // return true and jump over the validation of the order ID // directly to success! // Note: A backup of the order ID is kept in the session // for payment methods that do not return it. This is used // to cancel orders in all cases where false is returned. case 'Internal': case 'Internal_CreditCard': case 'Internal_Debit': case 'Internal_LSV': case 'dummy': return isset($_SESSION['shop']['order_id_checkin']) ? $_SESSION['shop']['order_id_checkin'] : false; } // Anything else is wrong. return false; }
/** * Sets up the Payment settings view * @param \Cx\Core\Html\Sigma $objTemplate The optional Template, * by reference * @return boolean True on success, * false otherwise */ static function view_settings(&$objTemplate = null) { if (!$objTemplate) { $objTemplate = new \Cx\Core\Html\Sigma(); $objTemplate->loadTemplateFile('module_shop_settings_payment.html'); } else { $objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_payment.html'); } $i = 0; foreach (Payment::getArray() as $payment_id => $arrPayment) { $zone_id = Zones::getZoneIdByPaymentId($payment_id); $objTemplate->setVariable(array('SHOP_PAYMENT_STYLE' => 'row' . (++$i % 2 + 1), 'SHOP_PAYMENT_ID' => $arrPayment['id'], 'SHOP_PAYMENT_NAME' => $arrPayment['name'], 'SHOP_PAYMENT_HANDLER_MENUOPTIONS' => PaymentProcessing::getMenuoptions($arrPayment['processor_id']), 'SHOP_PAYMENT_COST' => $arrPayment['fee'], 'SHOP_PAYMENT_COST_FREE_SUM' => $arrPayment['free_from'], 'SHOP_ZONE_SELECTION' => Zones::getMenu($zone_id, "zone_id[{$payment_id}]"), 'SHOP_PAYMENT_STATUS' => intval($arrPayment['active']) ? \Html::ATTRIBUTE_CHECKED : '')); $objTemplate->parse('shopPayment'); } $objTemplate->setVariable(array('SHOP_PAYMENT_HANDLER_MENUOPTIONS_NEW' => PaymentProcessing::getMenuoptions(-1), 'SHOP_ZONE_SELECTION_NEW' => Zones::getMenu(0, 'zone_id_new'))); // Payment Service Providers $objTemplate->setVariable(array('SHOP_PAYMILL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMILL_TEST_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 0 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_LIVE_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 1 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_TEST_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_private_key', 'Shop')), 'SHOP_PAYMILL_TEST_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_public_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_private_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_public_key', 'Shop')), 'SHOP_PAYMILL_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_private_key', 'Shop')), 'SHOP_PAYMILL_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_public_key', 'Shop')), 'SHOP_SAFERPAY_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'), 'SHOP_SAFERPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_TEST_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop'), 'SHOP_SAFERPAY_TEST_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_FINALIZE_PAYMENT' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_finalize_payment', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_WINDOW_MENUOPTIONS' => \Saferpay::getWindowMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')), 'SHOP_PAYREXX_INSTANCE_NAME' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_instance_name', 'Shop'), 'SHOP_PAYREXX_API_SECRET' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_api_secret', 'Shop'), 'SHOP_PAYREXX_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_SHOP_ID' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_shop_id', 'Shop'), 'SHOP_YELLOWPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_HASH_SIGNATURE_IN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_in', 'Shop')), 'SHOP_YELLOWPAY_HASH_SIGNATURE_OUT' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Shop')), 'SHOP_YELLOWPAY_AUTHORIZATION_TYPE_OPTIONS' => \Yellowpay::getAuthorizationMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_authorization_type', 'Shop')), 'SHOP_YELLOWPAY_USE_TESTSERVER_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_WEBUSER' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_webuser', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_SIGN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_sign', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_IJUSTWANTTOTEST_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_ijustwanttotest', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_status', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_AUTHORIZATION_TYPE_OPTIONS' => \Datatrans::getReqtypeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('datatrans_request_type', 'Shop')), 'SHOP_DATATRANS_MERCHANT_ID' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_merchant_id', 'Shop'), 'SHOP_DATATRANS_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_YES_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_NO_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_PAYPAL_EMAIL' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paypal_account_email', 'Shop')), 'SHOP_PAYPAL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYPAL_DEFAULT_CURRENCY_MENUOPTIONS' => \PayPal::getAcceptedCurrencyCodeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('paypal_default_currency', 'Shop')), 'SHOP_PAYMENT_LSV_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payment_lsv_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMENT_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()))); return true; }
static function getForm($arrOrder, $autopost = false) { global $_ARRAYLANG; /* 'AMOUNT' => str_replace('.', '', $_SESSION['shop']['grand_total_price']), 'CURRENCY' => \Cx\Modules\Shop\Controller\Currency::getActiveCurrencyCode(), 'ORDERID' => $_SESSION['shop']['order_id'], 'ACCOUNTID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id','Shop'), 'SUCCESSLINK' => urlencode('http://'.$serverBase.'index.php?section=Shop'.MODULE_INDEX.'&cmd=success&result=1&handler=saferpay'), 'FAILLINK' => urlencode('http://'.$serverBase.'index.php?section=Shop'.MODULE_INDEX.'&cmd=success&result=0&handler=saferpay'), 'BACKLINK' => urlencode('http://'.$serverBase.'index.php?section=Shop'.MODULE_INDEX.'&cmd=success&result=2&handler=saferpay'), 'DESCRIPTION' => urlencode('"'.$_ARRAYLANG['TXT_ORDER_NR'].' '.$_SESSION['shop']['order_id'].'"'), 'LANGID' => FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID), 'NOTIFYURL' => urlencode('http://'.$serverBase.'index.php?section=Shop'.MODULE_INDEX.'&cmd=success&result=-1&handler=saferpay'), 'ALLOWCOLLECT' => 'no', 'DELIVERY' => 'no', 'PROVIDERSET' = $arrCards; // if set*/ $payInitUrl = self::payInit($arrOrder, \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop')); //DBG::log("Saferpay::getForm(): payInit URL: $payInitUrl"); if (!$payInitUrl || strtoupper(substr($payInitUrl, 0, 5)) == 'ERROR') { return "<font color='red'><b>" . $_ARRAYLANG['TXT_SHOP_PSP_FAILED_TO_INITIALISE_SAFERPAY'] . "<br />Warnings:<br />" . Saferpay::getErrors() . "<br />Errors:<br />" . Saferpay::getWarnings() . "</b></font>"; } $return = "<script src='http://www.saferpay.com/OpenSaferpayScript.js'></script>\n"; switch (\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')) { case 0: // iframe -- UNUSED, because it does not work reliably! return $return . $_ARRAYLANG['TXT_ORDER_PREPARED'] . "<br/><br/>\n" . "<iframe src='{$payInitUrl}' width='580' height='400' scrolling='no' marginheight='0' marginwidth='0' frameborder='0' name='saferpay'></iframe>\n"; case 1: // popup return $return . $_ARRAYLANG['TXT_ORDER_LINK_PREPARED'] . '<br/><br/> <script type="text/javascript"> function openSaferpay() { strUrl = "' . $payInitUrl . '"; if (strUrl.indexOf("WINDOWMODE=Standalone") == -1) { strUrl += "&WINDOWMODE=Standalone"; } oWin = window.open(strUrl, "SaferpayTerminal", "scrollbars=1,resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,width=580,height=400"); if (oWin == null || typeof(oWin) == "undefined") { alert("The payment couldn\'t be initialized. Maybe you are using a popup blocker?"); } } ' . ($autopost ? 'window.setTimeout(3000, openSaferpay()); ' : '') . ' </script> <input type="button" name="order_now" value="' . $_ARRAYLANG['TXT_ORDER_NOW'] . '" onclick="openSaferpay();" /> '; default: //case 2: // new window } return $return . $_ARRAYLANG['TXT_ORDER_LINK_PREPARED'] . "<br/><br/>\n<form method='post' action='{$payInitUrl}'>\n <input type='submit' value='" . $_ARRAYLANG['TXT_ORDER_NOW'] . "' />\n</form>\n" . ($autopost ? ' <script type="text/javascript"> window.setTimeout(3000, function() { document.forms[0].submit(); }); </script> ' : ''); }