```
feat(shopro): 实现汇付混合分账功能支持按人区分通道和钱包结算 - 新增汇付延时分账混合模式:已进件用户走支付通道,未进件用户入钱包 - 添加 shouldSettleHuifuPerReceiver 方法判断是否使用混合结算 - 实现 settleOrderHybridHuifuGatewayAndWallet 方法处理混合分账逻辑 - 新增 collectGatewaySplitUserIds 方法收集分账用户ID列表 - 添加 markCommissionOrderSettledIfDone 和 markRegionalOrderSettledIfDone 辅助方法 fix(shopro_huifu): 优化延时分账确认前置拦截逻辑 - 修复 getDelayTransBlockReason 方法参数传递问题 - 新增 getNonDelayAcctBlockReason 方法检查交易非延迟入账状态 - 添加 2300004 错误码拦截实时入账交易的延迟分账操作 docs(shopro_wechat_trade): 更新命令行工具文档 - 添加 resync-shipping 命令用于重新同步指定订单的配送信息 - 更新重传说明文档,明确 retry-failed 不会重试已成功的记录 ```
这个提交包含在:
@@ -68,7 +68,7 @@ class HuifuSplitService
|
||||
|
||||
$outOrderNo = 'HFPS' . date('YmdHis') . $orderId;
|
||||
$ext = HuifuPayService::getPayExt($orderId);
|
||||
$blockReason = $this->getDelayFundsBlockReason($order['order_sn']);
|
||||
$blockReason = $this->getDelayTransBlockReason($order['order_sn'], $orderId);
|
||||
if ($blockReason !== null) {
|
||||
$this->markFailed($orderId, $outOrderNo, $order, $items, $blockReason);
|
||||
return false;
|
||||
@@ -298,10 +298,47 @@ class HuifuSplitService
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序 + 延时分账:通道侧资金可能处于 FREEZE,需发货/确认收货或等待解冻后才能 delaytrans/confirm。
|
||||
* 延时分账 confirm 前置拦截(非延迟入账 / 微信 FREEZE)
|
||||
*
|
||||
* @return string|null 不可 confirm 时返回说明文案,否则 null
|
||||
*/
|
||||
protected function getDelayTransBlockReason($orderSn, $orderId)
|
||||
{
|
||||
$nonDelay = $this->getNonDelayAcctBlockReason($orderSn, $orderId);
|
||||
if ($nonDelay !== null) {
|
||||
return $nonDelay;
|
||||
}
|
||||
return $this->getDelayFundsBlockReason($orderSn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 23000004「交易非延迟入账」:支付时未带 delay_acct_flag=Y,不能调 delaytrans/confirm
|
||||
*/
|
||||
protected function getNonDelayAcctBlockReason($orderSn, $orderId)
|
||||
{
|
||||
$ext = HuifuPayService::getPayExt($orderId);
|
||||
$local = strtoupper(trim((string) ($ext['delay_acct_flag'] ?? '')));
|
||||
if ($local === 'N') {
|
||||
return '该笔支付为实时入账(delay_acct_flag=N),不支持 delaytrans/confirm(23000004 交易非延迟入账)。'
|
||||
. '请在分账配置开启「延时分账」后重新下单;历史订单无法补打延迟标记,勿反复重试分账。';
|
||||
}
|
||||
|
||||
try {
|
||||
$query = (new HuifuQueryService())->queryByOrderSn($orderSn);
|
||||
} catch (\Throwable $e) {
|
||||
return null;
|
||||
}
|
||||
$remote = strtoupper(trim((string) ($this->queryFieldRecursive($query, 'delay_acct_flag') ?? '')));
|
||||
if ($remote !== '' && $remote !== 'Y') {
|
||||
return '汇付查单 delay_acct_flag=' . $remote . '(非延迟入账),不能延时分账确认(23000004)。'
|
||||
. ' 请核对下单是否 setDelayAcctFlag(Y)、商户 delay_flag 是否开通。';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序 + 延时分账:通道侧资金可能处于 FREEZE,需发货/确认收货或等待解冻后才能 delaytrans/confirm。
|
||||
*/
|
||||
protected function getDelayFundsBlockReason($orderSn)
|
||||
{
|
||||
try {
|
||||
|
||||
在新工单中引用
屏蔽一个用户