From d0cbc718a980aedee4b191a401e76a958c3e4bb5 Mon Sep 17 00:00:00 2001 From: arlyon Date: Fri, 12 Jan 2024 00:23:34 +0000 Subject: [PATCH] feat: generate latest changes from OpenApi spec --- openapi/version.json | 2 +- .../generated/balance_transaction.rs | 12 +- src/resources/generated/customer_session.rs | 131 ++++++++++++++++++ src/resources/generated/payment_intent.rs | 8 +- src/resources/generated/setup_intent.rs | 8 +- 5 files changed, 142 insertions(+), 19 deletions(-) create mode 100644 src/resources/generated/customer_session.rs diff --git a/openapi/version.json b/openapi/version.json index e083cd5b6..3b5bfd072 100644 --- a/openapi/version.json +++ b/openapi/version.json @@ -1,3 +1,3 @@ { - "version": "v751" + "version": "v755" } \ No newline at end of file diff --git a/src/resources/generated/balance_transaction.rs b/src/resources/generated/balance_transaction.rs index 3fae58ed7..17b9c5274 100644 --- a/src/resources/generated/balance_transaction.rs +++ b/src/resources/generated/balance_transaction.rs @@ -72,7 +72,7 @@ pub struct BalanceTransaction { /// 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`, `climate_order_purchase`, `climate_order_refund`, `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_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `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`. + /// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `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 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. @@ -183,7 +183,7 @@ pub struct ListBalanceTransactions<'a> { /// Only returns transactions of the given type. /// - /// One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `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_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `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`. + /// One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `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`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option<&'a str>, @@ -229,12 +229,8 @@ pub enum BalanceTransactionType { IssuingAuthorizationRelease, IssuingDispute, IssuingTransaction, - ObligationInbound, ObligationOutbound, - ObligationPayout, - ObligationPayoutFailure, ObligationReversalInbound, - ObligationReversalOutbound, Payment, PaymentFailureRefund, PaymentNetworkReserveHold, @@ -278,12 +274,8 @@ impl BalanceTransactionType { BalanceTransactionType::IssuingAuthorizationRelease => "issuing_authorization_release", BalanceTransactionType::IssuingDispute => "issuing_dispute", BalanceTransactionType::IssuingTransaction => "issuing_transaction", - BalanceTransactionType::ObligationInbound => "obligation_inbound", BalanceTransactionType::ObligationOutbound => "obligation_outbound", - BalanceTransactionType::ObligationPayout => "obligation_payout", - BalanceTransactionType::ObligationPayoutFailure => "obligation_payout_failure", BalanceTransactionType::ObligationReversalInbound => "obligation_reversal_inbound", - BalanceTransactionType::ObligationReversalOutbound => "obligation_reversal_outbound", BalanceTransactionType::Payment => "payment", BalanceTransactionType::PaymentFailureRefund => "payment_failure_refund", BalanceTransactionType::PaymentNetworkReserveHold => "payment_network_reserve_hold", diff --git a/src/resources/generated/customer_session.rs b/src/resources/generated/customer_session.rs new file mode 100644 index 000000000..95e71e6cf --- /dev/null +++ b/src/resources/generated/customer_session.rs @@ -0,0 +1,131 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use crate::client::{Client, Response}; +use crate::ids::{CustomerId}; +use crate::params::{Expand, Expandable, Object, Timestamp}; +use crate::resources::{Customer}; +use serde::{Deserialize, Serialize}; + +/// The resource representing a Stripe "CustomerSessionResourceCustomerSession". +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CustomerSession { + + /// The client secret of this customer session. + /// + /// Used on the client to set up secure access to the given `customer`. The client secret can be used to provide access to `customer` from your frontend. + /// It should not be stored, logged, or exposed to anyone other than the relevant customer. + /// Make sure that you have TLS enabled on any page that includes the client secret. + pub client_secret: String, + + #[serde(skip_serializing_if = "Option::is_none")] + pub components: Option, + + /// Time at which the object was created. + /// + /// Measured in seconds since the Unix epoch. + pub created: Timestamp, + + /// The customer the customer session was created for. + pub customer: Expandable, + + /// The timestamp at which this customer session will expire. + pub expires_at: Timestamp, + + /// 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, +} + +impl CustomerSession { + + /// Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources. + pub fn create(client: &Client, params: CreateCustomerSession<'_>) -> Response { + client.post_form("/customer_sessions", ¶ms) + } +} + +impl Object for CustomerSession { + type Id = (); + fn id(&self) -> Self::Id {} + fn object(&self) -> &'static str { + "customer_session" + } +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CustomerSessionResourceComponents { + + #[serde(skip_serializing_if = "Option::is_none")] + pub buy_button: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub pricing_table: Option, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CustomerSessionResourceComponentsResourceBuyButton { + + /// Whether the buy button is enabled. + pub enabled: bool, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CustomerSessionResourceComponentsResourcePricingTable { + + /// Whether the pricing table is enabled. + pub enabled: bool, +} + +/// The parameters for `CustomerSession::create`. +#[derive(Clone, Debug, Serialize)] +pub struct CreateCustomerSession<'a> { + + /// Configuration for each component. + /// + /// 1 component must be enabled. + pub components: CreateCustomerSessionComponents, + + /// The ID of an existing customer for which to create the customer session. + pub customer: CustomerId, + + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Expand::is_empty")] + pub expand: &'a [&'a str], +} + +impl<'a> CreateCustomerSession<'a> { + pub fn new(components: CreateCustomerSessionComponents, customer: CustomerId) -> Self { + CreateCustomerSession { + components, + customer, + expand: Default::default(), + } + } +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CreateCustomerSessionComponents { + + /// Configuration for buy button. + #[serde(skip_serializing_if = "Option::is_none")] + pub buy_button: Option, + + /// Configuration for the pricing table. + #[serde(skip_serializing_if = "Option::is_none")] + pub pricing_table: Option, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CreateCustomerSessionComponentsBuyButton { + + /// Whether the buy button is enabled. + pub enabled: bool, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct CreateCustomerSessionComponentsPricingTable { + + /// Whether the pricing table is enabled. + pub enabled: bool, +} diff --git a/src/resources/generated/payment_intent.rs b/src/resources/generated/payment_intent.rs index 75826b92a..80b74a7b1 100644 --- a/src/resources/generated/payment_intent.rs +++ b/src/resources/generated/payment_intent.rs @@ -2874,7 +2874,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit { pub setup_future_usage: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -3479,7 +3479,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccount { pub setup_future_usage: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -3761,7 +3761,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit { pub setup_future_usage: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -4366,7 +4366,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccount { pub setup_future_usage: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, diff --git a/src/resources/generated/setup_intent.rs b/src/resources/generated/setup_intent.rs index 83a0e980a..47d21f12a 100644 --- a/src/resources/generated/setup_intent.rs +++ b/src/resources/generated/setup_intent.rs @@ -1317,7 +1317,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsAcssDebit { #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -1396,7 +1396,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccount { #[serde(skip_serializing_if = "Option::is_none")] pub networks: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -1616,7 +1616,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebit { #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, @@ -1695,7 +1695,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccount { #[serde(skip_serializing_if = "Option::is_none")] pub networks: Option, - /// Verification method for the intent. + /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option,