Пример #1
0
 /**
  * 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 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;
 }