```
feat(shopro_huifu): 添加分账配置提交功能和接收方绑定机制 - 实现 shouldDeferWalletUntilGatewaySplitResolves 方法,确保分销/区域结算事件早于 split_timing 时等待分账结束再入钱包 - 新增 SyncSplitReceivers 命令用于提交商户分账配置并绑定已审核通过的汇付号为分账接收方 - 扩展 HuifuClient 添加 submitMerchantSplitConfig 接口实现 v2/merchant/split/config 调用 - 创建 HuifuMerchantSplitService 处理主商户分账配置提交和进件子户绑定为分账接收方逻辑 - 在进件成功后自动调用 split/config 接口绑定分账接收方 - 添加数据库表结构升级脚本,增加分账绑定状态相关字段 - 注册新的命令行工具到应用配置中 ```
这个提交包含在:
@@ -22,20 +22,52 @@ class SplitWalletSettlement
|
||||
{
|
||||
public static function shouldDeferCommissionWallet($order, $event)
|
||||
{
|
||||
if (!self::shouldDeferForGatewaySplit($order, $event)) {
|
||||
$commissionEvent = (new CommissionConfig())->getCommissionEvent();
|
||||
if ($commissionEvent !== $event && $event !== 'admin') {
|
||||
return false;
|
||||
}
|
||||
$commissionEvent = (new CommissionConfig())->getCommissionEvent();
|
||||
return $commissionEvent === $event;
|
||||
return self::shouldDeferWalletUntilGatewaySplitResolves($order);
|
||||
}
|
||||
|
||||
public static function shouldDeferRegionalWallet($order, $event)
|
||||
{
|
||||
if (!self::shouldDeferForGatewaySplit($order, $event)) {
|
||||
$regionalEvent = (new RegionalConfig())->getCommissionEvent();
|
||||
if ($regionalEvent !== $event && $event !== 'admin') {
|
||||
return false;
|
||||
}
|
||||
$regionalEvent = (new RegionalConfig())->getCommissionEvent();
|
||||
return $regionalEvent === $event;
|
||||
return self::shouldDeferWalletUntilGatewaySplitResolves($order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销/区域结算事件(如 payed)早于 split_timing(如 confirm)时,仍应等分账结束再入钱包
|
||||
*/
|
||||
protected static function shouldDeferWalletUntilGatewaySplitResolves($order)
|
||||
{
|
||||
if (is_numeric($order)) {
|
||||
$order = Order::get($order);
|
||||
}
|
||||
if (!$order) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = new Config();
|
||||
if (!$config->isEnable() || !$config->shouldSkipWallet()) {
|
||||
return false;
|
||||
}
|
||||
if (self::isSplitSuccessful($order['id'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (class_exists('\\addons\\shopro_huifu\\library\\Bridge')
|
||||
&& \addons\shopro_huifu\library\Bridge::shouldHandleSplit($order)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (in_array($config->getMode(), ['wechat', 'both'], true) && $order['pay_type'] === 'wechat') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户