fixed compare double values validation

This commit is contained in:
Edmond Teh
2020-09-29 12:23:37 +08:00
parent 014ca6768c
commit 3b53ea1b99
+2 -2
View File
@@ -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);