Skip to content

Commit

Permalink
fix: Add missing fields to PaymentIntent
Browse files Browse the repository at this point in the history
feat: Add new function to `PaymentIntentCreateParams` for
convience
  • Loading branch information
drager committed Sep 4, 2019
1 parent fd18ed9 commit e968304
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/resources/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ pub struct PaymentIntentCreateParams<'a> {
pub payment_method_types: Vec<PaymentIntentMethodType>,
pub amount: u64,
pub currency: Currency,
pub payment_method: Option<&'a str>,
pub confirmation_method: Option<PaymentIntentConfirmationMethod>,

#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee_amount: Option<u64>,
Expand Down Expand Up @@ -413,6 +415,33 @@ pub struct PaymentIntentCreateParams<'a> {
pub transfer_group: Option<&'a str>,
}

impl<'a> PaymentIntentCreateParams<'a> {
pub fn new(amount: u64, currency: Currency) -> Self {
PaymentIntentCreateParams {
payment_method_types: Default::default(),
amount,
currency,
payment_method: Default::default(),
confirmation_method: Default::default(),
application_fee_amount: Default::default(),
capture_method: Default::default(),
confirm: Default::default(),
customer: Default::default(),
description: Default::default(),
metadata: Default::default(),
on_behalf_of: Default::default(),
receipt_email: Default::default(),
return_url: Default::default(),
save_source_to_customer: Default::default(),
shipping: Default::default(),
source: Default::default(),
statement_descriptor: Default::default(),
transfer_data: Default::default(),
transfer_group: Default::default(),
}
}
}

/// The set of parameters that can be used when updating a payment_intent object.
///
/// For more details see [https://stripe.com/docs/api/payment_intents/update](https://stripe.com/docs/api/payment_intents/update)
Expand Down

0 comments on commit e968304

Please sign in to comment.