fix: fix floating point precision error

This commit is contained in:
Björn Fromme committed 2026-03-16 11:59:11 +01:00
1 parent 2403f8fb29
commit 7d6a80eefa
2 files changed
+40 -3

No files matched your search

@@ -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(