Kaizen
Browse modulesCheckoutcheckout/serverClasses

Class: PaymentProviderRegistry

Defined in: server/checkout/provider-registry.ts:46

Maps provider key → adapter instance for the checkout domain.

A payment row's provider column is the lookup key used by PaymentService to dispatch tender operations to the correct adapter at runtime (stage-5) and by the webhook router (stage-8).

Registration invariants (enforced at register time, not at call time)

  1. Duplicate keys are a wiring bug. Re-registering a key throws a plain Error immediately — fail fast at factory init rather than silently shadowing the previous adapter.

  2. Poll/postback rails MUST declare a recovery path. Validation covers both the default capability bag and every declared tender method. Absent fetchPaymentState, registration throws UnsupportedCapabilityError; postback can explicitly opt out by passing { acceptUnverifiedPostbacks: true } to acknowledge the risk (proposal §The PaymentProvider port, bullet 1).

The gate is re-run by the checkout factory in case a mutable adapter changes between registration and composition.

Constructors

Constructor

new PaymentProviderRegistry(): PaymentProviderRegistry;

Returns

PaymentProviderRegistry

Methods

get()

get(key: string): PaymentProvider;

Defined in: server/checkout/provider-registry.ts:95

Retrieve a registered provider by its key.

Parameters

ParameterType
keystring

Returns

PaymentProvider

Throws

CheckoutNotFoundError (entity "PaymentProvider") when no provider with key has been registered.


register()

register(provider: PaymentProvider, opts?: RegisterOptions): void;

Defined in: server/checkout/provider-registry.ts:57

Register a payment provider adapter.

Parameters

ParameterType
providerPaymentProvider
opts?RegisterOptions

Returns

void

Throws

Error if the provider's key is already registered.

Throws

UnsupportedCapabilityError if a poll or non-opted-out postback rail lacks fetchPaymentState.


validateRegistrations()

validateRegistrations(): void;

Defined in: server/checkout/provider-registry.ts:80

Re-run registration invariants at composition time. This catches mutable adapters and validates every method-specific rail, not only the provider's default capability bag.

Returns

void

On this page