当前位置: 首页>>代码示例>>PHP>>正文


PHP PaymentModule::getPaymentModules方法代码示例

本文整理汇总了PHP中PaymentModule::getPaymentModules方法的典型用法代码示例。如果您正苦于以下问题:PHP PaymentModule::getPaymentModules方法的具体用法?PHP PaymentModule::getPaymentModules怎么用?PHP PaymentModule::getPaymentModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaymentModule的用法示例。


在下文中一共展示了PaymentModule::getPaymentModules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hookNewOrder

 /**
  * Insert order in Certissim table, with the state concerned by the payment method and the configuration
  *
  * @param array $params
  * @return boolean
  */
 public function hookNewOrder($params)
 {
     //checks if the order already exists
     $sql_secure = "SELECT *\n\t\t\tFROM `" . _DB_PREFIX_ . self::CERTISSIM_ORDER_TABLE_NAME . "`\n\t\t\tWHERE `id_order`=" . $params['order']->id;
     $select = Db::getInstance()->execute($sql_secure);
     $count = Db::getInstance()->numRows();
     //if order exists, end of process
     if (!$select || $count > 0) {
         CertissimLogger::insertLog(__METHOD__ . ' : ' . __LINE__, "Erreur de verif existence order. Select = " . (string) $select . " et erreur = " . Db::getInstance()->getMsgError() . " ou commande déjà insérée (count =" . $count . ")");
         return false;
     }
     //lists all payment methods
     if (_PS_VERSION_ < '1.5') {
         $payments = $this->getInstalledPaymentModules();
     } else {
         $payments = PaymentModule::getPaymentModules();
     }
     //looks for the payment module used
     $found = false;
     $payment_name = $params['order']->module;
     while (!$found && ($payment = array_pop($payments))) {
         $found = $payment_name == $payment['name'];
     }
     //if module found
     if ($found) {
         //if PS 1.4 or lower
         if (_PS_VERSION_ < '1.5') {
             /** gets the id of the module * */
             $module = Module::getInstanceByName($payment['name']);
             $id_module = $module->id;
         } else {
             $id_module = $payment['id_module'];
         }
         CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Module détecté : {$payment_name}, 'CERTISSIM_" . $id_module . "_PAYMENT_TYPE' = " . Configuration::get('CERTISSIM_' . $id_module . '_PAYMENT_TYPE') . ", 'CERTISSIM_" . $id_module . "_PAYMENT_ENABLED' = " . Configuration::get('CERTISSIM_' . $id_module . '_PAYMENT_ENABLED'));
         //defines the state label according to the status of the payment module (activated for Certissim or not)
         $state_label = Configuration::get('CERTISSIM_' . $id_module . '_PAYMENT_ENABLED') == '1' ? 'ready to send' : 'not concerned';
         CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "State sélectionné : {$state_label}");
     } else {
         //if module not found, end of process with log
         CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Erreur module paiement : module {$payment_name} non référencé dans liste (" . implode(', ', $payments) . "). Insertion commande annulée.");
         return false;
     }
     //gets the certissim_state
     $state_sql = "SELECT `id_certissim_state` FROM `" . _DB_PREFIX_ . self::CERTISSIM_STATE_TABLE_NAME . "` WHERE `label`='{$state_label}'";
     $state_id = Db::getInstance()->getValue($state_sql);
     //inserts the order into the certissim table with the state previously set
     self::insertCertissimOrder(array('id_order' => (int) $params['order']->id, 'id_certissim_state' => $state_id, 'customer_ip_address' => Tools::getRemoteAddr(), 'date' => date('Y-m-d H:i:s')));
     return true;
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:55,代码来源:fianetfraud.php


注:本文中的PaymentModule::getPaymentModules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。