当前位置: 首页>>代码示例>>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;未经允许,请勿转载。