From 49c42268720dc50e3fd1cc28658dcc93e9657f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 21:10:26 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E6=98=8E=E7=BB=86=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=EF=BC=9A=E6=91=98=E8=A6=81=E5=A2=9E=E5=8A=A0=20amount?= =?UTF-8?q?=5Ftolerance=20=E5=AE=B9=E5=B7=AE=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/PlatformOrderController.php | 3 +++ tests/Feature/AdminPlatformOrderExportLedgerTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index 83c167c..ca40fa0 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -469,9 +469,12 @@ class PlatformOrderController extends Controller } $delta = $receiptTotal - (float) ($order->paid_amount ?? 0); + $tol = (float) config('saasshop.amounts.tolerance', 0.01); + fputcsv($out, ['receipt_total', number_format($receiptTotal, 2, '.', '')]); fputcsv($out, ['refund_total', number_format($refundTotal, 2, '.', '')]); fputcsv($out, ['reconcile_delta', number_format($delta, 2, '.', '')]); + fputcsv($out, ['amount_tolerance', number_format($tol, 2, '.', '')]); fputcsv($out, ['placed_at', (string) (optional($order->placed_at)->format('Y-m-d H:i:s') ?? '')]); fputcsv($out, ['paid_at', (string) (optional($order->paid_at)->format('Y-m-d H:i:s') ?? '')]); diff --git a/tests/Feature/AdminPlatformOrderExportLedgerTest.php b/tests/Feature/AdminPlatformOrderExportLedgerTest.php index 4a67bba..b0e3c72 100644 --- a/tests/Feature/AdminPlatformOrderExportLedgerTest.php +++ b/tests/Feature/AdminPlatformOrderExportLedgerTest.php @@ -113,6 +113,7 @@ class AdminPlatformOrderExportLedgerTest extends TestCase $this->assertStringContainsString('receipt_total,10.00', $content2); $this->assertStringContainsString('refund_total,1.00', $content2); $this->assertStringContainsString('reconcile_delta,10.00', $content2); + $this->assertStringContainsString('amount_tolerance,0.01', $content2); } public function test_show_page_should_render_export_ledger_link(): void