PaymentGateway

fun interface PaymentGateway

The payment gateway the payment context charges: an outside system, a domain service of PaymentGatewaySaga. The server binds one; the eShop has only the SimulatedPaymentGateway.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun charge(paymentId: String, amount: BigDecimal, description: String, idempotencyKey: String): GatewayOutcome

Charges amount for the payment paymentId, for what description says (the buyer's statement line). A gateway charges once per idempotencyKey: the saga's execution, the same each time it handles the same commit, so a retried charge is not charged twice.