feat: extended price mismatch diagnostics in logs
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Form\BookingCreateStep3Type;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\BookingPriceMismatchDiagnosticsService;
|
||||
use App\Service\BookingService;
|
||||
use App\Service\BookingSummaryDataService;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@@ -36,6 +37,7 @@ class Step3Controller extends AbstractController
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculator,
|
||||
private readonly BookingPriceMismatchDiagnosticsService $priceMismatchDiagnostics,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
@@ -126,6 +128,9 @@ class Step3Controller extends AbstractController
|
||||
$expectedTotal = round($calculatedSubtotal - $promoGoodwillDiscount - $apiAppliedDiscount, 2);
|
||||
|
||||
if ((int) round($apiTotal * 100) !== (int) round($expectedTotal * 100)) {
|
||||
$diagnostics = $this->priceMismatchDiagnostics->buildDiagnostics($bookingCreateDto, $inquiryResponse);
|
||||
$deltaBreakdown = $diagnostics['deltaBreakdown'] ?? [];
|
||||
|
||||
return $this->handleApiError(
|
||||
'Price mismatch detected - payload incomplete',
|
||||
[
|
||||
@@ -135,6 +140,11 @@ class Step3Controller extends AbstractController
|
||||
'apiAppliedDiscount' => $apiAppliedDiscount,
|
||||
'expectedTotal' => $expectedTotal,
|
||||
'difference' => abs($apiTotal - $expectedTotal),
|
||||
'deltaTotal' => $deltaBreakdown['deltaTotal'] ?? null,
|
||||
'deltaRoom' => $deltaBreakdown['deltaRoom'] ?? null,
|
||||
'deltaService' => $deltaBreakdown['deltaService'] ?? null,
|
||||
'deltaInsurance' => $deltaBreakdown['deltaInsurance'] ?? null,
|
||||
'diagnostics' => $diagnostics,
|
||||
],
|
||||
'Preisabweichung festgestellt. Bitte wende dich an den Kundenservice.',
|
||||
$bookingCreateDto,
|
||||
|
||||
Reference in New Issue
Block a user