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


PHP AlipaySubmit::buildRequestUrl方法代碼示例

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


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

示例1: getRequestUrl

 public function getRequestUrl($orderId, $returnUrl, $notifyUrl)
 {
     // 參數驗證
     $validator = new Validator(array('orderId' => $orderId, 'returnUrl' => $returnUrl, 'notifyUrl' => $notifyUrl));
     $orderId = $validator->required()->digits()->min(1)->validate('orderId');
     $returnUrl = $validator->required()->validate('returnUrl');
     $notifyUrl = $validator->required()->validate('notifyUrl');
     $this->validate($validator);
     //設置訂單 ID
     $this->orderId = $orderId;
     // 取得訂單
     $orderBasicService = new OrderBasicService();
     $orderInfo = $orderBasicService->loadOrderInfoById($orderId);
     if (empty($orderInfo) || $orderInfo->isEmpty()) {
         throw new \InvalidArgumentException('invalid order_id [' . $orderId . ']');
     }
     $desc = $orderInfo['order_id'] . '|' . Money::toSmartyDisplay($orderInfo['order_amount']) . '|' . $orderInfo['system_id'];
     //構造要請求的參數數組,無需改動
     $parameter = array("service" => "create_direct_pay_by_user", "partner" => $this->partnerId, "payment_type" => 1, "notify_url" => $notifyUrl, "return_url" => $returnUrl, "seller_email" => $this->account, "out_trade_no" => $orderInfo['order_sn'] . '_' . $orderInfo['order_id'], "subject" => $desc, "total_fee" => Money::toDisplay($orderInfo['order_amount'], 2), "body" => $desc, "show_url" => '', "anti_phishing_key" => '', "exter_invoke_ip" => '', "_input_charset" => 'utf-8');
     //建立請求
     $alipaySubmit = new AlipaySubmit($this->alipayConfig);
     return $alipaySubmit->buildRequestUrl($parameter);
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:23,代碼來源:Gateway.php


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