Kaizen
Browse modulesBookingsbookings/serverInterfaces

Interface: PaymentPort

Defined in: server/bookings/deps.ts:49

PAYMENT SEAM — minimal by design. TODO(cart/order/checkout): the future orders module implements this adapter. TODO: Stripe auth-and-capture maps 1:1 onto the booking machine: onHold → create PaymentIntent(capture_method=manual) [authorize] onConfirm → capture onCancel/onExpire → cancel authorization / refund per policy onComplete → finalize / revenue recognition TODO: an Invoice entity (invoice_sent_at is already a timeline event) keyed by bookingId. TODO: installment / deferred-payment plans (deferred_payment_promised is a timeline event). The booking NEVER stores canonical money — only amountOwedCents (a quote) + paid:boolean.

DISPATCH TIMING: these methods are called by event-dispatcher.ts AFTER the state transition commits (§8.1) — NEVER awaited inside the transition's transaction. A transition enqueues a *_due outbox row; the dispatcher reads it post-commit, calls the port, and on success appends the past-tense event + sets dispatched_at. So a port is allowed to be slow or to fail and retry without ever rolling back a committed booking or capturing money against a booking that doesn't exist. EXCEPTION: quoteAmount IS awaited inside the create transaction — terms-pin (§8.3) must snapshot the quote atomically with the booking row, so it's the one deliberate carve-out from the rule above. Keep it fast and side-effect-free.

Properties

onCancel?

optional onCancel?: BookingEffectHandler;

Defined in: server/bookings/deps.ts:59


onComplete?

optional onComplete?: BookingEffectHandler;

Defined in: server/bookings/deps.ts:60


onConfirm?

optional onConfirm?: BookingEffectHandler;

Defined in: server/bookings/deps.ts:58


onHold?

optional onHold?: BookingEffectHandler;

Defined in: server/bookings/deps.ts:57

Methods

quoteAmount()?

optional quoteAmount(booking: BookingCore): Promise<
  | {
  amountCents: number;
  currency: string;
}
| null>;

Defined in: server/bookings/deps.ts:54

Quote owed amount at terms-pin. Return null to fall through to the built-in rules-engine evaluation for this booking.

Parameters

ParameterType
bookingBookingCore

Returns

Promise< | { amountCents: number; currency: string; } | null>

On this page