pub struct Charge {
pub id: Option<PaymentId>,
pub order: Option<OrderRef>,
pub amount: Money,
pub order_amount: Option<Money>,
pub status: Status,
pub next_action: Option<NextAction>,
pub provider: ProviderId,
pub raw: Raw,
}Expand description
A charge, as the provider currently sees it.
Every field is public and the struct is open: a provider adapter living outside this workspace has to be able to build one.
Fields§
§id: Option<PaymentId>How the provider names this payment, where it names it at all.
None is a payment nothing identifies yet — an iyzico checkout form the
payer has not finished has no paymentId — and it is None rather than
an empty string so that it cannot be handed back as a handle and quietly
read as a payment nobody made. A provider that never issues one and has
nothing to compose one from answers None here always, and
ErrorKind::Unsupported to
Provider::charge_status.
Read PaymentId::source before writing one into a unique index.
order: Option<OrderRef>The order reference the charge was created against, when the provider kept it.
amount: MoneyWhat the payer is charged. The money that moves.
Not always what the goods came to: an instalment surcharge lands here and not on the basket. This is the figure that reconciles against a bank statement.
order_amount: Option<Money>What the goods came to, when the provider reports it separately and it
differs from Charge::amount.
None does not mean the two are equal — it means this provider does
not say. Stripe has no basket at all at the payment level, so it never
answers; iyzico’s price and PayTR’s payment_amount do.
status: StatusWhere it stands.
next_action: Option<NextAction>What the payer must do next, if anything.
provider: ProviderIdWhich provider this came from.
raw: RawThe provider’s own response, untouched.
The escape hatch: everything kasapay does not model is still here.