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


PHP Payment::getPaymentInfo方法代码示例

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


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

示例1: doPay

 /**
  * @brief 【重要】进行支付支付方法
  */
 public function doPay()
 {
     //获得相关参数
     $order_id = IFilter::act(IReq::get('order_id'), 'int');
     $recharge = IReq::get('recharge');
     $payment_id = IFilter::act(IReq::get('payment_id'), 'int');
     if ($order_id) {
         //获取订单信息
         $orderDB = new IModel('order');
         $orderRow = $orderDB->getObj('id = ' . $order_id);
         if (empty($orderRow)) {
             IError::show(403, '要支付的订单信息不存在');
         }
         $payment_id = $orderRow['pay_type'];
     }
     //获取支付方式类库
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     //在线充值
     if ($recharge !== null) {
         $recharge = IFilter::act($recharge, 'float');
         $paymentRow = Payment::getPaymentById($payment_id);
         //account:充值金额; paymentName:支付方式名字
         $reData = array('account' => $recharge, 'paymentName' => $paymentRow['name']);
         $sendData = $paymentInstance->getSendData(Payment::getPaymentInfo($payment_id, 'recharge', $reData));
     } else {
         if ($order_id != 0) {
             $sendData = $paymentInstance->getSendData(Payment::getPaymentInfo($payment_id, 'order', $order_id));
         } else {
             IError::show(403, '发生支付错误');
         }
     }
     $this->paymentInstance = $paymentInstance;
     $this->sendData = $sendData;
     $this->redirect('hidden_form', false);
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:38,代码来源:block.php

示例2: doPay

 /**
  * @brief 支付方法
  */
 public static function doPay()
 {
     //获得payment_id 获得相关参数
     $payment_id = intval(IReq::get('id'));
     $order_id = intval(IReq::get('order_id'));
     $recharge = IReq::get('recharge');
     //检查支付方式可用性
     $paymentObj = new Payment();
     $paymentRow = $paymentObj->getPaymentById($payment_id);
     if (empty($paymentRow)) {
         IError::show(403, '支付方式不存在');
     }
     //载入支付接口文件
     $payObj = $paymentObj->loadMethod($paymentRow['file_path']);
     if (isset($payObj->head_charset)) {
         header("Content-Type: text/html;charset=" . $payObj->head_charset);
     }
     $html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n                <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\" dir=\"ltr\">\n                <head>\n</header><body><div>Redirecting...</div>";
     //在线充值
     if ($recharge !== null) {
         $reData = array('account' => $recharge, 'payment_type' => $paymentRow['name']);
         $toSubmit = $payObj->toSubmit($paymentObj->getPaymentInfo($payment_id, 'recharge', $reData));
     } else {
         if ($order_id != 0) {
             $toSubmit = $payObj->toSubmit($paymentObj->getPaymentInfo($payment_id, 'order', $order_id));
         } else {
             IError::show(403, '发生支付错误');
         }
     }
     //兼容站外站内的支付方式
     if (strtolower(substr($payObj->submitUrl, 0, 4)) != 'http') {
         $payObj->submitUrl = IUrl::creatUrl($payObj->submitUrl);
     }
     $html .= "<form id=\"payment\" action=\"" . $payObj->submitUrl . "\" method=\"" . $payObj->method . "\">";
     $buffer = "";
     foreach ($toSubmit as $k => $v) {
         if ($k != "ikey") {
             $html .= "<input  type=\"hidden\" name=\"" . urldecode($k) . "\" value=\"" . htmlspecialchars($v) . "\" />";
             $buffer .= $k . "=" . urlencode($v) . "&";
         }
     }
     $html .= "\n</form>\n<script language=\"javascript\">\ndocument.getElementById('payment').submit();\n</script>\n</html>";
     echo $html;
     exit;
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:48,代码来源:block.php

示例3: doPay

 public function doPay()
 {
     // 获得payment_id 获得相关参数
     $payment_id = Filter::int(Req::args('payment_id'));
     $order_id = Filter::int(Req::args('order_id'));
     $recharge = Req::args('recharge');
     $extendDatas = Req::args();
     if ($payment_id) {
         $payment = new Payment($payment_id);
         $paymentPlugin = $payment->getPaymentPlugin();
         //充值处理
         if ($recharge != null) {
             $recharge = Filter::float($recharge);
             $paymentInfo = $payment->getPayment();
             $data = array('account' => $recharge, 'paymentName' => $paymentInfo['name']);
             $packData = $payment->getPaymentInfo('recharge', $data);
             $packData = array_merge($extendDatas, $packData);
             $sendData = $paymentPlugin->packData($packData);
         } else {
             if ($order_id != null) {
                 $order = Order::getOrder($order_id);
                 $model = new Model("order_goods");
                 if ($order) {
                     //获取订单可能延时时长,0不限制
                     $config = Config::getInstance();
                     $config_other = $config->get('other');
                     // todo 修改方法  order type 去掉  详情表中记录 order type
                     switch ($order['type']) {
                         case '1':
                             $order_delay = isset($config_other['other_order_delay_group']) ? intval($config_other['other_order_delay_group']) : 120;
                             break;
                         case '2':
                             $order_delay = isset($config_other['other_order_delay_flash']) ? intval($config_other['other_order_delay_flash']) : 120;
                             break;
                         case '3':
                             $order_delay = isset($config_other['other_order_delay_bund']) ? intval($config_other['other_order_delay_bund']) : 0;
                             break;
                         default:
                             $order_delay = isset($config_other['other_order_delay']) ? intval($config_other['other_order_delay']) : 0;
                             break;
                     }
                     $time = strtotime("-" . $order_delay . " Minute");
                     $create_time = strtotime($order['create_time']);
                     if ($create_time >= $time || $order_delay == 0) {
                         //取得所有订单商品
                         //$order_goods = $model->table('order_goods')->fields("product_id,goods_nums, prom_type")->where('order_id='.$order_id)->findAll();
                         $order_goods_inst = new OrderGoods();
                         $order_goods = $order_goods_inst->getOrderGoods($order_id);
                         $product_ids = array();
                         $order_products = array();
                         // todo 这里判断 prom_type 类型
                         foreach ($order_goods as $value) {
                             // 套餐不在这里检查商品库存  考虑在别的地方检查
                             // 如果订单详细表中行是由于捆绑促销
                             if ($value['prom_type'] == 'bundling') {
                                 continue;
                             } else {
                                 $product_ids[] = $value['product_id'];
                                 $order_products[$value['product_id']] = $value['goods_nums'];
                             }
                         }
                         $packData = $payment->getPaymentInfo('order', $order_id);
                         $packData = array_merge($extendDatas, $packData);
                         $sendData = $paymentPlugin->packData($packData);
                         /* 这里不需要验证库存量  提交订单时已经验证
                                                 if (!empty($product_ids)) {
                         
                                                     $product_ids = implode(',', $product_ids);
                                                     $products = $model->table('products')->fields("id,store_nums")->where("id in ($product_ids)")->findAll();
                                                     $products_list = array();
                                                     foreach ($products as $value) {
                                                         $products_list[$value['id']] = $value['store_nums'];
                                                     }
                                                     $flag = true;
                                                     foreach ($order_goods as $value) {
                                                         if ($order_products[$value['product_id']] > $products_list[$value['product_id']]) {
                                                             $flag = false;
                                                             break;
                                                         }
                                                     }
                                                     //检测库存是否还能满足订单
                                                     if ($flag) {
                                                         //团购订单
                                                         if ($order['type'] == 1 || $order['type'] == 2) {
                                                             if ($order['type'] == 1) {
                                                                 $prom_name = '团购';
                                                                 $prom_table = "groupbuy";
                                                             } else {
                                                                 $prom_name = '抢购';
                                                                 $prom_table = "flash_sale";
                                                             }
                                                             $prom = $model->table($prom_table)->where("id=" . $order['prom_id'])->find();
                                                             if ($prom) {
                                                                 if (time() > strtotime($prom['end_time']) || $prom['max_num'] <= $prom["goods_num"]) {
                                                                     $model->table("order")->data(array('status' => 6))->where('id=' . $order_id)->update();
                                                                     $this->redirect("/index/msg", false, array('type' => 'fail', 'msg' => '支付晚了,' . $prom_name . "活动已结束。"));
                                                                     exit;
                                                                 }
                                                             }
                                                         }
//.........这里部分代码省略.........
开发者ID:sammychan1981,项目名称:quanpin,代码行数:101,代码来源:payment.php


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