WalletGateway

class WalletGateway(config: WalletConfig, httpClient: HttpClient, apiConfig: PaymentApiConfig) : PaymentGateway

Archetype-E ("internal rail"): a PaymentGateway backed by the consumer's own double-entry ledger server — no external SDK, no WebView, no 3DS/webhook. prepare pre-flight-checks the wallet balance (server round-trip, per the interface contract); pay posts the debit idempotently and reports the ledger txn as the payment id.

Refund is deliberately NOT on this class or on PaymentGateway — the base interface has no refund method by design, so a reversing credit is exposed only at the ledger layer (POST /wallet/{accountId}/refund, see HttpWalletLedgerPort), not bolted onto this gateway's shape.

Constructors

Link copied to clipboard
constructor(config: WalletConfig, httpClient: HttpClient, apiConfig: PaymentApiConfig)

Properties

Link copied to clipboard
open override val id: GatewayId
Link copied to clipboard
open override val meta: GatewayMeta

Functions

Link copied to clipboard
open suspend override fun pay(host: PaymentHost, prepared: PreparedPayment): PaymentResult

Posts the debit idempotently, keyed off the order id — replaying never double-charges.

Link copied to clipboard
open suspend override fun prepare(created: CreatedOrder): PreparedPayment

Pre-flight balance check — the showcase's "balance race" story starts here.