本文整理匯總了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;
}
}