|
@@ -117,7 +117,32 @@ class NextDayRefundService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 解析隔天资金方式:挂账/余额强制返余额;在线可选原路/返余额/仅记账。
|
|
|
|
|
|
|
+ * 原单是否为微信/支付宝线上支付(隔天也可原路退回的前提)
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function isOnlinePayOrder($order)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (empty($order)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $payWay = intval($order->payWay ?? 0);
|
|
|
|
|
+ $onlinePay = intval($order->onlinePay ?? dict::getDict('onlinePay', 'not'));
|
|
|
|
|
+ $wxPay = dict::getDict('payWay', 'wxPay');
|
|
|
|
|
+ $aliPay = dict::getDict('payWay', 'alipay');
|
|
|
|
|
+ return $onlinePay == dict::getDict('onlinePay', 'yes')
|
|
|
|
|
+ && in_array($payWay, [$wxPay, $aliPay], true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 隔天售后未选手选资金时的默认值:线上默认原路,其它默认返余额。
|
|
|
|
|
+ * 最终仍须经 resolveFundType 收敛(挂账/余额强制返余额)。
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function defaultNextDayFundType($order)
|
|
|
|
|
+ {
|
|
|
|
|
+ return self::isOnlinePayOrder($order) ? self::FUND_ORIGINAL : self::FUND_BALANCE;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 解析隔天资金方式:挂账/余额强制返余额;线上可选原路/返余额/仅记账。
|
|
|
* $hasRelateOrder=false 表示无原单退款(工作台「退款」),不可原路退。
|
|
* $hasRelateOrder=false 表示无原单退款(工作台「退款」),不可原路退。
|
|
|
*/
|
|
*/
|
|
|
public static function resolveFundType($fundType, $order, $hasRelateOrder = true)
|
|
public static function resolveFundType($fundType, $order, $hasRelateOrder = true)
|
|
@@ -134,16 +159,14 @@ class NextDayRefundService
|
|
|
return $fundType;
|
|
return $fundType;
|
|
|
}
|
|
}
|
|
|
$payWay = intval($order->payWay ?? 0);
|
|
$payWay = intval($order->payWay ?? 0);
|
|
|
- $onlinePay = intval($order->onlinePay ?? dict::getDict('onlinePay', 'not'));
|
|
|
|
|
$debtPay = dict::getDict('payWay', 'debtPay');
|
|
$debtPay = dict::getDict('payWay', 'debtPay');
|
|
|
$balancePay = dict::getDict('payWay', 'balancePay');
|
|
$balancePay = dict::getDict('payWay', 'balancePay');
|
|
|
- $wxPay = dict::getDict('payWay', 'wxPay');
|
|
|
|
|
- $aliPay = dict::getDict('payWay', 'alipay');
|
|
|
|
|
- $isOnline = $onlinePay == dict::getDict('onlinePay', 'yes') && in_array($payWay, [$wxPay, $aliPay], true);
|
|
|
|
|
|
|
+ // 挂账/余额付款:隔天只能返余额
|
|
|
if ($payWay === $debtPay || $payWay === $balancePay) {
|
|
if ($payWay === $debtPay || $payWay === $balancePay) {
|
|
|
return self::FUND_BALANCE;
|
|
return self::FUND_BALANCE;
|
|
|
}
|
|
}
|
|
|
- if ($isOnline) {
|
|
|
|
|
|
|
+ // 线上付款:隔天也允许原路退回(与当天售后一致)
|
|
|
|
|
+ if (self::isOnlinePayOrder($order)) {
|
|
|
if (!in_array($fundType, [self::FUND_ORIGINAL, self::FUND_BALANCE, self::FUND_NONE], true)) {
|
|
if (!in_array($fundType, [self::FUND_ORIGINAL, self::FUND_BALANCE, self::FUND_NONE], true)) {
|
|
|
util::fail('请选择资金处理方式');
|
|
util::fail('请选择资金处理方式');
|
|
|
}
|
|
}
|