平台订单详情:退款治理区块按 amounts.tolerance 口径触发并修复测试
This commit is contained in:
@@ -68,16 +68,20 @@
|
|||||||
@php
|
@php
|
||||||
$paidAmountFloat = (float) ($order->paid_amount ?? 0);
|
$paidAmountFloat = (float) ($order->paid_amount ?? 0);
|
||||||
|
|
||||||
|
$tol = (float) config('saasshop.amounts.tolerance', 0.01);
|
||||||
|
$tolCents = (int) round($tol * 100);
|
||||||
|
$tolCents = max(1, $tolCents);
|
||||||
|
|
||||||
// 若订单疑似退款不一致:
|
// 若订单疑似退款不一致:
|
||||||
// - 非 refunded 但退款总额已达/超已付 => 给出“可一键标记为已退款”的治理动作(不自动写回执)
|
// - 非 refunded 但退款总额已达/超已付 + 容差 => 给出“可一键标记为已退款”的治理动作(不自动写回执)
|
||||||
$canMarkRefunded = $paidAmountFloat > 0
|
$canMarkRefunded = $paidAmountFloat > 0
|
||||||
&& $order->payment_status !== 'refunded'
|
&& $order->payment_status !== 'refunded'
|
||||||
&& round($refundTotal * 100) >= round($paidAmountFloat * 100);
|
&& round($refundTotal * 100) >= (round($paidAmountFloat * 100) + $tolCents);
|
||||||
|
|
||||||
// - refunded 但退款总额不足 => 提供降级动作:标记为部分退款/已支付(仍不自动写回执)
|
// - refunded 但退款总额 + 容差 < 已付 => 提供降级动作:标记为部分退款/已支付(仍不自动写回执)
|
||||||
$canFixRefundedButNotEnough = $paidAmountFloat > 0
|
$canFixRefundedButNotEnough = $paidAmountFloat > 0
|
||||||
&& $order->payment_status === 'refunded'
|
&& $order->payment_status === 'refunded'
|
||||||
&& (round($refundTotal * 100) + 1) < round($paidAmountFloat * 100);
|
&& (round($refundTotal * 100) + $tolCents) < round($paidAmountFloat * 100);
|
||||||
|
|
||||||
// 统一口径:与 refund_inconsistent 筛选一致(模型方法)
|
// 统一口径:与 refund_inconsistent 筛选一致(模型方法)
|
||||||
$isRefundInconsistent = (bool) $order->isRefundInconsistent();
|
$isRefundInconsistent = (bool) $order->isRefundInconsistent();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockLinkTest extends TestCase
|
|||||||
'meta' => [
|
'meta' => [
|
||||||
'refund_summary' => [
|
'refund_summary' => [
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'total_amount' => 10.00,
|
'total_amount' => 10.01,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockNoteTest extends TestCase
|
|||||||
'meta' => [
|
'meta' => [
|
||||||
'refund_summary' => [
|
'refund_summary' => [
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'total_amount' => 10.00,
|
'total_amount' => 10.01,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class AdminPlatformOrderShowRefundGovernanceBlockTest extends TestCase
|
|||||||
'meta' => [
|
'meta' => [
|
||||||
'refund_summary' => [
|
'refund_summary' => [
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'total_amount' => 10.00,
|
'total_amount' => 10.01,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user