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


PHP AlipaySubmit::buildRequestHttpGet方法代碼示例

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


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

示例1: refund

 /**
  * Comment.
  */
 public function refund($orderId, $request)
 {
     require_once dirname(__FILE__) . '/Alipay/alipay.config.php';
     require_once dirname(__FILE__) . '/Alipay/lib/alipay_submit.class.php';
     $refundRequest = $this->refundRequest($orderId, $request);
     //Refund no
     $out_return_no = $refundRequest['returnId'];
     //required
     //Old Partner transaction ID
     $out_trade_no = $refundRequest['orderId'];
     //required
     //Refund sum
     $return_amount = $refundRequest['returnAmount'];
     //required
     //Currency
     $currency = $refundRequest['returnCurrency'];
     //Refer to abbreviation of currencies
     date_default_timezone_set('PRC');
     //Refund Transaction time
     $gmt_return = date('YmdHis');
     //YYYYMMDDHHMMSS Beijing Time
     //Reason for refundament
     $reason = $refundRequest['returnReason'];
     //required
     /************************************************************/
     //構造要請求的參數數組,無需改動
     $parameter = array('service' => 'forex_refund', 'partner' => trim($alipay_config['partner']), 'out_return_no' => $out_return_no, 'out_trade_no' => $out_trade_no, 'return_amount' => $return_amount, 'currency' => $currency, 'gmt_return' => $gmt_return, 'reason' => $reason, '_input_charset' => trim(strtolower($alipay_config['input_charset'])));
     //建立請求
     $alipaySubmit = new \AlipaySubmit($alipay_config);
     // $html_text = $alipaySubmit->buildRequestForm($parameter, "get", "確認");
     $html_text = $alipaySubmit->buildRequestHttpGet($parameter);
     // echo $html_text;
     $doc = new \DOMDocument();
     $doc->loadXML($html_text);
     if (!empty($doc->getElementsByTagName('alipay')->item(0)->nodeValue)) {
         $alipay = $doc->getElementsByTagName('alipay')->item(0)->nodeValue;
         if ($alipay == 'T') {
             // confirm refund here, change the order status
             $this->updateOrderStatus('8', $out_trade_no);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
開發者ID:leonlianght,項目名稱:AlwaysRejoice,代碼行數:50,代碼來源:AlipayService.php


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