Skip to content

Commit

Permalink
Merge pull request #369 from arlyon/openapi-1682641520
Browse files Browse the repository at this point in the history
Generate latest changes from OpenApi spec
  • Loading branch information
arlyon committed May 2, 2023
2 parents bbbfdbb + b57774f commit 4546fd9
Show file tree
Hide file tree
Showing 13 changed files with 708 additions and 91 deletions.
2 changes: 1 addition & 1 deletion openapi/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v301"
"version": "v318"
}
1 change: 1 addition & 0 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub use {
payment_intent::*,
payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code::*,
linked_account_options_us_bank_account::*,
payment_method_details_card_checks::*,
payment_method_options_customer_balance_eu_bank_account::*,
payout::*,
platform_tax_fee::*,
Expand Down
1 change: 1 addition & 0 deletions src/resources/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod core {
pub mod mandate_options_off_session_details_blik;
pub mod payment_intent;
pub mod payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code;
pub mod payment_method_details_card_checks;
pub mod payment_method_options_customer_balance_eu_bank_account;
pub mod payout;
pub mod platform_tax_fee;
Expand Down
16 changes: 2 additions & 14 deletions src/resources/generated/charge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, Range
use crate::resources::{
Account, Address, Application, ApplicationFee, BalanceTransaction, BillingDetails,
ChargeSourceParams, Currency, Customer, Dispute, Invoice, Mandate, PaymentIntent,
PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, PaymentSource, RadarRadarOptions,
Refund, Review, Shipping, ThreeDSecureDetails, Transfer,
PaymentMethod, PaymentMethodDetailsCardChecks, PaymentMethodDetailsCardInstallmentsPlan,
PaymentSource, RadarRadarOptions, Refund, Review, Shipping, ThreeDSecureDetails, Transfer,
};

/// The resource representing a Stripe "Charge".
Expand Down Expand Up @@ -740,18 +740,6 @@ pub struct PaymentMethodDetailsCard {
pub wallet: Option<PaymentMethodDetailsCardWallet>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct PaymentMethodDetailsCardChecks {
/// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub address_line1_check: Option<String>,

/// If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub address_postal_code_check: Option<String>,

/// If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub cvc_check: Option<String>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct PaymentMethodDetailsCardInstallments {
/// Installment plan selected for the payment.
Expand Down
46 changes: 46 additions & 0 deletions src/resources/generated/checkout_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,10 @@ pub struct CreateCheckoutSessionSubscriptionData {
#[serde(skip_serializing_if = "Option::is_none")]
pub application_fee_percent: Option<f64>,

/// A future timestamp to anchor the subscription's billing cycle for new subscriptions.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_cycle_anchor: Option<Timestamp>,

/// The ID of the coupon to apply to this subscription.
///
/// A coupon applied to a subscription will only affect invoices created for that particular subscription.
Expand Down Expand Up @@ -1761,6 +1765,12 @@ pub struct CreateCheckoutSessionSubscriptionData {
#[serde(skip_serializing_if = "Option::is_none")]
pub on_behalf_of: Option<String>,

/// Determines how to handle prorations resulting from the `billing_cycle_anchor`.
///
/// If no value is passed, the default is `create_prorations`.
#[serde(skip_serializing_if = "Option::is_none")]
pub proration_behavior: Option<CreateCheckoutSessionSubscriptionDataProrationBehavior>,

/// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges.
#[serde(skip_serializing_if = "Option::is_none")]
pub transfer_data: Option<CreateCheckoutSessionSubscriptionDataTransferData>,
Expand Down Expand Up @@ -6897,6 +6907,42 @@ impl std::default::Default for CreateCheckoutSessionShippingOptionsShippingRateD
}
}

/// An enum representing the possible values of an `CreateCheckoutSessionSubscriptionData`'s `proration_behavior` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateCheckoutSessionSubscriptionDataProrationBehavior {
CreateProrations,
None,
}

impl CreateCheckoutSessionSubscriptionDataProrationBehavior {
pub fn as_str(self) -> &'static str {
match self {
CreateCheckoutSessionSubscriptionDataProrationBehavior::CreateProrations => {
"create_prorations"
}
CreateCheckoutSessionSubscriptionDataProrationBehavior::None => "none",
}
}
}

impl AsRef<str> for CreateCheckoutSessionSubscriptionDataProrationBehavior {
fn as_ref(&self) -> &str {
self.as_str()
}
}

impl std::fmt::Display for CreateCheckoutSessionSubscriptionDataProrationBehavior {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateCheckoutSessionSubscriptionDataProrationBehavior {
fn default() -> Self {
Self::CreateProrations
}
}

/// An enum representing the possible values of an `CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior`'s `missing_payment_method` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ pub struct MerchantData {

/// State where the seller is located.
pub state: Option<String>,

/// An ID assigned by the seller to the location of the sale.
pub terminal_id: Option<String>,
}
10 changes: 6 additions & 4 deletions src/resources/generated/line_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use serde::{Deserialize, Serialize};

use crate::ids::InvoiceLineItemId;
use crate::params::{Expandable, Metadata, Object};
use crate::resources::{Currency, Discount, Period, Plan, Price, TaxRate};
use crate::resources::{
Currency, Discount, InvoiceItem, Period, Plan, Price, Subscription, SubscriptionItem, TaxRate,
};

/// The resource representing a Stripe "InvoiceLineItem".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
Expand Down Expand Up @@ -46,7 +48,7 @@ pub struct InvoiceLineItem {

/// The ID of the [invoice item](https://stripe.com/docs/api/invoiceitems) associated with this line item if any.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_item: Option<String>,
pub invoice_item: Option<Expandable<InvoiceItem>>,

/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
pub livemode: bool,
Expand Down Expand Up @@ -75,13 +77,13 @@ pub struct InvoiceLineItem {
pub quantity: Option<u64>,

/// The subscription that the invoice item pertains to, if any.
pub subscription: Option<String>,
pub subscription: Option<Expandable<Subscription>>,

/// The subscription item that generated this line item.
///
/// Left empty if the line item is not an explicit result of a subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_item: Option<String>,
pub subscription_item: Option<Expandable<SubscriptionItem>>,

/// The amount of tax calculated per tax rate for this line item.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
18 changes: 18 additions & 0 deletions src/resources/generated/payment_method_details_card_checks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "payment_method_details_card_checks".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct PaymentMethodDetailsCardChecks {
/// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub address_line1_check: Option<String>,

/// If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub address_postal_code_check: Option<String>,

/// If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
pub cvc_check: Option<String>,
}
7 changes: 5 additions & 2 deletions src/resources/generated/setup_attempt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::client::{Client, Response};
use crate::ids::{SetupAttemptId, SetupIntentId};
use crate::params::{Expand, Expandable, List, Object, Paginable, RangeQuery, Timestamp};
use crate::resources::{
Account, ApiErrors, Application, Customer, Mandate, PaymentMethod, SetupIntent,
ThreeDSecureDetails,
Account, ApiErrors, Application, Customer, Mandate, PaymentMethod,
PaymentMethodDetailsCardChecks, SetupIntent, ThreeDSecureDetails,
};

/// The resource representing a Stripe "PaymentFlowsSetupIntentSetupAttempt".
Expand Down Expand Up @@ -191,6 +191,9 @@ pub struct SetupAttemptPaymentMethodDetailsBoleto {}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCard {
/// Check results by Card networks on Card address and CVC at time of payment.
pub checks: Option<PaymentMethodDetailsCardChecks>,

/// Populated if this authorization used 3D Secure authentication.
pub three_d_secure: Option<ThreeDSecureDetails>,
}
Expand Down

0 comments on commit 4546fd9

Please sign in to comment.