fix: fix floating point precision error
This commit is contained in:
@@ -89,9 +89,9 @@ class Step3Controller extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
// Validate price match (exact comparison)
|
||||
$apiTotal = $inquiryResponse->totalPrice ?? 0.0;
|
||||
$calculatedTotal = $this->priceCalculator->calculateGrandTotal($bookingCreateDto);
|
||||
// Validate price match (rounded to cent precision to avoid floating-point errors)
|
||||
$apiTotal = round($inquiryResponse->totalPrice ?? 0.0, 2);
|
||||
$calculatedTotal = round($this->priceCalculator->calculateGrandTotal($bookingCreateDto), 2);
|
||||
|
||||
if ($apiTotal !== $calculatedTotal) {
|
||||
return $this->handleApiError(
|
||||
|
||||
Reference in New Issue
Block a user