1
0
mirror of https://gitee.com/zoujingli/WeChatDeveloper.git synced 2025-04-06 03:58:03 +08:00

WechatPayV3和Alipay支付回调应支持外部传入参数

This commit is contained in:
voilaf 2022-11-02 15:47:25 +08:00
parent 14932d9095
commit bcf7cceb91
2 changed files with 13 additions and 5 deletions
WeChat/Contracts
WePayV3

@ -150,13 +150,16 @@ abstract class BasicAliPay
/**
* 获取通知数据
*
* @param boolean $needSignType 是否需要sign_type字段
* @param array $parameters
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
*/
public function notify($needSignType = false)
public function notify($needSignType = false, array $parameters = [])
{
$data = $_POST;
$data = empty($parameters) ? $_POST : $parameters;
if (empty($data) || empty($data['sign'])) {
throw new InvalidResponseException('Illegal push request.', 0, $data);
}

@ -86,10 +86,15 @@ class Order extends BasicWePay
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
*/
public function notify()
public function notify(array $parameters = [])
{
$body = file_get_contents('php://input');
$data = json_decode($body, true);
if (empty($parameters)) {
$body = file_get_contents('php://input');
$data = json_decode($body, true);
} else {
$data = $parameters;
}
if (isset($data['resource'])) {
$aes = new DecryptAes($this->config['mch_v3_key']);
$data['result'] = $aes->decryptToString(