Пример #1
0
 function initAdditionalPrerequisitesValidationResults($prerequisite_type, $force_rewrite = true)
 {
     /* Inquire all Payment modules.
           If the method getInitPrerequisitesValidationResultsData exists - call it
           and add a corresponding prerequisite.
        */
     global $application;
     /* create the object Modules_Manager to upload all required modules */
     $mmObj =& $application->getInstance('Modules_Manager');
     $modules = Checkout::getInstalledAndActiveModulesListData("payment");
     foreach ($modules as $moduleInfo) {
         /* Load a required file */
         $mmObj->includeAPIFileOnce($moduleInfo->name);
         /* This condition can be checked only after loading */
         if (is_callable(array($moduleInfo->name, "getAdditionalPersonInfoVariantTag"))) {
             /* It MUST be called statically,
              * otherwise, if modApiFunc is used, the object of this module
              * will be created, which will lead to creation
              * of the checkout object, so the payment/shipping module will
              * ask the checkout object for isActive, and that will lead to
              * the complete cycling. */
             $variant_tag = call_user_func(array($moduleInfo->name, 'getAdditionalPersonInfoVariantTag'), $prerequisite_type);
             //false                     ,                       Checkout CZ              -
             //                                    CCInfo        : AuthorizeNet, PaypalPro.
             //            ,                                     CCInfo,        ,                      -
             //         false.                    CCInfo                        .
             if ($variant_tag !== false) {
                 $prerequisite_name = Checkout::getAdditionalPrerequisiteName($prerequisite_type, call_user_func(array($moduleInfo->name, "getUid")));
                 if ($force_rewrite || !isset($this->PrerequisitesValidationResults[$prerequisite_name])) {
                     $variant_id = Checkout::getPersonInfoVariantId($prerequisite_type, $variant_tag);
                     $variant_info = Checkout::getPersonVariantInfo($variant_id);
                     $variant_view_tag = $prerequisite_name;
                     $prerequisite_data = array("variant_view_tag" => $variant_view_tag, "variant_tag" => $variant_info['variant_tag'], "variant_type_id" => $variant_info['type_id'], "variant_visible_name" => $variant_info['visible_name']);
                     Checkout::initSinglePrerequisiteValidationResults($prerequisite_data["variant_view_tag"], $prerequisite_data["variant_tag"], $prerequisite_data["variant_type_id"], $prerequisite_data["variant_visible_name"]);
                 }
             }
         } else {
             //echo "DIE not callable: ". $moduleInfo->name . " getInitPrerequisitesValidationResultsData();" . "<br>";
         }
     }
 }