Skip to main content

Refund

Struct Refund 

Source
pub struct Refund {
    pub id: Option<RefundId>,
    pub payment: PaymentId,
    pub amount: Money,
    pub status: RefundStatus,
    pub next_action: Option<NextAction>,
    pub provider: ProviderId,
    pub raw: Raw,
}
Expand description

Money given back off a payment, as the provider currently sees it.

Every field is public and the struct is open, for the same reason Charge is: an adapter in someone else’s repository has to be able to build one.

§There is no refunded status on the payment

Status has no variant for it and will not grow one — no provider reports a refund as a payment status, so it would be a branch that never runs for most of them. “Has all of this gone back” is these objects summed with Money::checked_add against Charge::amount, and each adapter has a call that lists them.

Fields§

§id: Option<RefundId>

How the provider names this refund, where it names it at all.

None is not a missing field: iyzico issues no identifier for a refund. The nearest thing it has is the bank’s hostReference, which exists only once the money has gone and so is no use for making the attempt idempotent. So this is Option for the same reason Charge::id is — a composed key handed back in the field a real one lives in would read as a guarantee nobody made.

Read Id::source before writing one into a unique index.

§payment: PaymentId

The payment the money came off.

§amount: Money

How much went back.

What the provider says it refunded, not what was asked for. A provider that refunds the remainder of a partly-refunded payment answers the remainder here, and it is smaller than RefundRequest::amount was.

§status: RefundStatus

Where it stands.

§next_action: Option<NextAction>

What somebody must do before the money moves, if anything.

iyzico’s In-Store refund is the one that has one: it answers a deep link into iyzico’s app, and the refund happens when the payer approves it there. Everywhere else this is None — the refund was accepted by the time the call answered.

§provider: ProviderId

Which provider this came from.

§raw: Raw

The provider’s own response, untouched.

Trait Implementations§

Source§

impl Clone for Refund

Source§

fn clone(&self) -> Refund

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Refund

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.