Class CheckoutService

java.lang.Object
springboot.bg.harisauto.payment.service.CheckoutService

@Service public class CheckoutService extends Object
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 Details

  • Method Details

    • completePaidBooking

      public Invoice completePaidBooking(PendingBookingSessionRequest pending)
      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.