Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/Message/CompleteRefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 19 additions & 1 deletion src/Message/RefundOrderRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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
*/
Expand Down