本文整理汇总了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;
}
}