Skip to content

Commit

Permalink
Merge pull request #336 from arlyon/openapi-1675384030
Browse files Browse the repository at this point in the history
Generate latest changes from OpenApi spec
  • Loading branch information
arlyon committed Feb 3, 2023
2 parents ff3bc50 + 8e84508 commit 35960fd
Show file tree
Hide file tree
Showing 12 changed files with 963 additions and 8 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": "v221"
"version": "v223"
}
1 change: 1 addition & 0 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ pub use {
invoice_payment_method_options_customer_balance::*,
invoice_payment_method_options_us_bank_account::*,
invoiceitem::*,
invoices_shipping_cost::*,
line_item::*,
plan::*,
plan::PlanInterval,
Expand Down
1 change: 1 addition & 0 deletions src/resources/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub mod billing {
pub mod invoice_payment_method_options_konbini;
pub mod invoice_payment_method_options_us_bank_account;
pub mod invoiceitem;
pub mod invoices_shipping_cost;
pub mod line_item;
pub mod plan;
pub mod promotion_code;
Expand Down
66 changes: 65 additions & 1 deletion src/resources/generated/checkout_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use serde::{Deserialize, Serialize};

use crate::client::{Client, Response};
use crate::ids::{CheckoutSessionId, CustomerId, PaymentIntentId, SubscriptionId};
use crate::ids::{CheckoutSessionId, CustomerId, PaymentIntentId, PaymentLinkId, SubscriptionId};
use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, Timestamp};
use crate::resources::{
Address, CheckoutSessionItem, Currency, Customer, Discount, Invoice,
Expand Down Expand Up @@ -1178,6 +1178,10 @@ pub struct ListCheckoutSessions<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_intent: Option<PaymentIntentId>,

/// Only return the Checkout Sessions for the Payment Link specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_link: Option<PaymentLinkId>,

/// A cursor for use in pagination.
///
/// `starting_after` is an object ID that defines your place in the list.
Expand All @@ -1199,6 +1203,7 @@ impl<'a> ListCheckoutSessions<'a> {
expand: Default::default(),
limit: Default::default(),
payment_intent: Default::default(),
payment_link: Default::default(),
starting_after: Default::default(),
subscription: Default::default(),
}
Expand Down Expand Up @@ -1631,6 +1636,10 @@ pub struct CreateCheckoutSessionSubscriptionData {
/// Has to be at least 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial_period_days: Option<u32>,

/// Settings related to subscription trials.
#[serde(skip_serializing_if = "Option::is_none")]
pub trial_settings: Option<CreateCheckoutSessionSubscriptionDataTrialSettings>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
Expand Down Expand Up @@ -2240,6 +2249,12 @@ pub struct CreateCheckoutSessionSubscriptionDataTransferData {
pub destination: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCheckoutSessionSubscriptionDataTrialSettings {
/// Defines how the subscription should behave when the user's free trial ends.
pub end_behavior: CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCheckoutSessionInvoiceCreationInvoiceDataCustomFields {
/// The name of the custom field.
Expand Down Expand Up @@ -2441,6 +2456,13 @@ pub struct CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmount {
Option<CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptions>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior {
/// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
pub missing_payment_method:
CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer {
/// The desired country code of the bank account information.
Expand Down Expand Up @@ -6532,6 +6554,48 @@ impl std::default::Default for CreateCheckoutSessionShippingOptionsShippingRateD
}
}

/// 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")]
pub enum CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
Cancel,
CreateInvoice,
Pause,
}

impl CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
pub fn as_str(self) -> &'static str {
match self {
CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::Cancel => "cancel",
CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::CreateInvoice => "create_invoice",
CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::Pause => "pause",
}
}
}

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

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

/// An enum representing the possible values of an `PaymentPagesCheckoutSessionAutomaticTax`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
21 changes: 20 additions & 1 deletion src/resources/generated/credit_note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::client::{Client, Response};
use crate::ids::{CreditNoteId, CustomerId, InvoiceId, RefundId};
use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, Timestamp};
use crate::resources::{CreditNoteLineItem, Currency, Customer, CustomerBalanceTransaction, Discount, Invoice, Refund, TaxRate};
use crate::resources::{CreditNoteLineItem, Currency, Customer, CustomerBalanceTransaction, Discount, Invoice, InvoicesShippingCost, Refund, TaxRate};
use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "CreditNote".
Expand All @@ -19,6 +19,9 @@ pub struct CreditNote {
/// The integer amount in %s representing the total amount of the credit note, including tax.
pub amount: i64,

/// This is the sum of all the shipping amounts.
pub amount_shipping: i64,

/// Time at which the object was created.
///
/// Measured in seconds since the Unix epoch.
Expand Down Expand Up @@ -73,6 +76,9 @@ pub struct CreditNote {
/// Refund related to this credit note.
pub refund: Option<Expandable<Refund>>,

/// The details of the cost of shipping, including the ShippingRate applied to the invoice.
pub shipping_cost: Option<InvoicesShippingCost>,

/// Status of this credit note, one of `issued` or `void`.
///
/// Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
Expand Down Expand Up @@ -218,6 +224,10 @@ pub struct CreateCreditNote<'a> {
/// If set, a refund will be created for the charge associated with the invoice.
#[serde(skip_serializing_if = "Option::is_none")]
pub refund_amount: Option<i64>,

/// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping_cost: Option<CreateCreditNoteShippingCost>,
}

impl<'a> CreateCreditNote<'a> {
Expand All @@ -234,6 +244,7 @@ impl<'a> CreateCreditNote<'a> {
reason: Default::default(),
refund: Default::default(),
refund_amount: Default::default(),
shipping_cost: Default::default(),
}
}
}
Expand Down Expand Up @@ -372,6 +383,14 @@ pub struct CreateCreditNoteLines {
pub unit_amount_decimal: Option<String>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCreditNoteShippingCost {

/// The ID of the shipping rate to use for this order.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping_rate: Option<String>,
}

/// An enum representing the possible values of an `CreateCreditNoteLines`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
2 changes: 2 additions & 0 deletions src/resources/generated/customer_cash_balance_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl std::default::Default for CustomerBalanceResourceCashBalanceTransactionReso
pub enum CustomerCashBalanceTransactionType {
AppliedToPayment,
Funded,
FundingReversed,
RefundedFromPayment,
ReturnCanceled,
ReturnInitiated,
Expand All @@ -183,6 +184,7 @@ impl CustomerCashBalanceTransactionType {
match self {
CustomerCashBalanceTransactionType::AppliedToPayment => "applied_to_payment",
CustomerCashBalanceTransactionType::Funded => "funded",
CustomerCashBalanceTransactionType::FundingReversed => "funding_reversed",
CustomerCashBalanceTransactionType::RefundedFromPayment => "refunded_from_payment",
CustomerCashBalanceTransactionType::ReturnCanceled => "return_canceled",
CustomerCashBalanceTransactionType::ReturnInitiated => "return_initiated",
Expand Down
Loading

0 comments on commit 35960fd

Please sign in to comment.