统一退款不一致(refund_inconsistent)口径:引入 amounts.tolerance 并对齐模型与筛选

This commit is contained in:
萝卜
2026-03-13 15:51:26 +00:00
parent b0ee9b6290
commit 6f1b894b45
10 changed files with 128 additions and 30 deletions

View File

@@ -96,10 +96,12 @@ class PlatformOrderRefundInconsistentTest extends TestCase
],
]);
// refunded 状态下:只有当退款总额 + 容差 < 已付金额 才算不一致。
// 这里 refund_total=9.98、paid=10.00,差额 0.02 > 默认容差 0.01,因此应判定为不一致。
$this->assertTrue($order->isRefundInconsistent());
}
public function test_is_refund_inconsistent_when_status_not_refunded_but_refund_total_reaches_paid_amount(): void
public function test_is_refund_inconsistent_when_status_not_refunded_but_refund_total_reaches_paid_amount_plus_tolerance(): void
{
$merchant = Merchant::query()->create([
'name' => '单测站点3',
@@ -139,6 +141,8 @@ class PlatformOrderRefundInconsistentTest extends TestCase
],
]);
$this->assertTrue($order->isRefundInconsistent());
// paid非 refunded状态下只有当退款总额 >= 已付金额 + 容差 才算不一致。
// 这里 refund_total=10.00 与 paid=10.00 相等,未达到 paid + 0.01,因此不应判定不一致。
$this->assertFalse($order->isRefundInconsistent());
}
}