Skip to content

Commit

Permalink
Merge pull request arlyon#72 from arlyon/feat/openapi-27072021
Browse files Browse the repository at this point in the history
Generate latest changes from OpenApi spec
  • Loading branch information
arlyon authored Aug 19, 2021
2 parents a422c83 + df85d6b commit ccc9329
Show file tree
Hide file tree
Showing 41 changed files with 3,920 additions and 177 deletions.
4 changes: 2 additions & 2 deletions openapi/src/mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ pub fn field_mappings() -> FieldMap {
(("list_skus", "attributes"), ("Metadata", "Option<Metadata>")),
(("create_sku", "attributes"), ("Metadata", "Option<Metadata>")),
(("update_sku", "attributes"), ("Metadata", "Option<Metadata>")),
(("create_sku", "inventory"), ("Inventory", "Option<Inventory>")),
(("update_sku", "inventory"), ("Inventory", "Option<Inventory>")),
(("create_sku", "inventory"), ("SkuInventory", "Option<SkuInventory>")),
(("update_sku", "inventory"), ("SkuInventory", "Option<SkuInventory>")),
(("create_sku", "package_dimensions"), ("PackageDimensions", "Option<PackageDimensions>")),
(("update_sku", "package_dimensions"), ("PackageDimensions", "Option<PackageDimensions>")),

Expand Down
2 changes: 2 additions & 0 deletions src/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ def_id!(PlanId: String); // N.B. A plan id can be user-provided so can be any ar
def_id!(PriceId: String); // TODO: Figure out what prefix this id has
def_id!(ProductId: String); // N.B. A product id can be user-provided so can be any arbitrary string
def_id!(PromotionCodeId, "promo_"); // N.B. A product id can be user-provided so can be any arbitrary string
def_id!(QuoteId, "qt_");
def_id!(RecipientId: String); // FIXME: This doesn't seem to be documented yet
def_id!(RefundId, "re_");
def_id!(ReviewId, "prv_");
Expand All @@ -532,6 +533,7 @@ def_id!(SubscriptionItemId, "si_");
def_id!(SubscriptionLineId, "sli_");
def_id!(SubscriptionScheduleId, "sub_sched_");
def_id!(TaxIdId, "txi_");
def_id!(TaxCodeId, "txcd_");
def_id!(TaxRateId, "txr_");
def_id!(
enum TokenId {
Expand Down
2 changes: 2 additions & 0 deletions src/resources/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod core {
pub mod reserve_transaction;
pub mod setup_attempt;
pub mod setup_intent;
pub mod tax_code;
pub mod tax_deducted_at_source;
pub mod token;
}
Expand Down Expand Up @@ -58,6 +59,7 @@ pub mod billing {
pub mod plan;
pub mod price;
pub mod promotion_code;
pub mod quote;
pub mod subscription;
pub mod subscription_item;
pub mod subscription_schedule;
Expand Down
159 changes: 140 additions & 19 deletions src/resources/generated/account.rs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/resources/generated/bank_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ pub struct BankAccount {
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type: Option<AccountHolderType>,

/// The bank account type.
///
/// This can only be `checking` or `savings` in most countries.
/// In Japan, this can only be `futsu` or `toza`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_type: Option<String>,

/// A set of available payout methods for this bank account.
///
/// Only values from this set should be passed as the `method` when creating a payout.
Expand Down
146 changes: 145 additions & 1 deletion src/resources/generated/billing_portal_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ pub struct BillingPortalSession {
/// 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,

/// The IETF language tag of the locale Customer Portal is displayed in.
///
/// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<BillingPortalSessionLocale>,

/// The account for which the session was created on behalf of.
///
/// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal.
Expand Down Expand Up @@ -67,7 +73,7 @@ impl Object for BillingPortalSession {
/// The parameters for `BillingPortalSession::create`.
#[derive(Clone, Debug, Serialize)]
pub struct CreateBillingPortalSession<'a> {
/// The [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features.
/// The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features.
///
/// If not specified, the session uses the default configuration.
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -80,6 +86,12 @@ pub struct CreateBillingPortalSession<'a> {
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],

/// The IETF language tag of the locale Customer Portal is displayed in.
///
/// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
#[serde(skip_serializing_if = "Option::is_none")]
pub locale: Option<BillingPortalSessionLocale>,

/// The `on_behalf_of` account to use for this session.
///
/// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal.
Expand All @@ -99,8 +111,140 @@ impl<'a> CreateBillingPortalSession<'a> {
configuration: Default::default(),
customer,
expand: Default::default(),
locale: Default::default(),
on_behalf_of: Default::default(),
return_url: Default::default(),
}
}
}

/// An enum representing the possible values of an `BillingPortalSession`'s `locale` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BillingPortalSessionLocale {
Auto,
Bg,
Cs,
Da,
De,
El,
En,
#[serde(rename = "en-AU")]
EnAu,
#[serde(rename = "en-CA")]
EnCa,
#[serde(rename = "en-GB")]
EnGb,
#[serde(rename = "en-IE")]
EnIe,
#[serde(rename = "en-IN")]
EnIn,
#[serde(rename = "en-NZ")]
EnNz,
#[serde(rename = "en-SG")]
EnSg,
Es,
#[serde(rename = "es-419")]
Es419,
Et,
Fi,
Fil,
Fr,
#[serde(rename = "fr-CA")]
FrCa,
Hr,
Hu,
Id,
It,
Ja,
Ko,
Lt,
Lv,
Ms,
Mt,
Nb,
Nl,
Pl,
Pt,
#[serde(rename = "pt-BR")]
PtBr,
Ro,
Ru,
Sk,
Sl,
Sv,
Th,
Tr,
Vi,
Zh,
#[serde(rename = "zh-HK")]
ZhHk,
#[serde(rename = "zh-TW")]
ZhTw,
}

impl BillingPortalSessionLocale {
pub fn as_str(self) -> &'static str {
match self {
BillingPortalSessionLocale::Auto => "auto",
BillingPortalSessionLocale::Bg => "bg",
BillingPortalSessionLocale::Cs => "cs",
BillingPortalSessionLocale::Da => "da",
BillingPortalSessionLocale::De => "de",
BillingPortalSessionLocale::El => "el",
BillingPortalSessionLocale::En => "en",
BillingPortalSessionLocale::EnAu => "en-AU",
BillingPortalSessionLocale::EnCa => "en-CA",
BillingPortalSessionLocale::EnGb => "en-GB",
BillingPortalSessionLocale::EnIe => "en-IE",
BillingPortalSessionLocale::EnIn => "en-IN",
BillingPortalSessionLocale::EnNz => "en-NZ",
BillingPortalSessionLocale::EnSg => "en-SG",
BillingPortalSessionLocale::Es => "es",
BillingPortalSessionLocale::Es419 => "es-419",
BillingPortalSessionLocale::Et => "et",
BillingPortalSessionLocale::Fi => "fi",
BillingPortalSessionLocale::Fil => "fil",
BillingPortalSessionLocale::Fr => "fr",
BillingPortalSessionLocale::FrCa => "fr-CA",
BillingPortalSessionLocale::Hr => "hr",
BillingPortalSessionLocale::Hu => "hu",
BillingPortalSessionLocale::Id => "id",
BillingPortalSessionLocale::It => "it",
BillingPortalSessionLocale::Ja => "ja",
BillingPortalSessionLocale::Ko => "ko",
BillingPortalSessionLocale::Lt => "lt",
BillingPortalSessionLocale::Lv => "lv",
BillingPortalSessionLocale::Ms => "ms",
BillingPortalSessionLocale::Mt => "mt",
BillingPortalSessionLocale::Nb => "nb",
BillingPortalSessionLocale::Nl => "nl",
BillingPortalSessionLocale::Pl => "pl",
BillingPortalSessionLocale::Pt => "pt",
BillingPortalSessionLocale::PtBr => "pt-BR",
BillingPortalSessionLocale::Ro => "ro",
BillingPortalSessionLocale::Ru => "ru",
BillingPortalSessionLocale::Sk => "sk",
BillingPortalSessionLocale::Sl => "sl",
BillingPortalSessionLocale::Sv => "sv",
BillingPortalSessionLocale::Th => "th",
BillingPortalSessionLocale::Tr => "tr",
BillingPortalSessionLocale::Vi => "vi",
BillingPortalSessionLocale::Zh => "zh",
BillingPortalSessionLocale::ZhHk => "zh-HK",
BillingPortalSessionLocale::ZhTw => "zh-TW",
}
}
}

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

impl std::fmt::Display for BillingPortalSessionLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
24 changes: 13 additions & 11 deletions src/resources/generated/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,41 @@ impl Object for Capability {

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AccountCapabilityRequirements {
/// The date the fields in `currently_due` must be collected by to keep the capability enabled for the account.
/// Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account.
///
/// These fields may disable the capability sooner if the next threshold is reached before they are collected.
#[serde(skip_serializing_if = "Option::is_none")]
pub current_deadline: Option<Timestamp>,

/// The fields that need to be collected to keep the capability enabled.
/// Fields that need to be collected to keep the capability enabled.
///
/// If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
/// If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
pub currently_due: Vec<String>,

/// If the capability is disabled, this string describes why.
///
/// Possible values are `requirement.fields_needed`, `pending.onboarding`, `pending.review`, `rejected_fraud`, `rejected.unsupported_business` or `rejected.other`. `rejected.unsupported_business` means that the account's business is not supported by the capability.
/// Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`. `rejected.unsupported_business` means that the account's business is not supported by the capability.
/// For example, payment methods may restrict the businesses they support in their terms of service: - [Afterpay Clearpay's terms of service](/afterpay-clearpay/legal#restricted-businesses) If you believe that the rejection is in error, please contact [email protected] for assistance.
#[serde(skip_serializing_if = "Option::is_none")]
pub disabled_reason: Option<String>,

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

/// The fields that need to be collected assuming all volume thresholds are reached.
/// Fields that need to be collected assuming all volume thresholds are reached.
///
/// As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set.
/// As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
pub eventually_due: Vec<String>,

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

/// Fields that may become required depending on the results of verification or review.
///
/// An empty array unless an asynchronous verification is pending.
/// If verification fails, the fields in this array become required and move to `currently_due` or `past_due`.
/// 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: Vec<String>,
}

Expand Down
31 changes: 30 additions & 1 deletion src/resources/generated/charge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ pub struct PaymentMethodDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub bancontact: Option<PaymentMethodDetailsBancontact>,

#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<PaymentMethodDetailsBoleto>,

#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<PaymentMethodDetailsCard>,

Expand Down Expand Up @@ -415,6 +418,9 @@ pub struct PaymentMethodDetails {

#[serde(skip_serializing_if = "Option::is_none")]
pub wechat: Option<PaymentMethodDetailsWechat>,

#[serde(skip_serializing_if = "Option::is_none")]
pub wechat_pay: Option<PaymentMethodDetailsWechatPay>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down Expand Up @@ -510,7 +516,11 @@ pub struct PaymentMethodDetailsAcssDebit {
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsAfterpayClearpay {}
pub struct PaymentMethodDetailsAfterpayClearpay {
/// Order identifier shown to the merchant in Afterpay’s online portal.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsAuBecsDebit {
Expand Down Expand Up @@ -595,6 +605,12 @@ pub struct PaymentMethodDetailsBancontact {
pub verified_name: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsBoleto {
/// Uniquely identifies this customer tax_id (CNPJ or CPF).
pub tax_id: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsCard {
/// Card brand.
Expand Down Expand Up @@ -1112,6 +1128,19 @@ pub struct PaymentMethodDetailsStripeAccount {}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsWechat {}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetailsWechatPay {
/// Uniquely identifies this particular WeChat Pay account.
///
/// You can use this attribute to check whether two WeChat accounts are the same.
#[serde(skip_serializing_if = "Option::is_none")]
pub fingerprint: Option<String>,

/// Transaction ID of this particular WeChat Pay transaction.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_id: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Rule {
/// The action taken on the payment.
Expand Down
Loading

0 comments on commit ccc9329

Please sign in to comment.