pub struct Charge { /* private fields */ }Expand description
A Charge as returned by Stripe’s REST API.
A charge is the moment money actually moves or is reserved. It is created by a PaymentIntent rather than requested directly, so its identifier is what a refund references.
Implementations§
Source§impl Charge
impl Charge
Sourcepub fn new(
id: String,
amount: Money,
status: ChargeStatus,
payment_method_kind: PaymentMethodKind,
) -> Charge
pub fn new( id: String, amount: Money, status: ChargeStatus, payment_method_kind: PaymentMethodKind, ) -> Charge
Sourcepub fn get_amount(&self) -> Result<Money, StripeParseError>
pub fn get_amount(&self) -> Result<Money, StripeParseError>
Return the amount this charge captured.
§Returns
Result<Money, StripeParseError>- the amount, or an error when the response carried a currency this crate does not model.
Sourcepub fn is_disputed(&self) -> bool
pub fn is_disputed(&self) -> bool
Return whether the charge is under dispute.
§Returns
bool-trueonce a customer has challenged the charge.
Sourcepub fn is_captured(&self) -> bool
pub fn is_captured(&self) -> bool
Return whether this charge actually moved the customer’s money.
An authorised charge has reserved funds but not taken them, so it is deliberately not counted as captured.
§Returns
bool-trueonly for a succeeded charge.
Source§impl Charge
impl Charge
pub fn get_id(&self) -> &String
pub fn get_status(&self) -> ChargeStatus
pub fn get_payment_method_kind(&self) -> PaymentMethodKind
pub fn get_disputed(&self) -> bool
pub fn get_payment_intent(&self) -> Option<String>
pub fn try_get_payment_intent(&self) -> Option<String>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Charge
impl<'de> Deserialize<'de> for Charge
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Charge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Charge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Charge
Source§impl Serialize for Charge
impl Serialize for Charge
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Charge
Auto Trait Implementations§
impl Freeze for Charge
impl RefUnwindSafe for Charge
impl Send for Charge
impl Sync for Charge
impl Unpin for Charge
impl UnsafeUnpin for Charge
impl UnwindSafe for Charge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more