diff --git a/src/Message/CompleteRefundRequest.php b/src/Message/CompleteRefundRequest.php index 3615a83..b378b2a 100644 --- a/src/Message/CompleteRefundRequest.php +++ b/src/Message/CompleteRefundRequest.php @@ -20,16 +20,22 @@ public function setRequestParams($requestParams) public function sendData($data) { $data = $this->getData(); - $sign = Helper::sign($data, $this->getApiKey()); $responseData = array(); - if (isset($data['sign']) && $data['sign'] && $sign === $data['sign']) { - $responseData['sign_match'] = true; + // 微信: 退款结果可能没有 sign 参数,解密通过即可 + if (isset($data['sign'])) { + $sign = Helper::sign($data, $this->getApiKey()); + + if ($data['sign'] && $sign === $data['sign']) { + $responseData['sign_match'] = true; + } else { + $responseData['sign_match'] = false; + } } else { - $responseData['sign_match'] = false; + $responseData['sign_match'] = true; } - + if ($responseData['sign_match'] && isset($data['refund_status']) && $data['refund_status'] == 'SUCCESS') { $responseData['refunded'] = true; } else { diff --git a/src/Message/RefundOrderRequest.php b/src/Message/RefundOrderRequest.php index 651ef2b..a3a1dbb 100644 --- a/src/Message/RefundOrderRequest.php +++ b/src/Message/RefundOrderRequest.php @@ -40,7 +40,8 @@ public function getData() 'out_refund_no' => $this->getOutRefundNo(), 'total_fee' => $this->getTotalFee(), 'refund_fee' => $this->getRefundFee(), - 'refund_fee_type' => $this->getRefundFee(),//<> + 'refund_fee_type' => $this->getRefundType(),//<> + 'notify_url' => $this->getNotifyUrl(), //* 'op_user_id' => $this->getOpUserId() ?: $this->getMchId(), 'refund_account' => $this->getRefundAccount(), 'nonce_str' => md5(uniqid()), @@ -202,6 +203,23 @@ public function getRefundType() } + /** + * @return mixed + */ + public function getNotifyUrl() + { + return $this->getParameter('notify_url'); + } + + + /** + * @param mixed $notifyUrl + */ + public function setNotifyUrl($notifyUrl) + { + $this->setParameter('notify_url', $notifyUrl); + } + /** * @param mixed $refundFeeType */