當前位置: 首頁>>代碼示例>>PHP>>正文


PHP payment::update方法代碼示例

本文整理匯總了PHP中payment::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP payment::update方法的具體用法?PHP payment::update怎麽用?PHP payment::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在payment的用法示例。


在下文中一共展示了payment::update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doPay

 public function doPay($filter)
 {
     if (!$filter['pay_app_id']) {
         throw new \LogicException(app::get('systrade')->_("請選擇支付方式!"));
         return false;
     }
     //檢測該支付單是否被支付
     //檢測該支付單中的訂單是否有異常
     $payments = $this->checkTradeData($filter['payment_id']);
     if (!$payments) {
         throw new \LogicException(app::get('systrade')->_("支付失敗"));
         return false;
     }
     $payments['pay_app_id'] = $filter['pay_app_id'];
     $payments['return_url'] = $filter['return_url'];
     //更新支付單的支付方式
     //請求第三方支付接口
     $updateResult = payment::update($payments);
     if (!$updateResult) {
         throw new \LogicException(app::get('systrade')->_("支付信息更新失敗"));
         return false;
     }
     $objPayment = kernel::single('ectools_pay');
     $result = $objPayment->generate($payments);
     if (!$result) {
         throw new \LogicException(app::get('systrade')->_("支付失敗"));
         return false;
     }
     return true;
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:30,代碼來源:gather.php

示例2: parse

 /**
  * 支付返回後的同意支付處理
  * @params array - 頁麵參數
  * @return null
  */
 public function parse($params = '')
 {
     // 取到內部係統參數
     $arr_pathInfo = explode('?', $_SERVER['REQUEST_URI']);
     $pathInfo = substr($arr_pathInfo[0], strpos($arr_pathInfo[0], "parse/") + 6);
     $objShopApp = $this->getAppName($pathInfo);
     $innerArgs = explode('/', $pathInfo);
     $class_name = array_shift($innerArgs);
     $method = array_shift($innerArgs);
     $arrStr = array();
     $arrSplits = array();
     $arrQueryStrs = array();
     // QUERY_STRING
     if (isset($arr_pathInfo[1]) && $arr_pathInfo[1]) {
         $querystring = $arr_pathInfo[1];
     }
     if ($querystring) {
         $arrStr = explode("&", $querystring);
         foreach ($arrStr as $str) {
             $arrSplits = explode("=", $str);
             $arrQueryStrs[urldecode($arrSplits[0])] = urldecode($arrSplits[1]);
         }
     } else {
         if ($_POST) {
             $arrQueryStrs = $_POST;
         }
     }
     logger::info("支付返回信息記錄:" . var_export($arrQueryStrs, 1));
     $payments = new $class_name($objShopApp);
     $ret = $payments->{$method}($arrQueryStrs);
     logger::info("支付返回信息轉換之後記錄:" . var_export($ret, 1));
     // 支付結束,回調服務.
     if (!isset($ret['status']) || $ret['status'] == '') {
         $ret['status'] = 'failed';
     }
     $objPayments = app::get('ectools')->model('payments');
     $sdf = $objPayments->getRow('*', array('payment_id' => $ret['payment_id']));
     if ($sdf) {
         $sdf['account'] = $ret['account'];
         $sdf['bank'] = $ret['bank'];
         $sdf['pay_account'] = $ret['pay_account'];
         $sdf['currency'] = $ret['currency'];
         $sdf['trade_no'] = $ret['trade_no'];
         $sdf['payed_time'] = $ret['t_payed'];
         $sdf['pay_app_id'] = $ret['pay_app_id'];
         $sdf['pay_type'] = $ret['pay_type'];
         $sdf['memo'] = $ret['memo'];
         $sdf['money'] = $ret['money'];
         $sdf['cur_money'] = $ret['cur_money'];
     }
     switch ($ret['status']) {
         case 'succ':
         case 'progress':
             if ($sdf && $sdf['status'] != 'succ') {
                 $isUpdatedPay = payment::update($ret, $msg);
                 if ($isUpdatedPay) {
                     $params['payment_id'] = $sdf['payment_id'];
                     $params['fields'] = 'status,payment_id';
                     try {
                         $paymentBill = app::get('ectools')->rpcCall('payment.bill.get', $params);
                     } catch (Exception $e) {
                         throw $e;
                     }
                     $db = app::get('ectools')->database();
                     $db->beginTransaction();
                     try {
                         if ($paymentBill['status'] == "succ" || $paymentBill['status'] == "progress") {
                             foreach ($paymentBill['trade'] as $value) {
                                 app::get('ectools')->rpcCall('trade.pay.finish', array('tid' => $value['tid'], 'payment' => $value['payment']));
                             }
                             $db->commit();
                         }
                     } catch (\Exception $e) {
                         $db->rollback();
                         throw $e;
                     }
                 }
                 //支付成功給支付網關顯示支付信息
                 if (method_exists($payments, 'ret_result')) {
                     $payments->ret_result($ret['payment_id']);
                 }
             }
             break;
         case 'REFUND_SUCCESS':
             // 退款成功操作
             if ($sdf) {
                 unset($sdf['payment_id']);
                 $obj_refund = app::get('ectools')->model('refund');
                 $sdf['refund_id'] = $obj_refund->gen_id();
                 $ret['status'] = 'succ';
                 if ($obj_refund->insert($sdf)) {
                     //處理單據的支付狀態
                     $obj_refund_finish = kernel::service("order.refund_finish");
                     $obj_refund_finish->order_refund_finish($sdf, $ret['status'], 'font', $msg);
                 }
//.........這裏部分代碼省略.........
開發者ID:453111208,項目名稱:bbc,代碼行數:101,代碼來源:api.php


注:本文中的payment::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。