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 Apr 18, 2023
1 parent 0325cce commit a76703c
Show file tree
Hide file tree
Showing 35 changed files with 2,153 additions and 102 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": "v238"
"version": "v301"
}
1 change: 1 addition & 0 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub use {
mandate::*,
mandate_options_off_session_details_blik::*,
payment_intent::*,
payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code::*,
linked_account_options_us_bank_account::*,
payment_method_options_customer_balance_eu_bank_account::*,
payout::*,
Expand Down
1 change: 1 addition & 0 deletions src/resources/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub mod core {
pub mod mandate;
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_options_customer_balance_eu_bank_account;
pub mod payout;
pub mod platform_tax_fee;
Expand Down
84 changes: 84 additions & 0 deletions src/resources/generated/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ pub struct AccountCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires_payments: Option<AccountCapabilitiesCartesBancairesPayments>,

/// The status of the Cash App Pay capability of the account, or whether the account can directly process Cash App Pay payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp_payments: Option<AccountCapabilitiesCashappPayments>,

/// The status of the EPS payments capability of the account, or whether the account can directly process EPS charges.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps_payments: Option<AccountCapabilitiesEpsPayments>,
Expand Down Expand Up @@ -690,6 +694,14 @@ pub struct Company {
#[serde(skip_serializing_if = "Option::is_none")]
pub executives_provided: Option<bool>,

/// The export license ID number of the company, also referred as Import Export Code (India only).
#[serde(skip_serializing_if = "Option::is_none")]
pub export_license_id: Option<String>,

/// The purpose code to use for export transactions (India only).
#[serde(skip_serializing_if = "Option::is_none")]
pub export_purpose_code: Option<String>,

/// The company's legal name.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
Expand Down Expand Up @@ -1140,6 +1152,14 @@ pub struct CompanyParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub executives_provided: Option<bool>,

/// The export license ID number of the company, also referred as Import Export Code (India only).
#[serde(skip_serializing_if = "Option::is_none")]
pub export_license_id: Option<String>,

/// The purpose code to use for export transactions (India only).
#[serde(skip_serializing_if = "Option::is_none")]
pub export_purpose_code: Option<String>,

/// The company's legal name.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
Expand Down Expand Up @@ -1247,6 +1267,10 @@ pub struct CreateAccountCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires_payments: Option<CreateAccountCapabilitiesCartesBancairesPayments>,

/// The cashapp_payments capability.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp_payments: Option<CreateAccountCapabilitiesCashappPayments>,

/// The eps_payments capability.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps_payments: Option<CreateAccountCapabilitiesEpsPayments>,
Expand Down Expand Up @@ -1525,6 +1549,10 @@ pub struct UpdateAccountCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires_payments: Option<UpdateAccountCapabilitiesCartesBancairesPayments>,

/// The cashapp_payments capability.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp_payments: Option<UpdateAccountCapabilitiesCashappPayments>,

/// The eps_payments capability.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps_payments: Option<UpdateAccountCapabilitiesEpsPayments>,
Expand Down Expand Up @@ -1857,6 +1885,16 @@ pub struct CreateAccountCapabilitiesCartesBancairesPayments {
pub requested: Option<bool>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateAccountCapabilitiesCashappPayments {
/// Passing true requests the capability for the account, if it is not already requested.
///
/// A requested capability may not immediately become active.
/// Any requirements to activate the capability are returned in the `requirements` arrays.
#[serde(skip_serializing_if = "Option::is_none")]
pub requested: Option<bool>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateAccountCapabilitiesEpsPayments {
/// Passing true requests the capability for the account, if it is not already requested.
Expand Down Expand Up @@ -2323,6 +2361,16 @@ pub struct UpdateAccountCapabilitiesCartesBancairesPayments {
pub requested: Option<bool>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateAccountCapabilitiesCashappPayments {
/// Passing true requests the capability for the account, if it is not already requested.
///
/// A requested capability may not immediately become active.
/// Any requirements to activate the capability are returned in the `requirements` arrays.
#[serde(skip_serializing_if = "Option::is_none")]
pub requested: Option<bool>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateAccountCapabilitiesEpsPayments {
/// Passing true requests the capability for the account, if it is not already requested.
Expand Down Expand Up @@ -3030,6 +3078,42 @@ impl std::default::Default for AccountCapabilitiesCartesBancairesPayments {
}
}

/// An enum representing the possible values of an `AccountCapabilities`'s `cashapp_payments` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum AccountCapabilitiesCashappPayments {
Active,
Inactive,
Pending,
}

impl AccountCapabilitiesCashappPayments {
pub fn as_str(self) -> &'static str {
match self {
AccountCapabilitiesCashappPayments::Active => "active",
AccountCapabilitiesCashappPayments::Inactive => "inactive",
AccountCapabilitiesCashappPayments::Pending => "pending",
}
}
}

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

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

/// An enum representing the possible values of an `AccountCapabilities`'s `eps_payments` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
178 changes: 175 additions & 3 deletions src/resources/generated/bank_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub struct BankAccount {
#[serde(skip_serializing_if = "Option::is_none")]
pub fingerprint: Option<String>,

/// Information about upcoming new requirements for the bank account, including what information needs to be collected.
#[serde(skip_serializing_if = "Option::is_none")]
pub future_requirements: Option<ExternalAccountRequirements>,

/// The last four digits of the bank account number.
#[serde(skip_serializing_if = "Option::is_none")]
pub last4: Option<String>,
Expand All @@ -80,6 +84,10 @@ pub struct BankAccount {
#[serde(default)]
pub metadata: Metadata,

/// Information about the requirements for the bank account, including what information needs to be collected.
#[serde(skip_serializing_if = "Option::is_none")]
pub requirements: Option<ExternalAccountRequirements>,

/// The routing transit number for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing_number: Option<String>,
Expand All @@ -91,10 +99,11 @@ pub struct BankAccount {
/// Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run.
/// If customer bank account verification has succeeded, the bank account status will be `verified`.
/// If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`.
/// If a transfer sent to this bank account fails, we'll set the status to `errored` and will not continue to send transfers until the bank details are updated. For external accounts, possible values are `new` and `errored`.
/// Validations aren't run against external accounts because they're only used for payouts.
/// This means the other statuses don't apply.
/// If a transfer sent to this bank account fails, we'll set the status to `errored` and will not continue to send transfers until the bank details are updated. For external accounts, possible values are `new`, `errored` and `verification_failed`.
/// If a transfer fails, the status is set to `errored` and transfers are stopped until account details are updated.
/// In India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`.
/// Other validations aren't run against external accounts because they're only used for payouts.
/// This means the other statuses don't apply.
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<BankAccountStatus>,
}
Expand All @@ -109,6 +118,169 @@ impl Object for BankAccount {
}
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ExternalAccountRequirements {
/// Fields that need to be collected to keep the external account enabled.
///
/// If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
pub currently_due: Option<Vec<String>>,

/// Fields that are `currently_due` and need to be collected again because validation or verification failed.
pub errors: Option<Vec<AccountRequirementsError>>,

/// Fields that weren't collected by `current_deadline`.
///
/// These fields need to be collected to enable the external account.
pub past_due: Option<Vec<String>>,

/// Fields that may become required depending on the results of verification or review.
///
/// Will be an empty array unless an asynchronous verification is pending.
/// If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`.
pub pending_verification: Option<Vec<String>>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountRequirementsError {
/// The code for the type of error.
pub code: AccountRequirementsErrorCode,

/// An informative message that indicates the error type and provides additional details about the error.
pub reason: String,

/// The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
pub requirement: String,
}

/// An enum representing the possible values of an `AccountRequirementsError`'s `code` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum AccountRequirementsErrorCode {
InvalidAddressCityStatePostalCode,
#[serde(rename = "invalid_dob_age_under_18")]
InvalidDobAgeUnder18,
InvalidRepresentativeCountry,
InvalidStreetAddress,
InvalidTosAcceptance,
InvalidValueOther,
VerificationDocumentAddressMismatch,
VerificationDocumentAddressMissing,
VerificationDocumentCorrupt,
VerificationDocumentCountryNotSupported,
VerificationDocumentDobMismatch,
VerificationDocumentDuplicateType,
VerificationDocumentExpired,
VerificationDocumentFailedCopy,
VerificationDocumentFailedGreyscale,
VerificationDocumentFailedOther,
VerificationDocumentFailedTestMode,
VerificationDocumentFraudulent,
VerificationDocumentIdNumberMismatch,
VerificationDocumentIdNumberMissing,
VerificationDocumentIncomplete,
VerificationDocumentInvalid,
VerificationDocumentIssueOrExpiryDateMissing,
VerificationDocumentManipulated,
VerificationDocumentMissingBack,
VerificationDocumentMissingFront,
VerificationDocumentNameMismatch,
VerificationDocumentNameMissing,
VerificationDocumentNationalityMismatch,
VerificationDocumentNotReadable,
VerificationDocumentNotSigned,
VerificationDocumentNotUploaded,
VerificationDocumentPhotoMismatch,
VerificationDocumentTooLarge,
VerificationDocumentTypeNotSupported,
VerificationFailedAddressMatch,
VerificationFailedBusinessIecNumber,
VerificationFailedDocumentMatch,
VerificationFailedIdNumberMatch,
VerificationFailedKeyedIdentity,
VerificationFailedKeyedMatch,
VerificationFailedNameMatch,
VerificationFailedOther,
VerificationFailedResidentialAddress,
VerificationFailedTaxIdMatch,
VerificationFailedTaxIdNotIssued,
VerificationMissingExecutives,
VerificationMissingOwners,
VerificationRequiresAdditionalMemorandumOfAssociations,
}

impl AccountRequirementsErrorCode {
pub fn as_str(self) -> &'static str {
match self {
AccountRequirementsErrorCode::InvalidAddressCityStatePostalCode => "invalid_address_city_state_postal_code",
AccountRequirementsErrorCode::InvalidDobAgeUnder18 => "invalid_dob_age_under_18",
AccountRequirementsErrorCode::InvalidRepresentativeCountry => "invalid_representative_country",
AccountRequirementsErrorCode::InvalidStreetAddress => "invalid_street_address",
AccountRequirementsErrorCode::InvalidTosAcceptance => "invalid_tos_acceptance",
AccountRequirementsErrorCode::InvalidValueOther => "invalid_value_other",
AccountRequirementsErrorCode::VerificationDocumentAddressMismatch => "verification_document_address_mismatch",
AccountRequirementsErrorCode::VerificationDocumentAddressMissing => "verification_document_address_missing",
AccountRequirementsErrorCode::VerificationDocumentCorrupt => "verification_document_corrupt",
AccountRequirementsErrorCode::VerificationDocumentCountryNotSupported => "verification_document_country_not_supported",
AccountRequirementsErrorCode::VerificationDocumentDobMismatch => "verification_document_dob_mismatch",
AccountRequirementsErrorCode::VerificationDocumentDuplicateType => "verification_document_duplicate_type",
AccountRequirementsErrorCode::VerificationDocumentExpired => "verification_document_expired",
AccountRequirementsErrorCode::VerificationDocumentFailedCopy => "verification_document_failed_copy",
AccountRequirementsErrorCode::VerificationDocumentFailedGreyscale => "verification_document_failed_greyscale",
AccountRequirementsErrorCode::VerificationDocumentFailedOther => "verification_document_failed_other",
AccountRequirementsErrorCode::VerificationDocumentFailedTestMode => "verification_document_failed_test_mode",
AccountRequirementsErrorCode::VerificationDocumentFraudulent => "verification_document_fraudulent",
AccountRequirementsErrorCode::VerificationDocumentIdNumberMismatch => "verification_document_id_number_mismatch",
AccountRequirementsErrorCode::VerificationDocumentIdNumberMissing => "verification_document_id_number_missing",
AccountRequirementsErrorCode::VerificationDocumentIncomplete => "verification_document_incomplete",
AccountRequirementsErrorCode::VerificationDocumentInvalid => "verification_document_invalid",
AccountRequirementsErrorCode::VerificationDocumentIssueOrExpiryDateMissing => "verification_document_issue_or_expiry_date_missing",
AccountRequirementsErrorCode::VerificationDocumentManipulated => "verification_document_manipulated",
AccountRequirementsErrorCode::VerificationDocumentMissingBack => "verification_document_missing_back",
AccountRequirementsErrorCode::VerificationDocumentMissingFront => "verification_document_missing_front",
AccountRequirementsErrorCode::VerificationDocumentNameMismatch => "verification_document_name_mismatch",
AccountRequirementsErrorCode::VerificationDocumentNameMissing => "verification_document_name_missing",
AccountRequirementsErrorCode::VerificationDocumentNationalityMismatch => "verification_document_nationality_mismatch",
AccountRequirementsErrorCode::VerificationDocumentNotReadable => "verification_document_not_readable",
AccountRequirementsErrorCode::VerificationDocumentNotSigned => "verification_document_not_signed",
AccountRequirementsErrorCode::VerificationDocumentNotUploaded => "verification_document_not_uploaded",
AccountRequirementsErrorCode::VerificationDocumentPhotoMismatch => "verification_document_photo_mismatch",
AccountRequirementsErrorCode::VerificationDocumentTooLarge => "verification_document_too_large",
AccountRequirementsErrorCode::VerificationDocumentTypeNotSupported => "verification_document_type_not_supported",
AccountRequirementsErrorCode::VerificationFailedAddressMatch => "verification_failed_address_match",
AccountRequirementsErrorCode::VerificationFailedBusinessIecNumber => "verification_failed_business_iec_number",
AccountRequirementsErrorCode::VerificationFailedDocumentMatch => "verification_failed_document_match",
AccountRequirementsErrorCode::VerificationFailedIdNumberMatch => "verification_failed_id_number_match",
AccountRequirementsErrorCode::VerificationFailedKeyedIdentity => "verification_failed_keyed_identity",
AccountRequirementsErrorCode::VerificationFailedKeyedMatch => "verification_failed_keyed_match",
AccountRequirementsErrorCode::VerificationFailedNameMatch => "verification_failed_name_match",
AccountRequirementsErrorCode::VerificationFailedOther => "verification_failed_other",
AccountRequirementsErrorCode::VerificationFailedResidentialAddress => "verification_failed_residential_address",
AccountRequirementsErrorCode::VerificationFailedTaxIdMatch => "verification_failed_tax_id_match",
AccountRequirementsErrorCode::VerificationFailedTaxIdNotIssued => "verification_failed_tax_id_not_issued",
AccountRequirementsErrorCode::VerificationMissingExecutives => "verification_missing_executives",
AccountRequirementsErrorCode::VerificationMissingOwners => "verification_missing_owners",
AccountRequirementsErrorCode::VerificationRequiresAdditionalMemorandumOfAssociations => "verification_requires_additional_memorandum_of_associations",
}
}
}

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

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

/// An enum representing the possible values of an `BankAccount`'s `available_payout_methods` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
2 changes: 1 addition & 1 deletion src/resources/generated/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct Card {

/// Card brand.
///
/// Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
/// Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
#[serde(skip_serializing_if = "Option::is_none")]
pub brand: Option<String>,

Expand Down
Loading

0 comments on commit a76703c

Please sign in to comment.