Package-level declarations

Types

Link copied to clipboard
@MountedCommand(aggregate = "payment", transformsTo = [RefundPayment::class])
data class ChargebackNotified(val merchantReference: String, val disputeId: String, val reason: String)

The payment gateway's chargeback callback, in the gateway's shape: the buyer disputed a payment with their bank, which took the money back. Mounted under the payment's routes, it is no command of the payment's; the payment server's transformer turns it into the RefundPayment of the payment merchantReference names (the gateway knows a payment by the reference it was charged under, the payment's id), and keeps disputeId in the command's headers, so the payment's event stream says which dispute refunded it.

Link copied to clipboard
sealed interface GatewayOutcome

What the gateway answers a charge.

Link copied to clipboard

The payment of an order between the ordering and the payment contexts, after the classic eShop's integration events (OrderStatusChangedToStockConfirmed, OrderPaymentSucceeded, OrderPaymentFailed):

Link copied to clipboard
@Description(value = "The payment of an order through the payment gateway")
class Payment(state: PaymentState)

The payment of an order, after the classic eShop's PaymentProcessor; its id is the order's:

Link copied to clipboard
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.

Link copied to clipboard

Charges the gateway for each requested payment and records its answer on the payment: ConfirmPayment when it approves, FailPayment when it declines.

Link copied to clipboard

The state of a Payment, changed in place by its events. Every property has a value before the payment is requested: the kernel serializes the state as it is.

Link copied to clipboard
class SimulatedPaymentGateway(val limit: BigDecimal, down: () -> Boolean = { false }) : PaymentGateway

A gateway for trying the eShop out and for its tests, after the classic eShop's PaymentProcessor, which approves or declines by a setting. Its answer is a function of the amount, so a test chooses the outcome by the order's total: it approves an amount up to limit and declines one above it. Its transaction id is the charge's idempotency key.