[更新]修改微信账单下载

This commit is contained in:
Anyon 2018-05-16 13:48:16 +08:00
parent a3b3b4b1c1
commit f01ac5dafc

View File

@ -202,14 +202,23 @@ class Pay
/**
* 下载对账单
* @param array $options
* @return array
* @param array $options 静音参数
* @param null|string $outType 输出类型
* @return bool|string
* @throws InvalidResponseException
*/
public function billDownload(array $options)
public function billDownload(array $options, $outType = null)
{
$url = 'https://api.mch.weixin.qq.com/pay/downloadbill';
return $this->callPostApi($url, $options);
$this->params->set('sign_type', 'MD5');
$params = $this->params->merge($options);
$params['sign'] = $this->getPaySign($params, 'MD5');
$result = Tools::post('https://api.mch.weixin.qq.com/pay/downloadbill', Tools::arr2xml($params));
if (($jsonData = Tools::xml2arr($result))) {
if ($jsonData['return_code'] !== 'SUCCESS') {
throw new InvalidResponseException($jsonData['return_msg'], '0');
}
}
return is_null($outType) ? $result : $outType($result);
}