|
|
@@ -72,26 +72,27 @@ trait ApiTrait
|
|
|
* 退款申请
|
|
|
*
|
|
|
* @param string $outRefundNo 商户退款单号
|
|
|
- * @param string $outTradeNo 商户订单号
|
|
|
- * @param array $amount 退款金额信息
|
|
|
- * @param string $reason 退款原因
|
|
|
- * @return mixed
|
|
|
*/
|
|
|
- private function domesticRefunds(string $outRefundNo, string $outTradeNo, array $amount, string $reason)
|
|
|
+ private function domesticRefunds(string $outRefundNo, string $outTradeNo, float $refund, float $total = null, string $reason = '交易取消')
|
|
|
{
|
|
|
+ $total = $total ?? $refund;
|
|
|
// https://pay.weixin.qq.com/doc/v3/merchant/4012791862
|
|
|
// 【POST】/v3/refund/domestic/refunds
|
|
|
- return $this->handleAsyncRequest(function (BuilderChainable $builder, Config $config) use ($outRefundNo, $outTradeNo, $amount, $reason): PromiseInterface {
|
|
|
+ return $this->handleAsyncRequest(function (BuilderChainable $builder, Config $config, $outRefundNo, $outTradeNo, $refund, $total, $reason) : PromiseInterface {
|
|
|
return $builder->v3->refund->domestic->refunds->postAsync([
|
|
|
'json' => [
|
|
|
'out_refund_no' => $outRefundNo,
|
|
|
'out_trade_no' => $outTradeNo,
|
|
|
'reason' => $reason,
|
|
|
- 'amount' => $amount,
|
|
|
- 'notify_url' => $config->notifyUrl
|
|
|
+ 'amount' => [
|
|
|
+ 'refund' => (int)($refund * 100),
|
|
|
+ 'total' => (int)($total * 100),
|
|
|
+ 'currency' => 'CNY'
|
|
|
+ ],
|
|
|
+ 'notify_url' => $config->refund_notify_url
|
|
|
]
|
|
|
]);
|
|
|
- });
|
|
|
+ }, $outRefundNo, $outTradeNo, $refund, $total, $reason);
|
|
|
}
|
|
|
|
|
|
/**
|