Class CheckoutService
java.lang.Object
springboot.bg.harisauto.payment.service.CheckoutService
CheckoutService.java - Turns a pending booking into a booking and a paid invoice.
Extracted from PaymentController so the production checkout flow and the
dev-only simulation endpoint can share it without the simulation living in a controller
that is registered in every environment.
- Author:
- Kristian Popov
-
Constructor Summary
ConstructorsConstructorDescriptionCheckoutService(ShoppingCart shoppingCart, BookingService bookingService, InvoiceService invoiceService, UserService userService, VehicleService vehicleService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncompleteBooking(PendingBookingSessionRequest pending, InvoiceStatus status, String paymentReference) Creates the booking and its invoice for a pending checkout.Creates the booking and a PAID invoice.
-
Constructor Details
-
CheckoutService
public CheckoutService(ShoppingCart shoppingCart, BookingService bookingService, InvoiceService invoiceService, UserService userService, VehicleService vehicleService) Constructor.
-
-
Method Details
-
completePaidBooking
Creates the booking and a PAID invoice. Used by the dev simulation only.- Parameters:
pending- The booking held in the session.- Returns:
- The generated invoice.
-
completeBooking
public Invoice completeBooking(PendingBookingSessionRequest pending, InvoiceStatus status, String paymentReference) Creates the booking and its invoice for a pending checkout.- Parameters:
pending- The booking held in the session.status- The invoice status the caller has established.paymentReference- The payment intent id, when one is known.- Returns:
- The generated invoice.
-