function asc_ctor($parameter)
 {
     loadCoreFile('UUIDUtils.php');
     $payment_module_id = $parameter;
     //                    javaScript            .
     $parameter = UUIDUtils::convert("minuses_and_capitals", "js", $parameter);
     //    checkout prerequisite' ,                           Person Info (e.g. CustomerInfo)
     $this->CHECKOUT_PREREQUISITE_NAME = Checkout::getAdditionalPrerequisiteName("bankAccountInfo", $payment_module_id);
     //         store      ,                          checkout prerequisite' .
     $this->CHECKOUT_STORE_BLOCK_NAME = "bank-account-info-input" . $parameter;
     //        html      ,                                   Person Info.
     $this->HTML_TAGS_PREFIX = "BankAccountInfo" . $parameter;
     //        html      ,                                   Person Info.
     //     .                  Container         .
     $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID = "BankAccountInfo";
     //                 .                          . (e.g. CheckoutCustomerInfoInput)
     $this->BLOCK_TAG_NAME = "CheckoutBankAccountInfoInput" . $parameter;
     //                                                      ,
     //                                                       :
     $this->{get_parent_class(__CLASS__)}();
 }
 /**
  * Adds a Custoner (List Person) to this order.
  * It is used, for example, to save unregistered customers.
  * A separate record is not created in the table persons.
  *
  * @
  * @param
  * @return
  */
 function addOrderPerson($order_id)
 {
     global $application;
     $tables = $this->getTables();
     $ptiv = $tables["person_to_info_variants"]['columns'];
     $opd = $tables["order_person_data"]['columns'];
     $data = $this->getPrerequisitesValidationResults();
     $payment_module_id = modApiFunc("Checkout", "getChosenPaymentModuleIdCZ");
     $required_cc_info_prerequisite_name = Checkout::getAdditionalPrerequisiteName("creditCardInfo", $payment_module_id);
     $required_bank_account_info_prerequisite_name = Checkout::getAdditionalPrerequisiteName("bankAccountInfo", $payment_module_id);
     loadCoreFile('db_multiple_insert.php');
     $query = new DB_Multiple_Insert('order_person_data');
     $query->setInsertFields(array('order_id', 'person_info_variant_id', 'person_attribute_id', 'order_person_data_name', 'order_person_data_value', 'order_person_data_description', 'order_person_data_b_encrypted', 'order_person_data_encrypted_secret_key', 'order_person_data_rsa_public_key_asc_format'));
     foreach ($data as $prerequisite_key => $info) {
         if (_ml_strpos($prerequisite_key, "Module") || $prerequisite_key == 'subscriptionTopics') {
             //"shippingModuleAndMethod","paymentModule"
         } else {
             if (_ml_strpos($prerequisite_key, "creditCardInfo") !== FALSE) {
                 /**
                  * Define, if this creditCardInfo instance matches
                  * the selected payment module.
                  * If it does, then write it to the DB. Make two instances:
                  * 1. not encrypted obfuscaed one
                  * 2. not obfuscated encrypted one.
                  */
                 if ($prerequisite_key == $required_cc_info_prerequisite_name) {
                     /*
                       Ask the payment module, if it has to store Credit Card Info
                       in the database, or it won't be used after creating the order.
                     */
                     $mInfo = Checkout::getPaymentModuleInfo($payment_module_id);
                     $mmObj =& $application->getInstance('Modules_Manager');
                     $mmObj->includeAPIFileOnce($mInfo["APIClassName"]);
                     /* This condition can be checked only after loading */
                     if (is_callable(array($mInfo["APIClassName"], "storeCreditCardInfoInDB"))) {
                         $b_storeCreditCardInfoInDB = call_user_func(array($mInfo["APIClassName"], 'storeCreditCardInfoInDB'));
                         if ($b_storeCreditCardInfoInDB === true) {
                             $symmetric_secret_key = modApiFunc("Crypto", "blowfish_gen_blowfish_key");
                             $rsa_public_key = modApiFunc("Payment_Module_Offline_CC", "getRSAPublicKeyInCryptRSAFormat");
                             $rsa_public_key_asc_format = modApiFunc("Payment_Module_Offline_CC", "getRSAPublicKeyInASCFormat");
                             $rsa_obj = new Crypt_RSA();
                             $encrypted_symmetric_secret_key = $rsa_obj->encrypt($symmetric_secret_key, $rsa_public_key);
                             //Decrypt data in the session
                             $this->decrypt_prerequisite_with_checkout_cz_blowfish_key($prerequisite_key);
                             $decrypted_data = $this->getPrerequisitesValidationResults();
                             $info = $decrypted_data[$prerequisite_key];
                             //Encrypt data in the session
                             $this->encrypt_prerequisite_with_checkout_cz_blowfish_key($prerequisite_key);
                             $person_info_variant_id = $this->getPersonInfoVariantId($prerequisite_key, $info['variant_tag']);
                             //Encrypt data in the session
                             foreach ($info["validatedData"] as $attribute_key => $validatedData) {
                                 $attribute_id = $validatedData["id"];
                                 $attribute_visible_name = $validatedData["attribute_visible_name"];
                                 if ($attribute_key == "CreditCardType") {
                                     $cc_type_names = modApiFunc("Configuration", "getCreditCardSettings");
                                     $attribute_value = $cc_type_names[$validatedData["value"]]["name"];
                                 } else {
                                     $attribute_value = $validatedData["value"];
                                 }
                                 $attribute_description = $validatedData["attribute_description"];
                                 // add the not encrypted obfuscated value
                                 $b_encrypted = "0";
                                 $i_arr = array('order_id' => $order_id, 'person_info_variant_id' => $person_info_variant_id, 'person_attribute_id' => $attribute_id, 'order_person_data_name' => $attribute_visible_name, 'order_person_data_value' => $this->get_public_view_of_secured_data($attribute_value, $attribute_id), 'order_person_data_description' => $attribute_description, 'order_person_data_b_encrypted' => $b_encrypted, 'order_person_data_encrypted_secret_key' => $encrypted_symmetric_secret_key, 'order_person_data_rsa_public_key_asc_format' => $rsa_public_key_asc_format);
                                 $query->addInsertValuesArray($i_arr);
                                 // add the not obfuscated encrypted value
                                 $i_arr['order_person_data_b_encrypted'] = "1";
                                 $i_arr['order_person_data_value'] = base64_encode($this->encryptOrderPersonAttribute($attribute_value, $symmetric_secret_key));
                                 $query->addInsertValuesArray($i_arr);
                             }
                         }
                     }
                 }
             } else {
                 //                    ,                                                 ,
                 //                ,                                  ,
                 //                              .
                 if (_ml_strpos($prerequisite_key, "bankAccountInfo") !== FALSE && $required_bank_account_info_prerequisite_name != $prerequisite_key) {
                     //BankAccountInfo,
                 } else {
                     $person_info_variant_id = $this->getPersonInfoVariantId($prerequisite_key, $info['variant_tag']);
                     // add to the table order_person_data
                     foreach ($info["validatedData"] as $attribute_key => $validatedData) {
                         if ($attribute_key == "Statemenu" || $attribute_key == "Statetext") {
                             //An attribute "state" from the DB matches two attributes
                             // state_menu and state_text in the session. They are mutually exclussive in meaning:
                             // state_menu is the ID of the record about the state in the DB, i.e.
                             // a number. sate_text is a state name, inputted manually by a customer.
                             // It is inputted only if the customer selected a country, which has no
                             // defined states in the DB. As for now (Dec 2005) in the DB
                             // in the field "state" is saved only one of the values, which is not empty.
                             // Either sate_menu, or state_text.
                             if ($attribute_key == "Statetext") {
                                 continue;
                             }
                             if ($attribute_key == "Statemenu") {
                                 $state_menu_value = $info["validatedData"]["Statemenu"]["value"];
                                 $state_text_value = $info["validatedData"]["Statetext"]["value"];
                                 //FIMXE: check if both values are empty.
                                 $value = empty($state_menu_value) ? $state_text_value : $state_menu_value;
                                 //: analyze the conversion "1 atribute" <=> "2 attributes" for
                                 // "state". As for now(Dec 2005) data on DB-attribute "state"
                                 // is saved to the session-attribute "Statemenu"
                                 //Write a state name, but not the id
                                 //: depends on another attribute value: Country
                                 if (is_numeric($value)) {
                                     //: can validatedData contain a nested
                                     //  structure with the same name validatedData?
                                     $states = modApiFunc("Location", "getStates", $info["validatedData"]["Country"]["value"]);
                                     $value = $states[$value];
                                 }
                                 // add to the table order_person_data
                                 $i_arr = array('order_id' => $order_id, 'person_info_variant_id' => $person_info_variant_id, 'person_attribute_id' => $validatedData["id"], 'order_person_data_name' => $validatedData["attribute_visible_name"], 'order_person_data_value' => $value, 'order_person_data_description' => $validatedData["attribute_description"], 'order_person_data_b_encrypted' => "0", 'order_person_data_encrypted_secret_key' => "", 'order_person_data_rsa_public_key_asc_format' => "");
                                 $query->addInsertValuesArray($i_arr);
                             }
                         } else {
                             //Write a name for the country rather than the id
                             if ($attribute_key == "Country") {
                                 $countries = modApiFunc("Location", "getCountries");
                                 $value = empty($validatedData["value"]) ? "" : $countries[$validatedData["value"]];
                             } else {
                                 $value = $validatedData["value"];
                             }
                             $i_arr = array('order_id' => $order_id, 'person_info_variant_id' => $person_info_variant_id, 'person_attribute_id' => $validatedData["id"], 'order_person_data_name' => $validatedData["attribute_visible_name"], 'order_person_data_value' => $value, 'order_person_data_description' => $validatedData["attribute_description"], 'order_person_data_b_encrypted' => "0", 'order_person_data_encrypted_secret_key' => "", 'order_person_data_rsa_public_key_asc_format' => "");
                             $query->addInsertValuesArray($i_arr);
                         }
                     }
                 }
             }
         }
     }
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
 /**
  * Outputs the OneStepCheckout view.
  */
 function output($current_step = '', $errors_only = false)
 {
     global $application;
     if ($current_step < 1 || $current_step > 3) {
         $current_step = '';
     }
     $step_id = $this->pCheckout->getCurrentStepID();
     if ($step_id == 3) {
         $payment_module_id = modApiFunc("Checkout", "getChosenPaymentModuleIdCZ");
         $prerequisite_name = Checkout::getAdditionalPrerequisiteName("creditCardInfo", $payment_module_id);
         $PrerequisitesValidationResults = modApiFunc("Checkout", "getPrerequisitesValidationResults");
         if (isset($PrerequisitesValidationResults[$prerequisite_name]) && $PrerequisitesValidationResults[$prerequisite_name]["isMet"] != true) {
             if ($prerequisite_name == "creditCardInfoAC593800_68BA_A4D3_6A14_49BA5022FED7" && isset($PrerequisitesValidationResults['billingInfo']['variant_tag']) && $PrerequisitesValidationResults['billingInfo']['variant_tag'] == "PayPalProExpressCheckout") {
             } else {
                 $request = new Request();
                 $request->setView('CheckoutView');
                 $request->setAction("SetCurrStep");
                 $request->setKey('step_id', 2);
                 $request = modApiFunc("Checkout", "appendCheckoutCZGETParameters", $request);
                 modApiFunc("Checkout", "saveState");
                 $application->redirect($request);
                 return '';
             }
         }
     }
     // setting up the template engine
     $template_block = $application->getBlockTemplate('OneStepCheckout');
     $this->mTmplFiller->setTemplate($template_block);
     if (!modApiFunc('Cart', 'getCartProductsQuantity') || modApiFunc('Checkout', 'getLastPlacedOrderID') || modApiFunc('Configuration', 'getValue', SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT) > ZERO_PRICE && modApiFunc('Checkout', 'getOrderPrice', 'Subtotal', modApiFunc('Localization', 'getMainStoreCurrency')) < modApiFunc('Configuration', 'getValue', SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT)) {
         return getCheckout();
     }
     $_tags = array('Local_StepID' => $step_id, 'Local_FormAction' => $this->getLinkToCheckoutStep(), 'Local_BlowFishKey' => modApiFunc('Checkout', 'getPerRequestVariable', 'CHECKOUT_CZ_BLOWFISH_KEY'), 'Local_PaymentMethods' => $this->getPaymentModulesList(), 'Local_PaymentMethodOutput' => $this->getPaymentModuleOutput(), 'Local_CreditCardInfoJSAttrRules' => $this->getJSAttrRules(), 'Local_Errors_1' => $this->getErrors(1), 'Local_Errors_2' => $this->getErrors(2), 'Local_Errors_3' => $this->getErrors(3), 'Local_Errors' => $this->getErrors($step_id));
     $this->_Template_Contents = $_tags;
     $application->registerAttributes($this->_Template_Contents, 'OneStepCheckout');
     if ($current_step) {
         if ($errors_only && $this->getErrors($step_id)) {
             return $this->mTmplFiller->fill('error');
         }
         return $this->mTmplFiller->fill('step' . $current_step);
     }
     return $this->mTmplFiller->fill('container');
 }
 /**
  * Returns the CheckoutView view.
  *
  * @ finish the functions on this page
  */
 function output()
 {
     global $application;
     $step_id = $this->pCheckout->getCurrentStepID();
     if (NULL == $step_id) {
         $err_params = array("CODE" => "CHECKOUT_ERR_VIEW_001");
         _fatal($err_params);
     } else {
         if ($step_id == 3) {
             $payment_module_id = modApiFunc("Checkout", "getChosenPaymentModuleIdCZ");
             $prerequisite_name = Checkout::getAdditionalPrerequisiteName("creditCardInfo", $payment_module_id);
             $PrerequisitesValidationResults = modApiFunc("Checkout", "getPrerequisitesValidationResults");
             if (isset($PrerequisitesValidationResults[$prerequisite_name]) && $PrerequisitesValidationResults[$prerequisite_name]["isMet"] != true) {
                 if ($prerequisite_name == "creditCardInfoAC593800_68BA_A4D3_6A14_49BA5022FED7" && isset($PrerequisitesValidationResults['billingInfo']['variant_tag']) && $PrerequisitesValidationResults['billingInfo']['variant_tag'] == "PayPalProExpressCheckout") {
                     //line to be added
                 } else {
                     $request = new Request();
                     $request->setView('CheckoutView');
                     $request->setAction("SetCurrStep");
                     $request->setKey('step_id', 2);
                     $request = modApiFunc("Checkout", "appendCheckoutCZGETParameters", $request);
                     modApiFunc("Checkout", "saveState");
                     $application->redirect($request);
                     return '';
                 }
             }
         }
         $this->templateFiller =& $application->getInstance('TemplateFiller');
         $this->template = $application->getBlockTemplate('CheckoutView');
         $this->templateFiller->setTemplate($this->template);
         $lastPlacedOrderID = modApiFunc("Checkout", "getLastPlacedOrderID");
         //If the cart is empty from the very beginning (not after cle ring on CheckoutConfirmation)
         // - output the message "Empty cart".
         if (modApiFunc("Cart", "getCartProductsQuantity") == 0 && empty($lastPlacedOrderID)) {
             $template_name = "ErrorEmptyCart";
             $application->registerAttributes(array());
         } elseif (modApiFunc("Cart", "getCartProductsQuantity") > 0 && empty($lastPlacedOrderID) && modApiFunc('Configuration', 'getValue', SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT) > ZERO_PRICE && modApiFunc("Checkout", "getOrderPrice", "Subtotal", modApiFunc("Localization", "getMainStoreCurrency")) < modApiFunc('Configuration', 'getValue', SYSCONFIG_MIN_SUBTOTAL_TO_BEGIN_CHECKOUT)) {
             //                    ,                   (Subtotal                              ),
             //                     ,
             $application->registerAttributes(array("Local_CartMinSubtotal" => ''));
             $template_name = "ErrorCartMinSubtotal";
         } else {
             $orderInfo = NULL;
             if ($lastPlacedOrderID !== NULL) {
                 $orderInfo = modApiFunc("Checkout", "getOrderInfo", $lastPlacedOrderID, modApiFunc("Localization", "whichCurrencyToDisplayOrderIn", $lastPlacedOrderID));
             }
             if ($lastPlacedOrderID !== NULL && $orderInfo['PaymentStatusId'] == 3) {
                 $template_name = "PaymentTransactionFailed";
                 $application->registerAttributes(array("Local_OrderID" => '', "Local_Step4PaymentModuleMessage" => '', "Local_OrderTotal" => '', "Local_OrderTotalRaw" => ''));
             } elseif (modApiFunc("Checkout", "getCustomPaymentGatewayPageContents") != NULL) {
                 // If the curent step is checkout-confirmation and an answer came from
                 // the server as pre-formatted HTML, then view it. Workaround: check if the
                 // variable containing the HTML code in the Checkout module is not empty.
                 # fill the template on the current step of the checkout process
                 $template_name = "CustomPaymentGatewayPage";
                 $application->registerAttributes(array("CustomPaymentGatewayPageContents" => ''));
             } else {
                 # fill the template on the current step of the checkout process
                 $template_name = "Step" . $this->pCheckout->getCurrentStepID();
                 $default = array("Local_OrderID" => '', "Local_Step4PaymentModuleMessage" => '', "Local_OrderTotal" => '', "Local_OrderTotalRaw" => '', "Local_OrderDate" => '', "Local_OrderStatus" => '', "Local_OrderPaymentStatus" => '', "Local_OrderPaymentMethod" => '', "Local_OrderPaymentProcessorOrderId" => '', "Local_OrderShippingMethod" => '', "Local_ProcessPaymentHiddenFields" => '', "Local_PaymentMethodOutput" => '', "CheckoutPaymentMethodsOutput" => '', "CheckoutPaymentMethodsSelect" => '', "Local_CreditCardInfoJSAttrRules" => '', "Local_PaymentMethods" => '', "CheckoutConfirmationFormAction" => '', "Local_ConfirmationFormAction" => '', "Local_ConfirmationFormMethod" => '', "Local_CheckoutConfirmationBodyOnLoad" => '', "Local_FormName" => '', "Local_FormAction" => '', "Local_FormMethod" => '', "Local_FormHiddenFields" => '', "Local_FormActionFieldName" => '', "Local_FormActionFieldValue" => '', "Local_FormStepIDFieldName" => '', "Local_FormStepIDFieldValue" => '', "Local_FormPreviousStepIDFieldName" => '', "Local_FormPreviousStepIDFieldValue" => '', "Local_FormCHECKOUT_CZ_BLOWFISH_KEYName" => '', "Local_FormCHECKOUT_CZ_BLOWFISH_KEYValue" => '', "CheckoutErrors" => '');
                 $default = apply_filters("avactis_checkout_view_addAttributes", $default);
                 $application->registerAttributes($default, '');
             }
         }
         $retval = $this->templateFiller->fill($template_name);
         //Output blocks of current step page.
         /**
          * Don't check for prerequisites: it should be done while processing Action.
          */
     }
     if (modApiFunc("Checkout", "isLastStepWithPrerequisites", $step_id)) {
         //remove validation info of the inputted data after checkout
         // clear QuickCheckout Customers' personal information
         if (modApiFunc('Settings', 'getParamValue', 'CUSTOMER_ACCOUNT_SETTINGS', 'CLEAR_QCC_PERSONAL_INFO') === 'YES' && modApiFunc('Customer_Account', 'getCurrentSignedCustomer') === null) {
             $sess_obj = $application->getInstance("Session");
             $sess_obj->un_Set('PrerequisitesValidationResults');
         }
     }
     return $retval;
 }