mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 14:01:07 +00:00
退款接口错误返回
This commit is contained in:
parent
4c42203697
commit
f1c80f0552
@ -14,6 +14,7 @@
|
||||
namespace crmeb\services\pay\storage;
|
||||
|
||||
use app\services\pay\PayServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\exceptions\PayException;
|
||||
use crmeb\services\pay\BasePay;
|
||||
use crmeb\services\pay\PayInterface;
|
||||
@ -115,7 +116,8 @@ class AllinPay extends BasePay implements PayInterface
|
||||
*/
|
||||
public function refund(string $outTradeNo, array $options = [])
|
||||
{
|
||||
return $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo);
|
||||
$result = $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo);
|
||||
if ($result['retcode'] != 'SUCCESS') throw new AdminException($result['retmsg']);
|
||||
}
|
||||
|
||||
public function queryRefund(string $outTradeNo, string $outRequestNo, array $other = [])
|
||||
|
||||
@ -103,18 +103,22 @@ class WechatPay extends BasePay implements PayInterface
|
||||
$refundNo = $opt['refund_id'] ?? $outTradeNo;
|
||||
$opUserId = $opt['op_user_id'] ?? null;
|
||||
$type = $opt['type'] ?? 'out_trade_no';
|
||||
/*仅针对老资金流商户使用
|
||||
REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款)
|
||||
REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款
|
||||
*/
|
||||
/**
|
||||
* 仅针对老资金流商户使用
|
||||
* REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款)
|
||||
* REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款
|
||||
*/
|
||||
$refundAccount = $opt['refund_account'] ?? 'REFUND_SOURCE_UNSETTLED_FUNDS';
|
||||
if (isset($opt['wechat'])) {
|
||||
return WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
|
||||
$result = WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
|
||||
if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']);
|
||||
} else {
|
||||
if ($opt['pay_new_weixin_open']) {
|
||||
return MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt);
|
||||
$result = MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt);
|
||||
if ($result['errcode'] != 0) throw new AdminException($result['errmsg']);
|
||||
} else {
|
||||
return MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
|
||||
$result = MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
|
||||
if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user