Skip to content

Commit

Permalink
feat: Generate latest changes from OpenApi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Sep 21, 2023
1 parent d278743 commit 7421960
Show file tree
Hide file tree
Showing 18 changed files with 4,333 additions and 62 deletions.
2 changes: 1 addition & 1 deletion openapi/version.json
@@ -1,3 +1,3 @@
{
"version": "v516"
"version": "v532"
}
2 changes: 2 additions & 0 deletions src/resources/generated/api_errors.rs
Expand Up @@ -213,6 +213,7 @@ pub enum ApiErrorsCode {
SkuInactive,
StateUnsupported,
StatusTransitionInvalid,
StripeTaxInactive,
TaxIdInvalid,
TaxesCalculationFailed,
TerminalLocationCountryUnsupported,
Expand Down Expand Up @@ -412,6 +413,7 @@ impl ApiErrorsCode {
ApiErrorsCode::SkuInactive => "sku_inactive",
ApiErrorsCode::StateUnsupported => "state_unsupported",
ApiErrorsCode::StatusTransitionInvalid => "status_transition_invalid",
ApiErrorsCode::StripeTaxInactive => "stripe_tax_inactive",
ApiErrorsCode::TaxIdInvalid => "tax_id_invalid",
ApiErrorsCode::TaxesCalculationFailed => "taxes_calculation_failed",
ApiErrorsCode::TerminalLocationCountryUnsupported => {
Expand Down
12 changes: 6 additions & 6 deletions src/resources/generated/balance.rs
Expand Up @@ -12,18 +12,18 @@ use crate::resources::Currency;
/// For more details see <https://stripe.com/docs/api/balance/balance_object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Balance {
/// Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts).
/// Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts).
///
/// The available balance for each currency and payment type can be found in the `source_types` property.
/// You can find the available balance for each currency and payment type in the `source_types` property.
pub available: Vec<BalanceAmount>,

/// Funds held due to negative balances on connected Custom accounts.
///
/// The connect reserve balance for each currency and payment type can be found in the `source_types` property.
/// You can find the connect reserve balance for each currency and payment type in the `source_types` property.
#[serde(skip_serializing_if = "Option::is_none")]
pub connect_reserved: Option<Vec<BalanceAmount>>,

/// Funds that can be paid out using Instant Payouts.
/// Funds that you can pay out using Instant Payouts.
#[serde(skip_serializing_if = "Option::is_none")]
pub instant_available: Option<Vec<BalanceAmount>>,

Expand All @@ -33,9 +33,9 @@ pub struct Balance {
/// 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,

/// Funds that are not yet available in the balance.
/// Funds that aren't available in the balance yet.
///
/// The pending balance for each currency, and for each payment type, can be found in the `source_types` property.
/// You can find the pending balance for each currency and each payment type in the `source_types` property.
pub pending: Vec<BalanceAmount>,
}

Expand Down
28 changes: 12 additions & 16 deletions src/resources/generated/balance_transaction.rs
Expand Up @@ -19,10 +19,10 @@ pub struct BalanceTransaction {
/// Unique identifier for the object.
pub id: BalanceTransactionId,

/// Gross amount of the transaction, in cents (or local equivalent).
/// Gross amount of the transaction (in cents (or local equivalent)).
pub amount: i64,

/// The date the transaction's net funds will become available in the Stripe balance.
/// The date that the transaction's net funds become available in the Stripe balance.
pub available_on: Timestamp,

/// Time at which the object was created.
Expand All @@ -40,13 +40,11 @@ pub struct BalanceTransaction {
/// Often useful for displaying to users.
pub description: Option<String>,

/// The exchange rate used, if applicable, for this transaction.
/// If applicable, this transaction uses an exchange rate.
///
/// Specifically, if money was converted from currency A to currency B, then the `amount` in currency A, times `exchange_rate`, would be the `amount` in currency B.
/// For example, suppose you charged a customer 10.00 EUR.
/// Then the PaymentIntent's `amount` would be `1000` and `currency` would be `eur`.
/// Suppose this was converted into 12.34 USD in your Stripe account.
/// Then the BalanceTransaction's `amount` would be `1234`, `currency` would be `usd`, and `exchange_rate` would be `1.234`.
/// If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B.
/// For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`.
/// If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
pub exchange_rate: Option<f64>,

/// Fees (in cents (or local equivalent)) paid for this transaction.
Expand All @@ -55,24 +53,22 @@ pub struct BalanceTransaction {
/// Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
pub fee_details: Vec<Fee>,

/// Net amount of the transaction, in cents (or local equivalent).
/// Net amount of the transaction (in cents (or local equivalent)).
pub net: i64,

/// [Learn more](https://stripe.com/docs/reports/reporting-categories) about how reporting categories can help you understand balance transactions from an accounting perspective.
/// Learn more about how [reporting categories] (https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
pub reporting_category: String,

/// The Stripe object to which this transaction is related.
/// This transaction relates to the Stripe object.
pub source: Option<Expandable<BalanceTransactionSourceUnion>>,

/// If the transaction's net funds are available in the Stripe balance yet.
///
/// Either `available` or `pending`.
/// The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
pub status: BalanceTransactionStatus,

/// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
///
/// [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent.
/// If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead.
/// Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types).
/// To classify transactions for accounting purposes, consider `reporting_category` instead.
#[serde(rename = "type")]
pub type_: BalanceTransactionType,
}
Expand Down
16 changes: 15 additions & 1 deletion src/resources/generated/checkout_session.rs
Expand Up @@ -5,13 +5,17 @@
use serde::{Deserialize, Serialize};

use crate::client::{Client, Response};
use crate::ids::{CheckoutSessionId, CustomerId, PaymentIntentId, PaymentLinkId, SubscriptionId};
use crate::ids::{
CheckoutSessionId, CustomerId, PaymentIntentId, PaymentLinkId, PaymentMethodConfigurationId,
SubscriptionId,
};
use crate::params::{
CurrencyMap, Expand, Expandable, List, Metadata, Object, Paginable, Timestamp,
};
use crate::resources::{
Address, CheckoutSessionItem, Currency, Customer, Discount, Invoice,
InvoiceSettingRenderingOptions, LinkedAccountOptionsUsBankAccount, PaymentIntent, PaymentLink,
PaymentMethodConfigBizPaymentMethodConfigurationDetails,
PaymentMethodOptionsCustomerBalanceEuBankAccount, SetupIntent, Shipping, ShippingRate,
Subscription, TaxId, TaxRate,
};
Expand Down Expand Up @@ -136,6 +140,11 @@ pub struct CheckoutSession {
/// Configure whether a Checkout Session should collect a payment method.
pub payment_method_collection: Option<CheckoutSessionPaymentMethodCollection>,

/// Information about the payment method configuration used for this Checkout session if using dynamic payment methods.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_configuration_details:
Option<PaymentMethodConfigBizPaymentMethodConfigurationDetails>,

/// Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
pub payment_method_options: Option<CheckoutSessionPaymentMethodOptions>,

Expand Down Expand Up @@ -1193,6 +1202,10 @@ pub struct CreateCheckoutSession<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_collection: Option<CheckoutSessionPaymentMethodCollection>,

/// The ID of the payment method configuration to use with this Checkout session.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_configuration: Option<PaymentMethodConfigurationId>,

/// Payment-method-specific configuration.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options: Option<CreateCheckoutSessionPaymentMethodOptions>,
Expand Down Expand Up @@ -1283,6 +1296,7 @@ impl<'a> CreateCheckoutSession<'a> {
mode: Default::default(),
payment_intent_data: Default::default(),
payment_method_collection: Default::default(),
payment_method_configuration: Default::default(),
payment_method_options: Default::default(),
payment_method_types: Default::default(),
phone_number_collection: Default::default(),
Expand Down
38 changes: 19 additions & 19 deletions src/resources/generated/customer.rs
Expand Up @@ -26,19 +26,20 @@ pub struct Customer {
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<Address>,

/// Current balance, if any, being stored on the customer.
/// The current balance, if any, that's stored on the customer.
///
/// If negative, the customer has credit to apply to their next invoice.
/// If positive, the customer has an amount owed that will be added to their next invoice.
/// The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice.
/// This balance is only taken into account as invoices are finalized.
/// If positive, the customer has an amount owed that's added to their next invoice.
/// The balance only considers amounts that Stripe hasn't successfully applied to any invoice.
/// It doesn't reflect unpaid invoices.
/// This balance is only taken into account after invoices finalize.
#[serde(skip_serializing_if = "Option::is_none")]
pub balance: Option<i64>,

/// The current funds being held by Stripe on behalf of the customer.
///
/// These funds can be applied towards payment intents with source "cash_balance".
/// The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically.
/// You can apply these funds towards payment intents when the source is "cash_balance".
/// The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically.
#[serde(skip_serializing_if = "Option::is_none")]
pub cash_balance: Option<CashBalance>,

Expand All @@ -54,17 +55,17 @@ pub struct Customer {

/// ID of the default payment source for the customer.
///
/// If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
/// If you use payment methods created through the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_source: Option<Expandable<PaymentSource>>,

// Always true for a deleted object
#[serde(default)]
pub deleted: bool,

/// When the customer's latest invoice is billed by charging automatically, `delinquent` is `true` if the invoice's latest charge failed.
/// If Stripe bills the customer's latest invoice by automatically charging and the latest charge fails, it sets `delinquent`` to `true``.
///
/// When the customer's latest invoice is billed by sending an invoice, `delinquent` is `true` if the invoice isn't paid by its due date. If an invoice is marked uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't get reset to `false`.
/// If Stripe bills the invoice by sending it, and the invoice isn't paid by the due date, it also sets `delinquent`` to `true`. If an invoice becomes uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't reset to `false`.
#[serde(skip_serializing_if = "Option::is_none")]
pub delinquent: Option<bool>,

Expand All @@ -82,13 +83,13 @@ pub struct Customer {
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,

/// The current multi-currency balances, if any, being stored on the customer.
/// The current multi-currency balances, if any, that's stored on the customer.
///
/// If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.
/// If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency.
/// These balances do not refer to any unpaid invoices.
/// They solely track amounts that have yet to be successfully applied to any invoice.
/// A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized.
/// If negative, the customer has an amount owed that's added to their next invoice denominated in that currency.
/// These balances don't apply to unpaid invoices.
/// They solely track amounts that Stripe hasn't successfully applied to any invoice.
/// Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_credit_balance: Option<i64>,

Expand All @@ -113,7 +114,7 @@ pub struct Customer {
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,

/// The suffix of the customer's next invoice number, e.g., 0001.
/// The suffix of the customer's next invoice number (for example, 0001).
#[serde(skip_serializing_if = "Option::is_none")]
pub next_invoice_sequence: Option<i64>,

Expand Down Expand Up @@ -142,18 +143,17 @@ pub struct Customer {
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<CustomerTax>,

/// Describes the customer's tax exemption status.
/// Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`.
///
/// One of `none`, `exempt`, or `reverse`.
/// When set to `reverse`, invoice and receipt PDFs include the text **"Reverse charge"**.
/// When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_exempt: Option<CustomerTaxExempt>,

/// The customer's tax IDs.
#[serde(default)]
pub tax_ids: List<TaxId>,

/// ID of the test clock this customer belongs to.
/// ID of the test clock that this customer belongs to.
#[serde(skip_serializing_if = "Option::is_none")]
pub test_clock: Option<Expandable<TestHelpersTestClock>>,
}
Expand Down
12 changes: 6 additions & 6 deletions src/resources/generated/dispute.rs
Expand Up @@ -19,13 +19,13 @@ pub struct Dispute {

/// Disputed amount.
///
/// Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed).
/// Usually the amount of the charge, but it can differ (usually because of currency fluctuation or because only part of the order is disputed).
pub amount: i64,

/// List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
pub balance_transactions: Vec<BalanceTransaction>,

/// ID of the charge that was disputed.
/// ID of the charge that's disputed.
pub charge: Expandable<Charge>,

/// Time at which the object was created.
Expand All @@ -42,9 +42,9 @@ pub struct Dispute {

pub evidence_details: DisputeEvidenceDetails,

/// If true, it is still possible to refund the disputed payment.
/// If true, it's still possible to refund the disputed payment.
///
/// Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute.
/// After the payment has been fully refunded, no further funds are withdrawn from your Stripe account as a result of this dispute.
pub is_charge_refundable: bool,

/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Expand All @@ -59,7 +59,7 @@ pub struct Dispute {
#[serde(skip_serializing_if = "Option::is_none")]
pub network_reason_code: Option<String>,

/// ID of the PaymentIntent that was disputed.
/// ID of the PaymentIntent that's disputed.
pub payment_intent: Option<Expandable<PaymentIntent>>,

#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -68,7 +68,7 @@ pub struct Dispute {
/// Reason given by cardholder for dispute.
///
/// Possible values are `bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`.
/// Read more about [dispute reasons](https://stripe.com/docs/disputes/categories).
/// Learn more about [dispute reasons](https://stripe.com/docs/disputes/categories).
pub reason: String,

/// Current status of dispute.
Expand Down
5 changes: 5 additions & 0 deletions src/resources/generated/ephemeral_key.rs
Expand Up @@ -71,6 +71,10 @@ pub struct CreateEphemeralKey<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub issuing_card: Option<IssuingCardId>,

/// A single-use token, created by Stripe.js, used for creating ephemeral keys for Issuing Cards without exchanging sensitive information.
#[serde(skip_serializing_if = "Option::is_none")]
pub nonce: Option<&'a str>,

/// The ID of the Identity VerificationSession you'd like to access using the resulting ephemeral key.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_session: Option<&'a str>,
Expand All @@ -82,6 +86,7 @@ impl<'a> CreateEphemeralKey<'a> {
customer: Default::default(),
expand: Default::default(),
issuing_card: Default::default(),
nonce: Default::default(),
verification_session: Default::default(),
}
}
Expand Down

0 comments on commit 7421960

Please sign in to comment.