From 3b53ea1b993e296d5a84907d92acbee0909fc3df Mon Sep 17 00:00:00 2001 From: Edmond Teh Date: Tue, 29 Sep 2020 12:23:37 +0800 Subject: [PATCH] fixed compare double values validation --- app/Http/Controllers/InvoiceController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 6e0d8c83..35e48d5f 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -100,7 +100,7 @@ class InvoiceController extends Controller $billing_charges = $booking->billing_charge; $total = $subtotal + $adjustment + $billing_charges; - if ($total !== $booking->bia) { + if (abs($total-$booking->bia) < PHP_FLOAT_EPSILON) { return response()->json([ 'message' => 'Booking amount expected is '.$booking->bia.'. Your Invoice amount is '.$total ], 400); @@ -227,7 +227,7 @@ class InvoiceController extends Controller $billing_charges = $booking->billing_charge; $total = $subtotal + $adjustment + $billing_charges; - if ($total !== $booking->bia) { + if (abs($total-$booking->bia) < PHP_FLOAT_EPSILON) { return response()->json([ 'message' => 'Booking amount expected is '.$booking->bia.'. Your Invoice amount is '.$total ], 400);