platform orders: bmpa receipt mismatch safety valve uses configured tolerance

This commit is contained in:
萝卜
2026-03-13 13:37:32 +00:00
parent 372f78b4d1
commit 5343a210b0
2 changed files with 98 additions and 1 deletions

View File

@@ -1240,7 +1240,11 @@ class PlatformOrderController extends Controller
$receiptCents = (int) round($receiptTotal * 100);
$expectedCents = (int) round($expectedPaid * 100);
if (abs($receiptCents - $expectedCents) >= 1) {
$tol = (float) config('saasshop.amounts.tolerance', 0.01);
$tolCents = (int) round($tol * 100);
$tolCents = max(1, $tolCents);
if (abs($receiptCents - $expectedCents) >= $tolCents) {
throw new \InvalidArgumentException('订单回执总额与应付金额不一致,不允许批量推进,请先修正回执/金额后再处理。');
}
}