From 18d653b8a223008aea9b6d51551c1e58179697aa Mon Sep 17 00:00:00 2001 From: Matthew Zeitlin <37011898+mzeitlin11@users.noreply.github.com> Date: Tue, 2 Apr 2024 12:02:18 -0400 Subject: [PATCH] wip --- Cargo.toml | 6 +- async-stripe/Cargo.toml | 107 +- async-stripe/build.rs | 23 - .../base/tokio_blocking.rs => blocking.rs} | 47 +- async-stripe/src/client.rs | 212 + async-stripe/src/client/base/async_std.rs | 216 - async-stripe/src/client/base/tokio.rs | 423 - async-stripe/src/client/mod.rs | 70 - async-stripe/src/client/stripe.rs | 240 - async-stripe/src/error.rs | 7 +- async-stripe/src/lib.rs | 76 +- crate_info.md | 5 - examples/endpoints/Cargo.toml | 21 +- examples/pagination/Cargo.toml | 9 +- examples/webhook-actix/Cargo.toml | 6 +- examples/webhook-rocket/Cargo.toml | 4 +- generated/stripe_billing/Cargo.toml | 15 +- .../billing_portal_configuration/requests.rs | 699 +- .../src/billing_portal_session/requests.rs | 211 +- .../src/credit_note/requests.rs | 832 +- .../src/credit_note_line_item/requests.rs | 73 +- .../stripe_billing/src/invoice/requests.rs | 6398 +++++------ .../src/invoice_item/requests.rs | 534 +- .../src/invoice_line_item/requests.rs | 266 +- generated/stripe_billing/src/mod.rs | 2 - generated/stripe_billing/src/plan/requests.rs | 435 +- .../stripe_billing/src/quote/requests.rs | 1362 ++- .../src/subscription/requests.rs | 3008 +++--- .../src/subscription_item/requests.rs | 831 +- .../src/subscription_schedule/requests.rs | 1607 ++- .../stripe_billing/src/tax_id/requests.rs | 747 +- .../src/test_helpers_test_clock/requests.rs | 316 +- .../src/usage_record/requests.rs | 112 +- .../src/usage_record_summary/requests.rs | 86 +- generated/stripe_checkout/Cargo.toml | 15 +- .../src/checkout_session/requests.rs | 2786 ++--- .../src/checkout_session/types.rs | 5 +- ...checkout_session_payment_method_options.rs | 2 - .../checkout_swish_payment_method_options.rs | 6 - generated/stripe_checkout/src/mod.rs | 8 - ...nt_pages_checkout_session_automatic_tax.rs | 6 +- ...ges_checkout_session_consent_collection.rs | 3 - ...ment_pages_checkout_session_custom_text.rs | 2 - ...pages_checkout_session_invoice_settings.rs | 3 - ..._session_payment_method_reuse_agreement.rs | 70 - generated/stripe_connect/Cargo.toml | 15 +- .../stripe_connect/src/account/requests.rs | 1228 ++- .../src/account_link/requests.rs | 221 +- .../src/account_session/requests.rs | 128 +- .../src/application_fee/requests.rs | 123 +- .../src/application_fee_refund/requests.rs | 284 +- .../src/apps_secret/requests.rs | 360 +- .../stripe_connect/src/capability/requests.rs | 169 +- ...edded_account_session_create_components.rs | 3 - .../src/connect_embedded_base_config_claim.rs | 1 - .../src/connect_embedded_base_features.rs | 2 - .../src/connect_embedded_payments_config.rs | 6 - .../src/connect_embedded_payments_features.rs | 10 - .../src/connect_embedded_payouts_config.rs | 6 - .../src/connect_embedded_payouts_features.rs | 12 - .../src/country_spec/requests.rs | 110 +- .../src/external_account/requests.rs | 456 +- .../stripe_connect/src/login_link/requests.rs | 58 +- generated/stripe_connect/src/mod.rs | 23 - .../stripe_connect/src/person/requests.rs | 596 +- .../stripe_connect/src/topup/requests.rs | 394 +- .../stripe_connect/src/transfer/requests.rs | 376 +- .../src/transfer_reversal/requests.rs | 326 +- generated/stripe_core/Cargo.toml | 17 +- generated/stripe_core/src/balance/requests.rs | 47 +- .../src/balance_transaction/requests.rs | 147 +- .../stripe_core/src/cash_balance/requests.rs | 129 +- generated/stripe_core/src/charge/requests.rs | 628 +- .../stripe_core/src/customer/requests.rs | 2492 +++-- .../customer_balance_transaction/requests.rs | 281 +- .../requests.rs | 149 +- .../stripe_core/src/customer_session/mod.rs | 5 - .../src/customer_session/requests.rs | 58 - .../stripe_core/src/customer_session/types.rs | 22 - .../customer_session_resource_components.rs | 6 - ...resource_components_resource_buy_button.rs | 6 - ...ource_components_resource_pricing_table.rs | 6 - generated/stripe_core/src/dispute/requests.rs | 250 +- generated/stripe_core/src/event/requests.rs | 131 +- generated/stripe_core/src/file/requests.rs | 123 +- .../stripe_core/src/file_link/requests.rs | 296 +- generated/stripe_core/src/mandate/requests.rs | 49 +- generated/stripe_core/src/mod.rs | 23 +- .../src/payment_intent/requests.rs | 9499 ++++++++--------- .../src/payment_source/requests.rs | 187 +- generated/stripe_core/src/payout/requests.rs | 437 +- generated/stripe_core/src/refund/requests.rs | 454 +- .../stripe_core/src/setup_attempt/requests.rs | 71 +- .../stripe_core/src/setup_intent/requests.rs | 4476 ++++---- generated/stripe_core/src/token/requests.rs | 385 +- generated/stripe_fraud/Cargo.toml | 15 +- .../src/radar_early_fraud_warning/requests.rs | 130 +- .../src/radar_value_list/requests.rs | 304 +- .../src/radar_value_list_item/requests.rs | 219 +- generated/stripe_fraud/src/review/requests.rs | 160 +- generated/stripe_issuing/Cargo.toml | 15 +- .../src/issuing_authorization/requests.rs | 1033 +- .../src/issuing_card/requests.rs | 828 +- .../src/issuing_cardholder/requests.rs | 573 +- .../src/issuing_dispute/requests.rs | 636 +- .../src/issuing_token/requests.rs | 189 +- .../src/issuing_transaction/requests.rs | 554 +- generated/stripe_misc/Cargo.toml | 23 +- .../src/apple_pay_domain/requests.rs | 223 +- ...nk_connections_resource_balance_refresh.rs | 4 - ...onnections_resource_transaction_refresh.rs | 80 - ...transaction_resource_status_transitions.rs | 7 - .../stripe_misc/src/climate_order/mod.rs | 5 - .../stripe_misc/src/climate_order/requests.rs | 173 - .../stripe_misc/src/climate_order/types.rs | 179 - .../stripe_misc/src/climate_product/mod.rs | 5 - .../src/climate_product/requests.rs | 60 - .../stripe_misc/src/climate_product/types.rs | 32 - .../src/climate_removals_beneficiary.rs | 5 - .../src/climate_removals_location.rs | 13 - .../src/climate_removals_order_deliveries.rs | 13 - .../src/climate_removals_products_price.rs | 9 - .../stripe_misc/src/climate_supplier/mod.rs | 5 - .../src/climate_supplier/requests.rs | 60 - .../stripe_misc/src/climate_supplier/types.rs | 81 - .../stripe_misc/src/ephemeral_key/requests.rs | 137 +- .../stripe_misc/src/exchange_rate/requests.rs | 110 +- .../financial_connections_account/requests.rs | 450 +- .../financial_connections_account/types.rs | 56 - .../financial_connections_session/requests.rs | 175 +- .../financial_connections_session/types.rs | 3 - .../financial_connections_transaction/mod.rs | 5 - .../requests.rs | 91 - .../types.rs | 92 - .../src/gelato_id_number_report.rs | 2 +- .../identity_verification_report/requests.rs | 145 +- .../identity_verification_session/requests.rs | 615 +- generated/stripe_misc/src/mod.rs | 32 - .../src/reporting_report_run/requests.rs | 267 +- .../src/reporting_report_type/requests.rs | 101 +- .../src/scheduled_query_run/requests.rs | 113 +- .../src/tax_calculation/requests.rs | 336 +- .../src/tax_calculation_line_item.rs | 4 +- ...roduct_resource_line_item_tax_breakdown.rs | 4 +- .../src/tax_product_resource_tax_breakdown.rs | 4 +- ..._resource_tax_calculation_shipping_cost.rs | 4 +- ..._resource_tax_transaction_shipping_cost.rs | 4 +- .../src/tax_registration/requests.rs | 2258 ++-- .../stripe_misc/src/tax_settings/requests.rs | 136 +- .../src/tax_transaction/requests.rs | 378 +- .../src/tax_transaction_line_item.rs | 4 +- .../src/webhook_endpoint/requests.rs | 412 +- generated/stripe_payment/Cargo.toml | 15 +- .../src/bank_account/requests.rs | 757 +- generated/stripe_payment/src/card/requests.rs | 683 +- generated/stripe_payment/src/mod.rs | 7 - .../src/payment_link/requests.rs | 1774 ++- .../src/payment_method/requests.rs | 1386 ++- .../payment_method_configuration/requests.rs | 3244 +++--- .../src/payment_method_configuration/types.rs | 16 +- .../src/payment_method_domain/requests.rs | 309 +- .../stripe_payment/src/source/requests.rs | 766 +- generated/stripe_product/Cargo.toml | 15 +- .../stripe_product/src/coupon/requests.rs | 373 +- .../stripe_product/src/price/requests.rs | 697 +- .../stripe_product/src/product/requests.rs | 705 +- .../src/promotion_code/requests.rs | 381 +- .../src/shipping_rate/requests.rs | 351 +- .../stripe_product/src/tax_code/requests.rs | 109 +- .../stripe_product/src/tax_rate/requests.rs | 285 +- generated/stripe_shared/Cargo.toml | 1 - generated/stripe_shared/src/account.rs | 11 +- .../src/account_annual_revenue.rs | 12 - .../src/account_business_profile.rs | 5 - .../stripe_shared/src/account_capabilities.rs | 3 - .../src/account_invoices_settings.rs | 6 - .../stripe_shared/src/account_settings.rs | 2 - generated/stripe_shared/src/api_errors.rs | 13 - generated/stripe_shared/src/automatic_tax.rs | 6 +- .../stripe_shared/src/balance_transaction.rs | 28 +- .../src/connect_account_reference.rs | 63 - ...saction_resource_transferred_to_balance.rs | 5 - .../src/customer_cash_balance_transaction.rs | 2 - .../src/destination_details_unimplemented.rs | 2 - generated/stripe_shared/src/event.rs | 28 - generated/stripe_shared/src/file.rs | 2 +- generated/stripe_shared/src/invoice.rs | 1 - .../invoice_payment_method_options_card.rs | 3 - ..._us_bank_account_linked_account_options.rs | 3 - .../src/invoice_setting_quote_setting.rs | 3 +- ...ing_subscription_schedule_phase_setting.rs | 9 +- ...e_setting_subscription_schedule_setting.rs | 7 +- .../src/invoices_payment_settings.rs | 6 - ..._authorization_authentication_exemption.rs | 3 - .../src/issuing_cardholder_card_issuing.rs | 3 +- ...ssuing_cardholder_user_terms_acceptance.rs | 2 + .../stripe_shared/src/legal_entity_company.rs | 3 - .../linked_account_options_us_bank_account.rs | 3 - .../stripe_shared/src/mandate_bacs_debit.rs | 66 - .../src/mandate_us_bank_account.rs | 58 +- generated/stripe_shared/src/mod.rs | 80 - generated/stripe_shared/src/networks.rs | 3 +- generated/stripe_shared/src/payment_intent.rs | 6 +- .../src/payment_intent_next_action.rs | 3 - ...wish_handle_redirect_or_display_qr_code.rs | 11 - ...ayment_intent_next_action_swish_qr_code.rs | 12 - .../payment_intent_payment_method_options.rs | 2 - ...ment_intent_payment_method_options_blik.rs | 70 +- ...ment_intent_payment_method_options_card.rs | 20 +- ...ent_intent_payment_method_options_swish.rs | 73 - ..._payment_method_options_us_bank_account.rs | 2 - generated/stripe_shared/src/payment_link.rs | 9 +- .../payment_links_resource_automatic_tax.rs | 6 +- ...yment_links_resource_completed_sessions.rs | 7 - ...yment_links_resource_consent_collection.rs | 3 - .../src/payment_links_resource_custom_text.rs | 2 - ...payment_links_resource_invoice_settings.rs | 3 - ...ment_links_resource_payment_intent_data.rs | 3 - ...resource_payment_method_reuse_agreement.rs | 68 - .../payment_links_resource_restrictions.rs | 4 - ...ayment_links_resource_subscription_data.rs | 3 - ...urce_subscription_data_invoice_settings.rs | 4 - generated/stripe_shared/src/payment_method.rs | 5 - .../src/payment_method_details.rs | 2 - .../src/payment_method_details_ideal.rs | 10 +- .../src/payment_method_details_p24.rs | 7 +- .../src/payment_method_details_swish.rs | 10 - .../stripe_shared/src/payment_method_ideal.rs | 10 +- ...options_us_bank_account_mandate_options.rs | 62 - .../stripe_shared/src/payment_method_p24.rs | 3 - .../stripe_shared/src/payment_method_swish.rs | 2 - generated/stripe_shared/src/quote.rs | 3 +- .../src/quotes_resource_automatic_tax.rs | 6 +- generated/stripe_shared/src/recurring.rs | 8 +- generated/stripe_shared/src/refund.rs | 5 +- .../src/refund_destination_details.rs | 64 - .../src/refund_destination_details_card.rs | 73 - .../src/refund_destination_details_generic.rs | 7 - .../src/schedules_phase_automatic_tax.rs | 6 +- ...up_attempt_payment_method_details_ideal.rs | 10 +- ...etup_intent_payment_method_options_card.rs | 12 +- ..._payment_method_options_us_bank_account.rs | 2 - generated/stripe_shared/src/subscription.rs | 6 +- .../src/subscription_automatic_tax.rs | 6 +- ...ubscription_payment_method_options_card.rs | 3 - .../src/subscription_schedule.rs | 3 +- ...ion_schedules_resource_default_settings.rs | 3 +- ...resource_default_settings_automatic_tax.rs | 6 +- ...ns_resource_billing_cycle_anchor_config.rs | 13 - ...subscriptions_resource_payment_settings.rs | 6 - generated/stripe_shared/src/tax_i_ds_owner.rs | 75 - generated/stripe_shared/src/tax_id.rs | 3 - generated/stripe_shared/src/tax_rate.rs | 70 - .../src/three_d_secure_details.rs | 75 +- .../src/three_d_secure_details_charge.rs | 138 +- generated/stripe_terminal/Cargo.toml | 15 +- .../src/terminal_configuration/requests.rs | 400 +- .../src/terminal_connection_token/requests.rs | 53 +- .../src/terminal_location/requests.rs | 349 +- .../src/terminal_reader/requests.rs | 958 +- .../src/terminal_reader/types.rs | 55 +- generated/stripe_treasury/Cargo.toml | 15 +- .../src/treasury_credit_reversal/requests.rs | 170 +- .../src/treasury_debit_reversal/requests.rs | 267 +- .../treasury_financial_account/requests.rs | 843 +- .../src/treasury_inbound_transfer/requests.rs | 564 +- .../src/treasury_outbound_payment/requests.rs | 967 +- .../treasury_outbound_transfer/requests.rs | 711 +- .../src/treasury_received_credit/requests.rs | 275 +- .../src/treasury_received_debit/requests.rs | 239 +- .../src/treasury_transaction/requests.rs | 177 +- .../treasury_transaction_entry/requests.rs | 168 +- openapi/src/codegen.rs | 13 +- openapi/src/object_writing.rs | 9 +- openapi/src/overrides.rs | 4 +- openapi/src/requests.rs | 27 +- openapi/src/rust_object.rs | 20 +- openapi/src/rust_type.rs | 4 - openapi/src/spec_inference.rs | 12 +- openapi/src/stripe_object.rs | 42 +- openapi/src/templates/cargo_toml.rs | 48 +- openapi/src/templates/requests.rs | 254 +- openapi/src/templates/structs.rs | 74 +- openapi/src/utils.rs | 7 - stripe_client_core/Cargo.toml | 21 + .../src}/headers.rs | 20 +- stripe_client_core/src/lib.rs | 7 + .../src}/request_strategy.rs | 11 +- stripe_client_core/src/stripe_request.rs | 82 + stripe_types/Cargo.toml | 6 +- stripe_webhook/src/generated/mod.rs | 58 - tests/Cargo.toml | 28 +- tests/tests/it/async_tests/mod.rs | 2 +- tests/tests/it/main.rs | 8 +- 294 files changed, 45612 insertions(+), 33475 deletions(-) delete mode 100644 async-stripe/build.rs rename async-stripe/src/{client/base/tokio_blocking.rs => blocking.rs} (53%) create mode 100644 async-stripe/src/client.rs delete mode 100644 async-stripe/src/client/base/async_std.rs delete mode 100644 async-stripe/src/client/base/tokio.rs delete mode 100644 async-stripe/src/client/mod.rs delete mode 100644 async-stripe/src/client/stripe.rs delete mode 100644 generated/stripe_checkout/src/checkout_swish_payment_method_options.rs delete mode 100644 generated/stripe_checkout/src/payment_pages_checkout_session_payment_method_reuse_agreement.rs delete mode 100644 generated/stripe_connect/src/connect_embedded_base_features.rs delete mode 100644 generated/stripe_connect/src/connect_embedded_payments_config.rs delete mode 100644 generated/stripe_connect/src/connect_embedded_payments_features.rs delete mode 100644 generated/stripe_connect/src/connect_embedded_payouts_config.rs delete mode 100644 generated/stripe_connect/src/connect_embedded_payouts_features.rs delete mode 100644 generated/stripe_core/src/customer_session/mod.rs delete mode 100644 generated/stripe_core/src/customer_session/requests.rs delete mode 100644 generated/stripe_core/src/customer_session/types.rs delete mode 100644 generated/stripe_core/src/customer_session_resource_components.rs delete mode 100644 generated/stripe_core/src/customer_session_resource_components_resource_buy_button.rs delete mode 100644 generated/stripe_core/src/customer_session_resource_components_resource_pricing_table.rs delete mode 100644 generated/stripe_misc/src/bank_connections_resource_transaction_refresh.rs delete mode 100644 generated/stripe_misc/src/bank_connections_resource_transaction_resource_status_transitions.rs delete mode 100644 generated/stripe_misc/src/climate_order/mod.rs delete mode 100644 generated/stripe_misc/src/climate_order/requests.rs delete mode 100644 generated/stripe_misc/src/climate_order/types.rs delete mode 100644 generated/stripe_misc/src/climate_product/mod.rs delete mode 100644 generated/stripe_misc/src/climate_product/requests.rs delete mode 100644 generated/stripe_misc/src/climate_product/types.rs delete mode 100644 generated/stripe_misc/src/climate_removals_beneficiary.rs delete mode 100644 generated/stripe_misc/src/climate_removals_location.rs delete mode 100644 generated/stripe_misc/src/climate_removals_order_deliveries.rs delete mode 100644 generated/stripe_misc/src/climate_removals_products_price.rs delete mode 100644 generated/stripe_misc/src/climate_supplier/mod.rs delete mode 100644 generated/stripe_misc/src/climate_supplier/requests.rs delete mode 100644 generated/stripe_misc/src/climate_supplier/types.rs delete mode 100644 generated/stripe_misc/src/financial_connections_transaction/mod.rs delete mode 100644 generated/stripe_misc/src/financial_connections_transaction/requests.rs delete mode 100644 generated/stripe_misc/src/financial_connections_transaction/types.rs delete mode 100644 generated/stripe_shared/src/account_annual_revenue.rs delete mode 100644 generated/stripe_shared/src/account_invoices_settings.rs delete mode 100644 generated/stripe_shared/src/connect_account_reference.rs delete mode 100644 generated/stripe_shared/src/customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance.rs delete mode 100644 generated/stripe_shared/src/destination_details_unimplemented.rs delete mode 100644 generated/stripe_shared/src/payment_intent_next_action_swish_handle_redirect_or_display_qr_code.rs delete mode 100644 generated/stripe_shared/src/payment_intent_next_action_swish_qr_code.rs delete mode 100644 generated/stripe_shared/src/payment_intent_payment_method_options_swish.rs delete mode 100644 generated/stripe_shared/src/payment_links_resource_completed_sessions.rs delete mode 100644 generated/stripe_shared/src/payment_links_resource_payment_method_reuse_agreement.rs delete mode 100644 generated/stripe_shared/src/payment_links_resource_restrictions.rs delete mode 100644 generated/stripe_shared/src/payment_links_resource_subscription_data_invoice_settings.rs delete mode 100644 generated/stripe_shared/src/payment_method_details_swish.rs delete mode 100644 generated/stripe_shared/src/payment_method_options_us_bank_account_mandate_options.rs delete mode 100644 generated/stripe_shared/src/payment_method_swish.rs delete mode 100644 generated/stripe_shared/src/refund_destination_details.rs delete mode 100644 generated/stripe_shared/src/refund_destination_details_card.rs delete mode 100644 generated/stripe_shared/src/refund_destination_details_generic.rs delete mode 100644 generated/stripe_shared/src/subscriptions_resource_billing_cycle_anchor_config.rs delete mode 100644 generated/stripe_shared/src/tax_i_ds_owner.rs create mode 100644 stripe_client_core/Cargo.toml rename {async-stripe/src/client => stripe_client_core/src}/headers.rs (71%) create mode 100644 stripe_client_core/src/lib.rs rename {async-stripe/src/client => stripe_client_core/src}/request_strategy.rs (95%) create mode 100644 stripe_client_core/src/stripe_request.rs diff --git a/Cargo.toml b/Cargo.toml index afa6c7ef0..a8b98f820 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,10 @@ [workspace] members = [ - "async-stripe", "stripe_types", "stripe_webhook", "tests", "generated/*", - "examples/*", + "examples/*", "stripe_client_core", "async-stripe" ] # Skip "examples/*" when running default commands since that adds a bunch of deps that makes @@ -37,6 +36,5 @@ edition = "2021" [workspace.dependencies] serde = { version = ">=1.0.79", features = ["derive"] } # we use `serde(other)` which was introduced in 1.0.79 -http-types = { version = "2.12.0", default-features = false } smol_str = { version = "0.2.0", features = ["serde"] } -serde_json = "1.0" \ No newline at end of file +serde_json = "1.0" diff --git a/async-stripe/Cargo.toml b/async-stripe/Cargo.toml index a3b75428a..8ad4304f5 100644 --- a/async-stripe/Cargo.toml +++ b/async-stripe/Cargo.toml @@ -1,106 +1,35 @@ [package] name = "async-stripe" version.workspace = true -edition.workspace = true +description.workspace = true rust-version.workspace = true authors.workspace = true license.workspace = true +readme.workspace = true homepage.workspace = true repository.workspace = true +documentation.workspace = true keywords.workspace = true categories.workspace = true - -[package.metadata.docs.rs] -features = ["runtime-tokio-hyper"] +edition.workspace = true [lib] name = "stripe" -[features] -default = ["uuid", "stream"] - -stream = [] - -# runtimes -async = ["futures-util"] -blocking = [] - -runtime-tokio-hyper = [ - "tokio", - "hyper-client", - "hyper-tls", - "async", -] -runtime-tokio-hyper-rustls = [ - "tokio", - "hyper-client", - "hyper-rustls", - "hyper-rustls-native", - "async", -] -runtime-tokio-hyper-rustls-webpki = [ - "tokio", - "hyper-client", - "hyper-rustls-webpki", - "async", -] -runtime-blocking = [ - "tokio", - "tokio/rt", - "hyper-client", - "hyper-tls", - "blocking", -] -runtime-blocking-rustls = [ - "tokio", - "tokio/rt", - "hyper-client", - "hyper-rustls-native", - "blocking", -] -runtime-blocking-rustls-webpki = [ - "tokio", - "tokio/rt", - "hyper-client", - "hyper-rustls-webpki", - "blocking", -] -runtime-async-std-surf = [ - "async-std", - "surf", - "async", -] - -# we need the compat crate if using hyper -hyper-client = ["hyper", "http-types/hyperium_http"] - -hyper-rustls-native = ["hyper-rustls", "hyper-rustls/native-tokio"] -hyper-rustls-webpki = ["hyper-rustls", "hyper-rustls/webpki-tokio"] - [dependencies] -stripe_types = {path = "../stripe_types"} -stripe_shared = {path = "../generated/stripe_shared"} -async-std = {version = "1.8,<1.11", optional = true} - -thiserror = "1.0.24" -hyper = { version = "0.14", default-features = false, features = ["http1", "http2", "client", "tcp"], optional = true } -hyper-tls = { version = "0.5", optional = true } -hyper-rustls = { version = "0.24", default-features = false, features = ["http1", "http2", "tls12", "logging"], optional = true } -serde_json.workspace = true +hyper = { version = "0.14.28", default-features = false, features = ["http1", "http2", "client"] } +hyper-tls = { version = "0.5.0" } +stripe_types = { path = "../stripe_types" } +stripe_shared = { path = "../generated/stripe_shared" } +serde = "1.0.197" +thiserror = "1.0.58" serde_qs = "0.12.0" -serde_path_to_error = "0.1.8" -surf = { version = "2.1", optional = true } -tokio = { version = "1.2", optional = true } -uuid = { version = "1.6.1", optional=true, features=["v4"] } +serde_path_to_error = "0.1.16" +serde_json = "1.0.115" +stripe_client_core = { path = "../stripe_client_core" } +http = "1.1.0" +tokio = { version = "1.24.1", features = ["rt", "macros"] } +bytes = "1.5.0" -serde.workspace = true -http-types.workspace = true -smol_str.workspace = true - -# stream for lists -futures-util = { version = "0.3.21", optional = true } - -[dev-dependencies] -httpmock = "0.6.7" -async-std = { version = "1.10.0", features = ["attributes"] } -tokio = { version = "1.24.1", features = ["rt", "macros"] } \ No newline at end of file +[features] +blocking = [] \ No newline at end of file diff --git a/async-stripe/build.rs b/async-stripe/build.rs deleted file mode 100644 index 52fd48b1e..000000000 --- a/async-stripe/build.rs +++ /dev/null @@ -1,23 +0,0 @@ -fn main() { - #[cfg(not(any( - feature = "runtime-tokio-hyper", - feature = "runtime-tokio-hyper-rustls", - feature = "runtime-tokio-hyper-rustls-webpki", - feature = "runtime-blocking", - feature = "runtime-blocking-rustls", - feature = "runtime-blocking-rustls-webpki", - feature = "runtime-async-std-surf", - )))] - compile_error!( - r"one of the following runtime features must be enabled: - [ - 'runtime-tokio-hyper', - 'runtime-tokio-hyper-rustls', - 'runtime-tokio-hyper-rustls-webpki', - 'runtime-blocking', - 'runtime-blocking-rustls', - 'runtime-blocking-rustls-webpki', - 'runtime-async-std-surf' - ]" - ); -} diff --git a/async-stripe/src/client/base/tokio_blocking.rs b/async-stripe/src/blocking.rs similarity index 53% rename from async-stripe/src/client/base/tokio_blocking.rs rename to async-stripe/src/blocking.rs index e29be6c22..baff43f7f 100644 --- a/async-stripe/src/client/base/tokio_blocking.rs +++ b/async-stripe/src/blocking.rs @@ -1,50 +1,43 @@ -#![allow(clippy::missing_errors_doc)] +use std::fmt::Display; use std::{sync::Arc, time::Duration}; -use http_types::Request; use serde::de::DeserializeOwned; +use stripe_client_core::{CustomizedStripeRequest, StripeBlockingClient, StripeClient}; -use crate::client::base::tokio::TokioClient; -use crate::client::request_strategy::RequestStrategy; use crate::error::StripeError; /// The delay after which the blocking `Client` will assume the request has failed. const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30); -pub type Response = Result; - -#[inline(always)] -pub(crate) fn err(err: crate::StripeError) -> Response { - Err(err) -} - -#[derive(Clone)] -pub struct TokioBlockingClient { - inner: TokioClient, +pub struct Client { + inner: crate::Client, runtime: Arc, } -impl TokioBlockingClient { +impl Client { /// Creates a new client pointed to `https://api.stripe.com/` - pub fn new() -> TokioBlockingClient { - TokioBlockingClient::from_async(TokioClient::new()) + pub fn new(secret_key: impl Display) -> Client { + Client::from_async(crate::Client::new(secret_key)) } - fn from_async(inner: TokioClient) -> TokioBlockingClient { + fn from_async(inner: crate::Client) -> Client { let runtime = tokio::runtime::Builder::new_current_thread() .enable_io() .enable_time() // use separate `io/time` instead of `all` to ensure `tokio/time` is enabled .build() .expect("should be able to get a runtime"); - TokioBlockingClient { inner, runtime: Arc::new(runtime) } + Client { inner, runtime: Arc::new(runtime) } } +} - pub fn execute( +impl StripeBlockingClient for Client { + type Err = StripeError; + + fn execute( &self, - request: Request, - strategy: &RequestStrategy, - ) -> Response { - let future = self.inner.execute(request, strategy); + req: CustomizedStripeRequest, + ) -> Result { + let future = self.inner.execute(req); match self.runtime.block_on(async { // N.B. The `tokio::time::timeout` must be called from within a running async // context or else it will panic (it registers with the thread-local timer). @@ -55,9 +48,3 @@ impl TokioBlockingClient { } } } - -impl Default for TokioBlockingClient { - fn default() -> Self { - Self::new() - } -} diff --git a/async-stripe/src/client.rs b/async-stripe/src/client.rs new file mode 100644 index 000000000..57220ec88 --- /dev/null +++ b/async-stripe/src/client.rs @@ -0,0 +1,212 @@ +use std::fmt::Display; + +use bytes::Bytes; +use http::Uri; +use hyper::client::HttpConnector; +use hyper::http::request::Builder; +use hyper::http::HeaderValue; +use hyper::{Body, Request, StatusCode}; +use hyper_tls::HttpsConnector; +use serde::de::DeserializeOwned; +use stripe_client_core::headers::Headers; +use stripe_client_core::request_strategy::{Outcome, RequestStrategy, StripeStatusCode}; +use stripe_client_core::{CustomizedStripeRequest, StripeMethod}; +use stripe_shared::ApiErrors; + +use crate::StripeError; + +pub struct Client { + client: hyper::Client, Body>, + secret_header_val: HeaderValue, + headers: Headers, + api_base: Uri, +} + +fn connector() -> hyper::Client, Body> { + hyper::Client::builder().pool_max_idle_per_host(0).build(HttpsConnector::new()) +} + +fn clone_builder(_builder: &Builder) -> Builder { + todo!("skipping for now since easier once hyper bumped to 1") +} + +impl Client { + pub fn new(secret_key: impl Display) -> Self { + let mut secret_header = + HeaderValue::from_str(&format!("Bearer {secret_key}")).expect("invalid secret key"); + secret_header.set_sensitive(true); + Self { + client: connector(), + secret_header_val: secret_header, + headers: Headers::default(), + api_base: Uri::from_static("https://api.stripe.com/"), + } + } + + async fn send_inner( + &self, + body: Option, + mut req_builder: Builder, + strategy: RequestStrategy, + ) -> Result { + let mut tries = 0; + let mut last_status: Option = None; + let mut last_retry_header: Option = None; + let mut last_error = StripeError::ClientError("invalid strategy".into()); + + if let Some(key) = strategy.get_key() { + req_builder = req_builder.header("Idempotency-Key", key); + } + + loop { + return match strategy.test( + last_status.map(|s| StripeStatusCode(s.as_u16())), + last_retry_header, + tries, + ) { + Outcome::Stop => Err(last_error), + Outcome::Continue(duration) => { + if let Some(duration) = duration { + tokio::time::sleep(duration).await; + } + + let req_body = if let Some(body) = body.clone() { + Body::from(body) + } else { + Body::empty() + }; + let req = clone_builder(&req_builder).body(req_body)?; + let response = match self.client.request(req).await { + Ok(resp) => resp, + Err(err) => { + last_error = StripeError::from(err); + tries += 1; + continue; + } + }; + let status = response.status(); + let retry = response + .headers() + .get("Stripe-Should-Retry") + .and_then(|s| s.to_str().ok()) + .and_then(|s| s.parse().ok()); + + let bytes = hyper::body::to_bytes(response.into_body()).await?; + if !status.is_success() { + tries += 1; + let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); + last_error = serde_path_to_error::deserialize(json_deserializer).map( + |e: ApiErrors| StripeError::Stripe(Box::new(e), status.as_u16()), + )?; + last_status = Some(status); + last_retry_header = retry; + continue; + } + Ok(bytes) + } + }; + } + } +} + +fn conv_stripe_method(method: StripeMethod) -> hyper::Method { + match method { + StripeMethod::Get => hyper::Method::GET, + StripeMethod::Post => hyper::Method::POST, + StripeMethod::Delete => hyper::Method::DELETE, + } +} + +impl stripe_client_core::StripeClient for Client { + type Err = StripeError; + + async fn execute(&self, req_full: CustomizedStripeRequest) -> Result + where + T: DeserializeOwned, + { + let req = req_full.inner; + let mut uri = format!("{}v1/{}", self.api_base, req.path.trim_start_matches('/')); + if let Some(query) = req.query { + uri = format!("{uri}?{query}"); + } + + let mut builder = Request::builder() + .method(conv_stripe_method(req.method)) + .uri(uri) + .header("authorization", self.secret_header_val.clone()); + + for (key, value) in self.headers.to_array().iter().filter_map(|(k, v)| v.map(|v| (*k, v))) { + builder = builder.header(key, value); + } + let body = if let Some(body) = req.body { + builder = builder.header( + "content-type", + HeaderValue::from_static("application/x-www-form-urlencoded"), + ); + Some(Bytes::from(body)) + } else { + None + }; + + let bytes = self.send_inner(body, builder, req_full.request_strategy).await?; + let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); + Ok(serde_path_to_error::deserialize(json_deserializer)?) + } +} + +#[cfg(test)] +mod tests { + use serde::{Deserialize, Serialize}; + use stripe_client_core::{RequestBuilder, StripeClient, StripeMethod, StripeRequest}; + + use crate::Client; + + #[derive(Serialize)] + struct Inner<'a> { + pub param: &'a str, + pub opt: Option<&'a str>, + } + + struct RetrieveAccount<'a> { + inner: Inner<'a>, + id: String, + } + + #[derive(Deserialize, Debug)] + struct Account { + pub acct: String, + } + + impl<'a> RetrieveAccount<'a> { + pub fn new(id: String, param: &'a str) -> Self { + Self { id, inner: Inner { param, opt: None } } + } + } + + impl StripeRequest for RetrieveAccount<'_> { + type Output = Account; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, format!("/hi/{}", self.id)).query(&self.inner) + } + } + + impl RetrieveAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + } + + #[tokio::test] + async fn simple_req() { + let client = Client::new("secret"); + let ret = RetrieveAccount::new("id".into(), "param").send(&client).await.unwrap(); + println!("{ret:?}"); + + let ret2 = + RetrieveAccount::new("id".into(), "param").customize().send(&client).await.unwrap(); + } +} diff --git a/async-stripe/src/client/base/async_std.rs b/async-stripe/src/client/base/async_std.rs deleted file mode 100644 index b13c56da8..000000000 --- a/async-stripe/src/client/base/async_std.rs +++ /dev/null @@ -1,216 +0,0 @@ -use std::future::{self, Future}; -use std::pin::Pin; - -use async_std::task::sleep; -use http_types::{Request, StatusCode}; -use serde::de::DeserializeOwned; - -use crate::client::request_strategy::{Outcome, RequestStrategy}; -use crate::error::StripeError; - -pub type Response = Pin> + Send>>; - -#[inline(always)] -pub(crate) fn err(err: StripeError) -> Response { - Box::pin(future::ready(Err(err))) -} - -#[derive(Clone)] -pub struct AsyncStdClient { - client: surf::Client, -} - -impl AsyncStdClient { - /// Creates a new client pointed to `https://api.stripe.com/` - pub fn new() -> Self { - Self { client: surf::Client::new() } - } - - pub fn execute( - &self, - request: Request, - strategy: &RequestStrategy, - ) -> Response { - // need to clone here since client could be used across threads. - // N.B. Client is send sync; cloned clients share the same pool. - let client = self.client.clone(); - let strategy = strategy.clone(); - - Box::pin(async move { - let bytes = send_inner(&client, request, &strategy).await?; - let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); - serde_path_to_error::deserialize(json_deserializer).map_err(StripeError::from) - }) - } -} - -impl Default for AsyncStdClient { - fn default() -> Self { - Self::new() - } -} - -async fn send_inner( - client: &surf::Client, - mut request: Request, - strategy: &RequestStrategy, -) -> Result, StripeError> { - let mut tries = 0; - let mut last_status: Option = None; - let mut last_retry_header: Option = None; - - // if we have no last error, then the strategy is invalid - let mut last_error = StripeError::ClientError("Invalid strategy".to_string()); - - if let Some(key) = strategy.get_key() { - request.insert_header("Idempotency-Key", key); - } - - let body = request.body_bytes().await?; - - loop { - return match strategy.test(last_status, last_retry_header, tries) { - Outcome::Stop => Err(last_error), - Outcome::Continue(duration) => { - if let Some(duration) = duration { - sleep(duration).await; - } - - // we need to clone the request before sending it so we can - // re-use it if we need to retry. ditto for the body - let mut request = request.clone(); - request.set_body(body.clone()); - - let mut response = match client.send(request).await { - Ok(response) => response, - Err(err) => { - last_error = StripeError::from(err); - tries += 1; - continue; - } - }; - - let status = response.status(); - let retry = response - .header("Stripe-Should-Retry") - .and_then(|s| s.last().as_str().parse().ok()); - - // if this fails parsing, we can probably just exit - let bytes = response.body_bytes().await?; - - if !status.is_success() { - tries += 1; - let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); - last_error = serde_path_to_error::deserialize(json_deserializer) - .map(|e: stripe_shared::Error| StripeError::Stripe(*e.error, status.into())) - .unwrap_or_else(StripeError::from); - last_status = Some(status); - last_retry_header = retry; - - continue; - } - - Ok(bytes) - } - }; - } -} - -#[cfg(test)] -mod tests { - use http_types::{Request, Url}; - use httpmock::prelude::*; - - use super::AsyncStdClient; - use crate::{client::request_strategy::RequestStrategy, StripeError}; - - #[async_std::test] - async fn retry() { - let client = AsyncStdClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(GET).path("/server-errors"); - then.status(500); - }); - - let req = Request::get(Url::parse(&server.url("/server-errors")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(5).await; - assert!(res.is_err()); - } - - #[async_std::test] - async fn user_error() { - let client = AsyncStdClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - let mock = server.mock(|when, then| { - when.method(GET).path("/v1/missing"); - then.status(404).body("{ - \"error\": { - \"message\": \"Unrecognized request URL (GET: /v1/missing). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.\", - \"type\": \"invalid_request_error\" - } - } - "); - }); - - let req = Request::get(Url::parse(&server.url("/v1/missing")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(3)).await; - - mock.assert_hits_async(1).await; - - match res { - Err(StripeError::Stripe(x, _)) => println!("{:?}", x), - _ => panic!("Expected stripe error {:?}", res), - } - } - - #[async_std::test] - async fn retry_header() { - let client = AsyncStdClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(GET).path("/server-errors"); - then.status(500).header("Stripe-Should-Retry", "false"); - }); - - let req = Request::get(Url::parse(&server.url("/server-errors")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(1).await; - assert!(res.is_err()); - } - - #[async_std::test] - async fn retry_body() { - let client = AsyncStdClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(POST).path("/server-errors").body("body"); - then.status(500); - }); - - let mut req = Request::post(Url::parse(&server.url("/server-errors")).unwrap()); - req.set_body("body"); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(5).await; - assert!(res.is_err()); - } -} diff --git a/async-stripe/src/client/base/tokio.rs b/async-stripe/src/client/base/tokio.rs deleted file mode 100644 index c0b8e0d66..000000000 --- a/async-stripe/src/client/base/tokio.rs +++ /dev/null @@ -1,423 +0,0 @@ -use std::future::{self, Future}; -use std::pin::Pin; - -use http_types::{Request, StatusCode}; -use hyper::http; -use hyper::{client::HttpConnector, Body}; -use serde::de::DeserializeOwned; -use tokio::time::sleep; - -use crate::client::request_strategy::{Outcome, RequestStrategy}; -use crate::error::StripeError; - -#[cfg(feature = "hyper-rustls-native")] -mod connector { - use hyper::client::{connect::dns::GaiResolver, HttpConnector}; - pub use hyper_rustls::HttpsConnector; - use hyper_rustls::HttpsConnectorBuilder; - - pub fn create() -> HttpsConnector> { - HttpsConnectorBuilder::new() - .with_native_roots() - .https_or_http() - .enable_http1() - .enable_http2() - .build() - } -} - -#[cfg(feature = "hyper-rustls-webpki")] -mod connector { - use hyper::client::{connect::dns::GaiResolver, HttpConnector}; - pub use hyper_rustls::HttpsConnector; - use hyper_rustls::HttpsConnectorBuilder; - - pub fn create() -> HttpsConnector> { - HttpsConnectorBuilder::new() - .with_webpki_roots() - .https_or_http() - .enable_http1() - .enable_http2() - .build() - } -} - -#[cfg(feature = "hyper-tls")] -mod connector { - use hyper::client::{connect::dns::GaiResolver, HttpConnector}; - pub use hyper_tls::HttpsConnector; - - pub fn create() -> HttpsConnector> { - HttpsConnector::new() - } -} - -#[cfg(all(feature = "hyper-tls", feature = "hyper-rustls"))] -compile_error!("You must enable only one TLS implementation"); - -type HttpClient = hyper::Client, Body>; - -pub type Response = Pin> + Send>>; - -#[allow(dead_code)] -#[inline(always)] -pub(crate) fn err(err: StripeError) -> Response { - Box::pin(future::ready(Err(err))) -} - -#[derive(Clone)] -pub struct TokioClient { - client: HttpClient, -} - -impl TokioClient { - pub fn new() -> Self { - Self { - client: hyper::Client::builder().pool_max_idle_per_host(0).build(connector::create()), - } - } - - pub fn execute( - &self, - request: Request, - strategy: &RequestStrategy, - ) -> Response { - // need to clone here since client could be used across threads. - // N.B. Client is send sync; cloned clients share the same pool. - let client = self.client.clone(); - let strategy = strategy.clone(); - - Box::pin(async move { - let bytes = send_inner(&client, request, &strategy).await?; - let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); - serde_path_to_error::deserialize(json_deserializer).map_err(StripeError::from) - }) - } -} - -impl Default for TokioClient { - fn default() -> Self { - Self::new() - } -} - -async fn send_inner( - client: &HttpClient, - mut request: Request, - strategy: &RequestStrategy, -) -> Result { - let mut tries = 0; - let mut last_status: Option = None; - let mut last_retry_header: Option = None; - - // if we have no last error, then the strategy is invalid - let mut last_error = StripeError::ClientError("Invalid strategy".to_string()); - - if let Some(key) = strategy.get_key() { - request.insert_header("Idempotency-Key", key); - } - - let body = request.body_bytes().await?; - - loop { - return match strategy.test(last_status, last_retry_header, tries) { - Outcome::Stop => Err(last_error), - Outcome::Continue(duration) => { - if let Some(duration) = duration { - sleep(duration).await; - } - - // note: http::Request provides no easy way to clone, so we perform - // the conversion from the clonable http_types::Request each time - // obviously cloning before the first request is not ideal - let mut request = request.clone(); - request.set_body(body.clone()); - - let response = match client.request(convert_request(request).await).await { - Ok(response) => response, - Err(err) => { - last_error = StripeError::from(err); - tries += 1; - continue; - } - }; - - let status = response.status(); - let retry = response - .headers() - .get("Stripe-Should-Retry") - .and_then(|s| s.to_str().ok()) - .and_then(|s| s.parse().ok()); - - let bytes = hyper::body::to_bytes(response.into_body()).await?; - - if !status.is_success() { - tries += 1; - let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes); - last_error = serde_path_to_error::deserialize(json_deserializer) - .map(|e: stripe_shared::Error| { - StripeError::Stripe(*e.error, status.as_u16()) - }) - .unwrap_or_else(StripeError::from); - last_status = Some( - // NOTE: StatusCode::from can panic here, so fall back to InternalServerError - // see https://github.com/http-rs/http-types/blob/ac5d645ce5294554b86ebd49233d3ec01665d1d7/src/hyperium_http.rs#L20-L24 - StatusCode::try_from(u16::from(status)) - .unwrap_or(StatusCode::InternalServerError), - ); - last_retry_header = retry; - continue; - } - - Ok(bytes) - } - }; - } -} - -/// convert an http_types::Request with a http_types::Body into a http::Request -/// -/// note: this is necesarry because `http` deliberately does not support a `Body` type -/// so hyper has a `Body` for which http_types cannot provide automatic conversion. -async fn convert_request(mut request: http_types::Request) -> http::Request { - let body = request.body_bytes().await.expect("We know the data is a valid bytes object."); - let request: http::Request<_> = request.into(); - http::Request::from_parts(request.into_parts().0, hyper::Body::from(body)) -} - -#[cfg(test)] -mod tests { - use http_types::{Method, Request, Url}; - use httpmock::prelude::*; - use hyper::{body::to_bytes, Body, Request as HyperRequest}; - use serde_json::json; - use stripe_shared::api_errors::{ApiErrorsCode, ApiErrorsType}; - - use super::convert_request; - use super::TokioClient; - use crate::client::request_strategy::RequestStrategy; - use crate::StripeError; - - const TEST_URL: &str = "https://api.stripe.com/v1/"; - - #[tokio::test] - async fn basic_conversion() { - req_equal( - convert_request(Request::new(Method::Get, TEST_URL)).await, - HyperRequest::builder() - .method("GET") - .uri("http://test.com") - .body(Body::empty()) - .unwrap(), - ) - .await; - } - - #[tokio::test] - async fn bytes_body_conversion() { - let body = "test".as_bytes(); - - let mut req = Request::new(Method::Post, TEST_URL); - req.set_body(body); - - req_equal( - convert_request(req).await, - HyperRequest::builder().method("POST").uri(TEST_URL).body(Body::from(body)).unwrap(), - ) - .await; - } - - #[tokio::test] - async fn string_body_conversion() { - let body = "test"; - - let mut req = Request::new(Method::Post, TEST_URL); - req.set_body(body); - - req_equal( - convert_request(req).await, - HyperRequest::builder().method("POST").uri(TEST_URL).body(Body::from(body)).unwrap(), - ) - .await; - } - - async fn req_equal(a: HyperRequest, b: HyperRequest) { - let (a_parts, a_body) = a.into_parts(); - let (b_parts, b_body) = b.into_parts(); - - assert_eq!(a_parts.method, b_parts.method); - assert_eq!(to_bytes(a_body).await.unwrap().len(), to_bytes(b_body).await.unwrap().len()); - } - - #[tokio::test] - async fn retry() { - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(GET).path("/server-errors"); - then.status(500); - }); - - let req = Request::get(Url::parse(&server.url("/server-errors")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(5).await; - assert!(res.is_err()); - } - - #[tokio::test] - async fn user_error() { - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - let mock = server.mock(|when, then| { - when.method(GET).path("/v1/missing"); - then.status(404).body("{ - \"error\": { - \"message\": \"Unrecognized request URL (GET: /v1/missing). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.\", - \"type\": \"invalid_request_error\" - } - } - "); - }); - - let req = Request::get(Url::parse(&server.url("/v1/missing")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(3)).await; - - mock.assert_hits_async(1).await; - - match res { - Err(StripeError::Stripe(x, _)) => println!("{:?}", x), - _ => panic!("Expected stripe error {:?}", res), - } - } - - #[tokio::test] - async fn nice_serde_error() { - use serde::Deserialize; - - #[derive(Debug, Deserialize)] - struct DataType { - // Allowing dead code since used for deserialization - #[allow(dead_code)] - id: String, - #[allow(dead_code)] - name: String, - } - - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - let mock = server.mock(|when, then| { - when.method(GET).path("/v1/odd_data"); - then.status(200).body( - "{ - \"id\": \"test\", - \"name\": 10 - } - ", - ); - }); - - let req = Request::get(Url::parse(&server.url("/v1/odd_data")).unwrap()); - let res = client.execute::(req, &RequestStrategy::Retry(3)).await; - - mock.assert_hits_async(1).await; - - match res { - Err(StripeError::JSONSerialize(err)) => { - println!("Error: {:?} Path: {:?}", err.inner(), err.path().to_string()) - } - _ => panic!("Expected stripe error {:?}", res), - } - } - - #[tokio::test] - async fn retry_header() { - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(GET).path("/server-errors"); - then.status(500).header("Stripe-Should-Retry", "false"); - }); - - let req = Request::get(Url::parse(&server.url("/server-errors")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(1).await; - assert!(res.is_err()); - } - - #[tokio::test] - async fn retry_body() { - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - - // Create a mock on the server. - let hello_mock = server.mock(|when, then| { - when.method(POST).path("/server-errors").body("body"); - then.status(500); - }); - - let mut req = Request::post(Url::parse(&server.url("/server-errors")).unwrap()); - req.set_body("body"); - let res = client.execute::<()>(req, &RequestStrategy::Retry(5)).await; - - hello_mock.assert_hits_async(5).await; - assert!(res.is_err()); - } - - // https://github.com/arlyon/async-stripe/issues/384 - #[tokio::test] - async fn user_error_transfers() { - let client = TokioClient::new(); - - // Start a lightweight mock server. - let server = MockServer::start_async().await; - let message = "Your destination account needs to have at least one of the following capabilities enabled: transfers, crypto_transfers, legacy_payments"; - let log_url = "https://dashboard.stripe.com/logs/req_nIhlutaV4amLEs?t=1685040634"; - let mock = server.mock(|when, then| { - when.method(GET).path("/v1/transfers"); - then.status(400).json_body(json!({ - "error": { - "code": "insufficient_capabilities_for_transfer", - "message": message, - "request_log_url": log_url, - "type": "invalid_request_error" - } - })); - }); - - let req = Request::get(Url::parse(&server.url("/v1/transfers")).unwrap()); - let res = client.execute::<()>(req, &RequestStrategy::Once).await.unwrap_err(); - mock.assert_hits_async(1).await; - - match res { - StripeError::Stripe(err, status_code) => { - assert_eq!(status_code, 400); - assert_eq!(err.type_, ApiErrorsType::InvalidRequestError); - assert_eq!(err.message.as_deref(), Some(message)); - assert_eq!(err.request_log_url.as_deref(), Some(log_url)); - // NB: `Unknown` here because the error code reported in the issue is not - // present in the OpenAPI spec. Reporting unknown instead of an error seems - // better regardless so that stripe adding new variants is not a breaking change - assert_eq!(err.code, Some(ApiErrorsCode::Unknown)); - } - _ => panic!("Expected stripe error, got {:?}", res), - } - } -} diff --git a/async-stripe/src/client/mod.rs b/async-stripe/src/client/mod.rs deleted file mode 100644 index 33a5d332d..000000000 --- a/async-stripe/src/client/mod.rs +++ /dev/null @@ -1,70 +0,0 @@ -mod headers; -mod request_strategy; -mod stripe; - -mod base { - #[cfg(any( - feature = "runtime-tokio-hyper", - feature = "runtime-tokio-hyper-rustls", - feature = "runtime-tokio-hyper-rustls-webpki", - feature = "runtime-blocking", - feature = "runtime-blocking-rustls", - feature = "runtime-blocking-rustls-webpki", - ))] - pub mod tokio; - - #[cfg(feature = "runtime-async-std-surf")] - pub mod async_std; - - #[cfg(any( - feature = "runtime-blocking", - feature = "runtime-blocking-rustls", - feature = "runtime-blocking-rustls-webpki" - ))] - pub mod tokio_blocking; -} - -#[cfg(any( - feature = "runtime-blocking", - feature = "runtime-blocking-rustls", - feature = "runtime-blocking-rustls-webpki" -))] -pub(crate) mod config { - pub(crate) use super::base::tokio_blocking::err; - pub use super::base::tokio_blocking::{Response, TokioBlockingClient as BaseClient}; -} - -#[cfg(any( - feature = "runtime-tokio-hyper", - feature = "runtime-tokio-hyper-rustls", - feature = "runtime-tokio-hyper-rustls-webpki" -))] -pub(crate) mod config { - pub(crate) use super::base::tokio::err; - pub use super::base::tokio::{Response, TokioClient as BaseClient}; -} - -#[cfg(feature = "runtime-async-std-surf")] -pub(crate) mod config { - pub(crate) use super::base::async_std::err; - pub use super::base::async_std::{AsyncStdClient as BaseClient, Response}; -} - -pub use config::BaseClient; -/// An alias for `Result`. -/// -/// If `blocking` is enabled, defined as: -/// -/// ```rust,ignore -/// type Response = Result; -/// ``` -/// -/// If the `async` feature is enabled, this type is defined as: -/// -/// ```rust,ignore -/// type Response = Box>>; -/// ``` -pub use config::Response; -pub use request_strategy::RequestStrategy; - -pub use self::stripe::Client; diff --git a/async-stripe/src/client/stripe.rs b/async-stripe/src/client/stripe.rs deleted file mode 100644 index e058db0e3..000000000 --- a/async-stripe/src/client/stripe.rs +++ /dev/null @@ -1,240 +0,0 @@ -// Necessary under tokio-blocking since `Response` is a type alias to a `Result` -#![allow(clippy::missing_errors_doc)] -use http_types::{Body, Method, Request, Url}; -use serde::de::DeserializeOwned; -use serde::Serialize; -use stripe_shared::version::VERSION; - -use crate::client::headers::{AppInfo, Headers}; -use crate::{ - client::{request_strategy::RequestStrategy, BaseClient, Response}, - config::err, - StripeError, -}; -use crate::{AccountId, ApplicationId}; - -static USER_AGENT: &str = concat!("Stripe/v1 RustBindings/", env!("CARGO_PKG_VERSION")); - -#[derive(Clone)] -pub struct Client { - client: BaseClient, - secret_key: String, - headers: Headers, - strategy: RequestStrategy, - api_base: Url, -} - -impl Client { - /// Create a new account with the given secret key. - pub fn new(secret_key: impl Into) -> Self { - Self::from_url("https://api.stripe.com/", secret_key) - } - - /// Create a new account pointed at a specific URL. This is useful for testing. - pub fn from_url<'a>(url: impl Into<&'a str>, secret_key: impl Into) -> Self { - Client { - client: BaseClient::new(), - secret_key: secret_key.into(), - headers: Headers { - stripe_version: VERSION, - user_agent: USER_AGENT.to_string(), - client_id: None, - stripe_account: None, - }, - strategy: RequestStrategy::Once, - api_base: Url::parse(url.into()).expect("invalid url"), - } - } - - /// Set the client id for the client. - pub fn with_client_id(mut self, id: ApplicationId) -> Self { - self.headers.client_id = Some(id); - self - } - - /// Set the stripe account for the client. - pub fn with_stripe_account(mut self, id: AccountId) -> Self { - self.headers.stripe_account = Some(id); - self - } - - /// Set the request strategy for the client. - pub fn with_strategy(mut self, strategy: RequestStrategy) -> Self { - self.strategy = strategy; - self - } - - /// Set the application info for the client. - /// - /// It is recommended that applications set this so that - /// stripe is able to understand usage patterns from your - /// user agent. - pub fn with_app_info( - mut self, - name: String, - version: Option, - url: Option, - ) -> Self { - let app_info = AppInfo { name, version, url }; - self.headers.user_agent = format!("{USER_AGENT} {app_info}"); - self - } - - /// Make a `GET` http request with just a path - pub fn get(&self, path: &str) -> Response { - self.send(path, Method::Get) - } - - /// Make a `GET` http request with url query parameters - pub fn get_query( - &self, - path: &str, - params: P, - ) -> Response { - let url = match self.url_with_params(path, params) { - Err(e) => return err(e), - Ok(ok) => ok, - }; - self.client.execute::(self.create_request(Method::Get, url), &self.strategy) - } - - pub fn send( - &self, - path: &str, - method: Method, - ) -> Response { - let url = self.url(path); - self.client.execute::(self.create_request(method, url), &self.strategy) - } - - /// Make a `DELETE` http request with just a path - pub fn delete(&self, path: &str) -> Response { - self.send(path, Method::Delete) - } - - /// Make a `POST` http request with just a path - pub fn post(&self, path: &str) -> Response { - self.send(path, Method::Post) - } - - /// Make a `POST` http request with urlencoded body - pub fn post_form( - &self, - path: &str, - form: F, - ) -> Response { - self.send_form(path, form, Method::Post) - } - - /// Make a `DELETE` http request with urlencoded body - pub fn delete_form( - &self, - path: &str, - form: F, - ) -> Response { - self.send_form(path, form, Method::Delete) - } - - /// Make an http request with urlencoded body - pub fn send_form( - &self, - path: &str, - form: F, - method: Method, - ) -> Response { - let url = self.url(path); - let mut req = self.create_request(method, url); - - let mut params_buffer = Vec::new(); - let qs_ser = &mut serde_qs::Serializer::new(&mut params_buffer); - if let Err(qs_ser_err) = serde_path_to_error::serialize(&form, qs_ser) { - return err(StripeError::QueryStringSerialize(qs_ser_err)); - } - - let body = - String::from_utf8(params_buffer).expect("Unable to extract string from params_buffer"); - - req.set_body(Body::from_string(body)); - - req.insert_header("content-type", "application/x-www-form-urlencoded"); - self.client.execute::(req, &self.strategy) - } - - fn url(&self, path: &str) -> Url { - let mut url = self.api_base.clone(); - url.set_path(&format!("v1/{}", path.trim_start_matches('/'))); - url - } - - fn url_with_params(&self, path: &str, params: P) -> Result { - let mut url = self.url(path); - - let mut params_buffer = Vec::new(); - let qs_ser = &mut serde_qs::Serializer::new(&mut params_buffer); - serde_path_to_error::serialize(¶ms, qs_ser).map_err(StripeError::from)?; - - let params = - String::from_utf8(params_buffer).expect("Unable to extract string from params_buffer"); - - url.set_query(Some(¶ms)); - Ok(url) - } - - fn create_request(&self, method: Method, url: Url) -> Request { - let mut req = Request::new(method, url); - req.insert_header("authorization", format!("Bearer {}", self.secret_key)); - - for (key, value) in self.headers.to_array().iter().filter_map(|(k, v)| v.map(|v| (*k, v))) { - req.insert_header(key, value); - } - - req - } -} - -#[cfg(test)] -mod test { - //! Ensures our user agent matches the format of the other stripe clients. - //! - //! See: - - use super::Client; - - #[test] - fn user_agent_base() { - let client = Client::new("sk_test_12345"); - - assert_eq!( - client.headers.user_agent, - format!("Stripe/v1 RustBindings/{}", env!("CARGO_PKG_VERSION")) - ); - } - - #[test] - fn user_agent_minimal_app_info() { - let client = - Client::new("sk_test_12345").with_app_info("sick-new-startup".to_string(), None, None); - - assert_eq!( - client.headers.user_agent, - format!("Stripe/v1 RustBindings/{} sick-new-startup", env!("CARGO_PKG_VERSION")) - ); - } - - #[test] - fn user_agent_all() { - let client = Client::new("sk_test_12345").with_app_info( - "sick-new-startup".to_string(), - Some("0.1.0".to_string()), - Some("https://sick-startup.io".to_string()), - ); - - assert_eq!( - client.headers.user_agent, - format!( - "Stripe/v1 RustBindings/{} sick-new-startup/0.1.0 (https://sick-startup.io)", - env!("CARGO_PKG_VERSION") - ) - ); - } -} diff --git a/async-stripe/src/error.rs b/async-stripe/src/error.rs index 51b440e28..3045a6e40 100644 --- a/async-stripe/src/error.rs +++ b/async-stripe/src/error.rs @@ -5,7 +5,7 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum StripeError { #[error("error reported by stripe: {0:#?}, status code: {1}")] - Stripe(ApiErrors, u16), + Stripe(Box, u16), #[error("error serializing or deserializing a querystring: {0}")] QueryStringSerialize(#[from] serde_path_to_error::Error), #[error("error serializing or deserializing a request")] @@ -18,15 +18,14 @@ pub enum StripeError { Timeout, } -#[cfg(feature = "hyper")] impl From for StripeError { fn from(err: hyper::Error) -> StripeError { StripeError::ClientError(err.to_string()) } } -impl From for StripeError { - fn from(err: http_types::Error) -> StripeError { +impl From for StripeError { + fn from(err: hyper::http::Error) -> StripeError { StripeError::ClientError(err.to_string()) } } diff --git a/async-stripe/src/lib.rs b/async-stripe/src/lib.rs index 962bbc0c5..3eb250b21 100644 --- a/async-stripe/src/lib.rs +++ b/async-stripe/src/lib.rs @@ -1,75 +1,9 @@ -// Copyright 2019 Wyyerd Group, LLC. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![doc(html_root_url = "https://docs.rs/async-stripe/")] - -//! This crate provides Rust bindings to the Stripe HTTP API. -//! -//! ## Getting Started -//! -//! To get started, we need to create a [Client]: -//! -//! ``` -//! let client = stripe::Client::new("sk_test_YOUR_STRIPE_SECRET"); -//! ``` -//! -//! Then we can begin making requests as we'd like. Most Stripe requests accept -//! many optional parameters, so we usually get the `::new(...)` with any required -//! params and then set the ones we want from there. -//! -//! Most requests for creating or updating a Stripe object use the same Rust struct, -//! so you may frequently need to refer to the [official API docs](https://stripe.com/docs/api) -//! to determine which fields are required for either request. -//! -//! > **Note:** We have an extensive collection of examples which are interspersed in -//! the documentation. Any time an API is used in an example it is highlighted in the -//! docs for that item. You can also find all the raw examples in the `examples` directory. -//! Please have a look at those for inspiration or ideas on how to get started. -//! -//! ## Idempotency / Request Strategies -//! -//! This library provides a few basic request strategies for making requests to the Stripe API. -//! This is currently implemented as an enum with the following variants: -//! -//! - [`RequestStrategy::Once`]: This is the default strategy. It will make a request to the Stripe API and, -//! whether the request fails or not, will simply return the response. -//! - [`RequestStrategy::Idempotent`]: This strategy will make a request to stripe api, passing the provided -//! key to Stripe as the `Idempotency-Key` header, ensuring that the request -//! is idempotent. If the request fails, you may retry it. -//! - [`RequestStrategy::Retry`]: Make a request to the Stripe API and, if the request fails, retry it up to n -//! times with a timeout. The idempotency key is generated automatically and is -//! stable across retries. -//! - [`RequestStrategy::ExponentialBackoff`]: Make a request to the Stripe API and, if the request fails, retry -//! it up to n times with exponential backoff. The idempotency key is -//! generated automatically and is stable across retries. -//! -//! > Want to implement your own? If it is a common strategy, please consider opening a PR to add it to the library. -//! Otherwise, we are open to turning this into an open trait so that you can implement your own strategy. - -#![allow(clippy::map_clone, clippy::large_enum_variant)] -#![warn(clippy::unwrap_used, clippy::missing_errors_doc)] -#![forbid(unsafe_code)] - mod client; mod error; -mod pagination; -pub use pagination::{ListPaginator, PaginationExt}; -pub use stripe_shared::AccountId; -pub use stripe_shared::ApiVersion; -pub use stripe_shared::ApplicationId; +#[cfg(feature = "blocking")] +pub mod blocking; -// N.B. Ideally we would support both a blocking client and -// an async client without a feature flag, but the originally -// discussed solution requires Generic Associated Types-- -// instead we provide an async client only a feature flag. -// -// See https://github.com/wyyerd/stripe-rs/issues/24#issuecomment-451514187 -// See https://github.com/rust-lang/rust/issues/44265 -pub use crate::client::*; -pub use crate::error::StripeError; +pub use client::Client; +pub use error::StripeError; +pub use stripe_client_core::{AccountId, ApiVersion, ApplicationId, VERSION}; diff --git a/crate_info.md b/crate_info.md index 8cfffff4c..e0a539faa 100644 --- a/crate_info.md +++ b/crate_info.md @@ -31,7 +31,6 @@ | [Topup](https://stripe.com/docs/api/topups/object) | stripe_connect | topup | | [TransferReversal](https://stripe.com/docs/api/transfer_reversals/object) | stripe_connect | transfer_reversal | | [Transfer](https://stripe.com/docs/api/transfers/object) | stripe_connect | transfer | -| CustomerSession | stripe_core | customer_session | | PaymentSource | stripe_core | payment_source | | [BalanceTransaction](https://stripe.com/docs/api/balance_transactions/object) | stripe_core | balance_transaction | | [Balance](https://stripe.com/docs/api/balance/balance_object) | stripe_core | balance | @@ -62,12 +61,8 @@ | [IssuingToken](https://stripe.com/docs/api/issuing/tokens/object) | stripe_issuing | issuing_token | | [IssuingTransaction](https://stripe.com/docs/api/issuing/transactions/object) | stripe_issuing | issuing_transaction | | ApplePayDomain | stripe_misc | apple_pay_domain | -| ClimateOrder | stripe_misc | climate_order | -| ClimateProduct | stripe_misc | climate_product | -| ClimateSupplier | stripe_misc | climate_supplier | | EphemeralKey | stripe_misc | ephemeral_key | | ExchangeRate | stripe_misc | exchange_rate | -| FinancialConnectionsTransaction | stripe_misc | financial_connections_transaction | | TaxRegistration | stripe_misc | tax_registration | | [FinancialConnectionsAccount](https://stripe.com/docs/api/financial_connections/accounts/object) | stripe_misc | financial_connections_account | | [FinancialConnectionsSession](https://stripe.com/docs/api/financial_connections/sessions/object) | stripe_misc | financial_connections_session | diff --git a/examples/endpoints/Cargo.toml b/examples/endpoints/Cargo.toml index 94f8903cc..2fa1d9e04 100644 --- a/examples/endpoints/Cargo.toml +++ b/examples/endpoints/Cargo.toml @@ -8,19 +8,14 @@ publish = false [dependencies] futures-util = "0.3.28" tokio = { version = "1.24.1", features = ["rt-multi-thread", "macros"] } -async-stripe = {path = "../../async-stripe"} -stripe_types = {path = "../../stripe_types"} -stripe_billing = {path = "../../generated/stripe_billing", features = ["subscription"]} -stripe_core = {path = "../../generated/stripe_core", features = ["customer", "payment_intent"]} -stripe_product = {path = "../../generated/stripe_product", features = ["product", "price"]} -stripe_payment = {path = "../../generated/stripe_payment", features = ["payment_method", "payment_link"]} -stripe_checkout = {path = "../../generated/stripe_checkout", features = ["checkout_session"]} -stripe_connect = {path = "../../generated/stripe_connect", features = ["account", "account_link"]} +async-stripe = { path = "../../async-stripe" } +stripe_types = { path = "../../stripe_types" } +stripe_billing = { path = "../../generated/stripe_billing", features = ["subscription"] } +stripe_core = { path = "../../generated/stripe_core", features = ["customer", "payment_intent"] } +stripe_product = { path = "../../generated/stripe_product", features = ["product", "price"] } +stripe_payment = { path = "../../generated/stripe_payment", features = ["payment_method", "payment_link"] } +stripe_checkout = { path = "../../generated/stripe_checkout", features = ["checkout_session"] } +stripe_connect = { path = "../../generated/stripe_connect", features = ["account", "account_link"] } [features] async = [] - -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper", "async"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls", "async"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki", "async"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf", "async"] \ No newline at end of file diff --git a/examples/pagination/Cargo.toml b/examples/pagination/Cargo.toml index 16919b358..b79fe68f2 100644 --- a/examples/pagination/Cargo.toml +++ b/examples/pagination/Cargo.toml @@ -9,13 +9,8 @@ publish = false [dependencies] futures-util = "0.3.28" tokio = { version = "1.24.1", features = ["rt-multi-thread", "macros"] } -async-stripe = {path = "../../async-stripe"} -stripe_core = {path = "../../generated/stripe_core", features = ["customer"]} +async-stripe = { path = "../../async-stripe" } +stripe_core = { path = "../../generated/stripe_core", features = ["customer"] } [features] async = [] - -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper", "async"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls", "async"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki", "async"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf", "async"] \ No newline at end of file diff --git a/examples/webhook-actix/Cargo.toml b/examples/webhook-actix/Cargo.toml index 36e266078..43792a8dc 100644 --- a/examples/webhook-actix/Cargo.toml +++ b/examples/webhook-actix/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] actix-web = "4.2.1" -stripe_webhook = {path = "../../stripe_webhook", features = ["stripe_checkout"]} -stripe_checkout = {path = "../../generated/stripe_checkout", features = ["runtime-tokio-hyper-rustls"]} -stripe_connect = {path = "../../generated/stripe_connect", features = ["runtime-tokio-hyper-rustls"]} +stripe_webhook = { path = "../../stripe_webhook", features = ["stripe_checkout"] } +stripe_checkout = { path = "../../generated/stripe_checkout" } +stripe_connect = { path = "../../generated/stripe_connect" } diff --git a/examples/webhook-rocket/Cargo.toml b/examples/webhook-rocket/Cargo.toml index 28abd7c76..ce1355816 100644 --- a/examples/webhook-rocket/Cargo.toml +++ b/examples/webhook-rocket/Cargo.toml @@ -6,5 +6,5 @@ publish = false [dependencies] rocket = "0.5.0" -stripe_webhook = {path = "../../stripe_webhook", features = ["stripe_checkout"]} -stripe_checkout = {path = "../../generated/stripe_checkout", features = ["runtime-tokio-hyper-rustls"]} \ No newline at end of file +stripe_webhook = { path = "../../stripe_webhook", features = ["stripe_checkout"] } +stripe_checkout = { path = "../../generated/stripe_checkout" } \ No newline at end of file diff --git a/generated/stripe_billing/Cargo.toml b/generated/stripe_billing/Cargo.toml index 7d6c2572c..87202294e 100644 --- a/generated/stripe_billing/Cargo.toml +++ b/generated/stripe_billing/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - billing_portal_configuration = [] billing_portal_session = [] credit_note = [] @@ -72,5 +61,5 @@ full = ["billing_portal_configuration", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_billing/src/billing_portal_configuration/requests.rs b/generated/stripe_billing/src/billing_portal_configuration/requests.rs index 36d17f455..6cfc4dfea 100644 --- a/generated/stripe_billing/src/billing_portal_configuration/requests.rs +++ b/generated/stripe_billing/src/billing_portal_configuration/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListBillingPortalConfiguration<'a> { +pub struct ListBillingPortalConfigurationBuilder<'a> { /// Only return configurations that are active or inactive (e.g., pass `true` to only list active configurations). #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -24,50 +28,77 @@ pub struct ListBillingPortalConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListBillingPortalConfiguration<'a> { +impl<'a> ListBillingPortalConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of configurations that describe the functionality of the customer portal. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListBillingPortalConfiguration<'a> { + inner: ListBillingPortalConfigurationBuilder<'a>, +} impl<'a> ListBillingPortalConfiguration<'a> { - /// Returns a list of configurations that describe the functionality of the customer portal. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/billing_portal/configurations", self) + pub fn new() -> Self { + Self { inner: ListBillingPortalConfigurationBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/billing_portal/configurations", self) + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveBillingPortalConfiguration<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveBillingPortalConfiguration<'a> { - pub fn new() -> Self { - Self::default() + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn is_default(mut self, is_default: bool) -> Self { + self.inner.is_default = Some(is_default); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveBillingPortalConfiguration<'a> { - /// Retrieves a configuration that describes the functionality of the customer portal. - pub fn send( +impl ListBillingPortalConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_billing::BillingPortalConfigurationId, - ) -> stripe::Response { - client.get_query(&format!("/billing_portal/configurations/{configuration}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListBillingPortalConfiguration<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/billing_portal/configurations").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfiguration<'a> { +pub struct CreateBillingPortalConfigurationBuilder<'a> { /// The business information shown to customers in the portal. - pub business_profile: CreateBillingPortalConfigurationBusinessProfile<'a>, + pub business_profile: CreateBillingPortalConfigurationBuilderBusinessProfile<'a>, /// The default URL to redirect customers to when they click on the portal's link to return to your website. /// This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. #[serde(skip_serializing_if = "Option::is_none")] @@ -76,11 +107,11 @@ pub struct CreateBillingPortalConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Information about the features available in the portal. - pub features: CreateBillingPortalConfigurationFeatures<'a>, + pub features: CreateBillingPortalConfigurationBuilderFeatures<'a>, /// The hosted login page for this configuration. /// Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share). #[serde(skip_serializing_if = "Option::is_none")] - pub login_page: Option, + pub login_page: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -88,10 +119,10 @@ pub struct CreateBillingPortalConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateBillingPortalConfiguration<'a> { +impl<'a> CreateBillingPortalConfigurationBuilder<'a> { pub fn new( - business_profile: CreateBillingPortalConfigurationBusinessProfile<'a>, - features: CreateBillingPortalConfigurationFeatures<'a>, + business_profile: CreateBillingPortalConfigurationBuilderBusinessProfile<'a>, + features: CreateBillingPortalConfigurationBuilderFeatures<'a>, ) -> Self { Self { business_profile, @@ -105,7 +136,7 @@ impl<'a> CreateBillingPortalConfiguration<'a> { } /// The business information shown to customers in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateBillingPortalConfigurationBusinessProfile<'a> { +pub struct CreateBillingPortalConfigurationBuilderBusinessProfile<'a> { /// The messaging shown to customers in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub headline: Option<&'a str>, @@ -116,56 +147,59 @@ pub struct CreateBillingPortalConfigurationBusinessProfile<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub terms_of_service_url: Option<&'a str>, } -impl<'a> CreateBillingPortalConfigurationBusinessProfile<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderBusinessProfile<'a> { pub fn new() -> Self { Self::default() } } /// Information about the features available in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeatures<'a> { +pub struct CreateBillingPortalConfigurationBuilderFeatures<'a> { /// Information about updating the customer details in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_update: Option>, + pub customer_update: Option>, /// Information about showing the billing history in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_history: Option, + pub invoice_history: Option, /// Information about updating payment methods in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_update: Option, + pub payment_method_update: + Option, /// Information about canceling subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel: Option>, + pub subscription_cancel: + Option>, /// Information about pausing subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_pause: Option, /// Information about updating subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_update: Option>, + pub subscription_update: + Option>, } -impl<'a> CreateBillingPortalConfigurationFeatures<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderFeatures<'a> { pub fn new() -> Self { Self::default() } } /// Information about updating the customer details in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesCustomerUpdate<'a> { +pub struct CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdate<'a> { /// The types of customer updates that are supported. When empty, customers are not updateable. #[serde(skip_serializing_if = "Option::is_none")] pub allowed_updates: - Option<&'a [CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates]>, + Option<&'a [CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates]>, /// Whether the feature is enabled. pub enabled: bool, } -impl<'a> CreateBillingPortalConfigurationFeaturesCustomerUpdate<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdate<'a> { pub fn new(enabled: bool) -> Self { Self { allowed_updates: None, enabled } } } /// The types of customer updates that are supported. When empty, customers are not updateable. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +pub enum CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates { Address, Email, Name, @@ -173,9 +207,9 @@ pub enum CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { Shipping, TaxId, } -impl CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates::*; + use CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates::*; match self { Address => "address", Email => "email", @@ -187,10 +221,12 @@ impl CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { } } -impl std::str::FromStr for CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::str::FromStr + for CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates::*; + use CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates::*; match s { "address" => Ok(Address), "email" => Ok(Email), @@ -202,18 +238,24 @@ impl std::str::FromStr for CreateBillingPortalConfigurationFeaturesCustomerUpdat } } } -impl std::fmt::Display for CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::fmt::Display + for CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::fmt::Debug + for CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl serde::Serialize + for CreateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -223,70 +265,72 @@ impl serde::Serialize for CreateBillingPortalConfigurationFeaturesCustomerUpdate } /// Information about showing the billing history in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesInvoiceHistory { +pub struct CreateBillingPortalConfigurationBuilderFeaturesInvoiceHistory { /// Whether the feature is enabled. pub enabled: bool, } -impl CreateBillingPortalConfigurationFeaturesInvoiceHistory { +impl CreateBillingPortalConfigurationBuilderFeaturesInvoiceHistory { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// Information about updating payment methods in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesPaymentMethodUpdate { +pub struct CreateBillingPortalConfigurationBuilderFeaturesPaymentMethodUpdate { /// Whether the feature is enabled. pub enabled: bool, } -impl CreateBillingPortalConfigurationFeaturesPaymentMethodUpdate { +impl CreateBillingPortalConfigurationBuilderFeaturesPaymentMethodUpdate { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// Information about canceling subscriptions in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesSubscriptionCancel<'a> { +pub struct CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancel<'a> { /// Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: - Option>, + pub cancellation_reason: Option< + CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a>, + >, /// Whether the feature is enabled. pub enabled: bool, /// Whether to cancel subscriptions immediately or at the end of the billing period. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub mode: Option, /// Whether to create prorations when canceling subscriptions. /// Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. /// No prorations are generated when canceling a subscription at the end of its natural billing period. #[serde(skip_serializing_if = "Option::is_none")] pub proration_behavior: - Option, + Option, } -impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionCancel<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancel<'a> { pub fn new(enabled: bool) -> Self { Self { cancellation_reason: None, enabled, mode: None, proration_behavior: None } } } /// Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason<'a> { +pub struct CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a> { /// Whether the feature is enabled. - pub enabled: bool, +pub enabled: bool, /// Which cancellation reasons will be given as options to the customer. - pub options: - &'a [CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions], +pub options: &'a [CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions], + } -impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a> { pub fn new( enabled: bool, - options: &'a [CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions], + options: &'a [CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions], ) -> Self { Self { enabled, options } } } /// Which cancellation reasons will be given as options to the customer. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions { +pub enum CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions +{ CustomerService, LowQuality, MissingFeatures, @@ -296,9 +340,9 @@ pub enum CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationR TooExpensive, Unused, } -impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions { +impl CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions::*; match self { CustomerService => "customer_service", LowQuality => "low_quality", @@ -313,11 +357,11 @@ impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReaso } impl std::str::FromStr - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions::*; match s { "customer_service" => Ok(CustomerService), "low_quality" => Ok(LowQuality), @@ -332,7 +376,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -340,14 +384,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn serialize(&self, serializer: S) -> Result where @@ -358,13 +402,13 @@ impl serde::Serialize } /// Whether to cancel subscriptions immediately or at the end of the billing period. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +pub enum CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { AtPeriodEnd, Immediately, } -impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode::*; match self { AtPeriodEnd => "at_period_end", Immediately => "immediately", @@ -372,10 +416,10 @@ impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { } } -impl std::str::FromStr for CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::str::FromStr for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode::*; match s { "at_period_end" => Ok(AtPeriodEnd), "immediately" => Ok(Immediately), @@ -383,18 +427,18 @@ impl std::str::FromStr for CreateBillingPortalConfigurationFeaturesSubscriptionC } } } -impl std::fmt::Display for CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::fmt::Display for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::fmt::Debug for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl serde::Serialize for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -406,14 +450,14 @@ impl serde::Serialize for CreateBillingPortalConfigurationFeaturesSubscriptionCa /// Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. /// No prorations are generated when canceling a subscription at the end of its natural billing period. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior { +pub enum CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior { +impl CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -423,11 +467,11 @@ impl CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior } impl std::str::FromStr - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -437,7 +481,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -445,14 +489,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn serialize(&self, serializer: S) -> Result where @@ -463,23 +507,22 @@ impl serde::Serialize } /// Information about updating subscriptions in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { +pub struct CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdate<'a> { /// The types of subscription updates that are supported. When empty, subscriptions are not updateable. - pub default_allowed_updates: - &'a [CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates], +pub default_allowed_updates: &'a [CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates], /// Whether the feature is enabled. - pub enabled: bool, +pub enabled: bool, /// The list of up to 10 products that support subscription updates. - pub products: &'a [SubscriptionUpdateProductParam<'a>], - /// Determines how to handle prorations resulting from subscription updates. +pub products: &'a [SubscriptionUpdateProductParam<'a>], + /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: - Option, +#[serde(skip_serializing_if = "Option::is_none")] +pub proration_behavior: Option, + } -impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { +impl<'a> CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdate<'a> { pub fn new( - default_allowed_updates: &'a [CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates], + default_allowed_updates: &'a [CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates], enabled: bool, products: &'a [SubscriptionUpdateProductParam<'a>], ) -> Self { @@ -488,14 +531,14 @@ impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { } /// The types of subscription updates that are supported. When empty, subscriptions are not updateable. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates { +pub enum CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { Price, PromotionCode, Quantity, } -impl CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates { +impl CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; match self { Price => "price", PromotionCode => "promotion_code", @@ -505,11 +548,11 @@ impl CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpd } impl std::str::FromStr - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; match s { "price" => Ok(Price), "promotion_code" => Ok(PromotionCode), @@ -519,7 +562,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -527,14 +570,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn serialize(&self, serializer: S) -> Result where @@ -546,14 +589,14 @@ impl serde::Serialize /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior { +pub enum CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior { +impl CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -563,11 +606,11 @@ impl CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior } impl std::str::FromStr - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior::*; + use CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -577,7 +620,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -585,14 +628,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for CreateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn serialize(&self, serializer: S) -> Result where @@ -604,32 +647,81 @@ impl serde::Serialize /// The hosted login page for this configuration. /// Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationLoginPage { +pub struct CreateBillingPortalConfigurationBuilderLoginPage { /// Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal. pub enabled: bool, } -impl CreateBillingPortalConfigurationLoginPage { +impl CreateBillingPortalConfigurationBuilderLoginPage { pub fn new(enabled: bool) -> Self { Self { enabled } } } +/// Creates a configuration that describes the functionality and behavior of a PortalSession +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateBillingPortalConfiguration<'a> { + inner: CreateBillingPortalConfigurationBuilder<'a>, +} impl<'a> CreateBillingPortalConfiguration<'a> { - /// Creates a configuration that describes the functionality and behavior of a PortalSession - pub fn send( + pub fn new( + business_profile: CreateBillingPortalConfigurationBuilderBusinessProfile<'a>, + features: CreateBillingPortalConfigurationBuilderFeatures<'a>, + ) -> Self { + Self { inner: CreateBillingPortalConfigurationBuilder::new(business_profile, features) } + } + pub fn default_return_url(mut self, default_return_url: &'a str) -> Self { + self.inner.default_return_url = Some(default_return_url); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn login_page( + mut self, + login_page: CreateBillingPortalConfigurationBuilderLoginPage, + ) -> Self { + self.inner.login_page = Some(login_page); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateBillingPortalConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/billing_portal/configurations", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateBillingPortalConfiguration<'_> { + type Output = stripe_billing::BillingPortalConfiguration; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/billing_portal/configurations").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfiguration<'a> { +pub struct UpdateBillingPortalConfigurationBuilder<'a> { /// Whether the configuration is active and can be used to create portal sessions. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, /// The business information shown to customers in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub business_profile: Option>, + pub business_profile: Option>, /// The default URL to redirect customers to when they click on the portal's link to return to your website. /// This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. #[serde(skip_serializing_if = "Option::is_none")] @@ -639,11 +731,11 @@ pub struct UpdateBillingPortalConfiguration<'a> { pub expand: Option<&'a [&'a str]>, /// Information about the features available in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option>, + pub features: Option>, /// The hosted login page for this configuration. /// Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share). #[serde(skip_serializing_if = "Option::is_none")] - pub login_page: Option, + pub login_page: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -651,14 +743,14 @@ pub struct UpdateBillingPortalConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateBillingPortalConfiguration<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The business information shown to customers in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationBusinessProfile<'a> { +pub struct UpdateBillingPortalConfigurationBuilderBusinessProfile<'a> { /// The messaging shown to customers in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub headline: Option<&'a str>, @@ -669,57 +761,60 @@ pub struct UpdateBillingPortalConfigurationBusinessProfile<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub terms_of_service_url: Option<&'a str>, } -impl<'a> UpdateBillingPortalConfigurationBusinessProfile<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderBusinessProfile<'a> { pub fn new() -> Self { Self::default() } } /// Information about the features available in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeatures<'a> { +pub struct UpdateBillingPortalConfigurationBuilderFeatures<'a> { /// Information about updating the customer details in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_update: Option>, + pub customer_update: Option>, /// Information about showing the billing history in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_history: Option, + pub invoice_history: Option, /// Information about updating payment methods in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_update: Option, + pub payment_method_update: + Option, /// Information about canceling subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel: Option>, + pub subscription_cancel: + Option>, /// Information about pausing subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_pause: Option, /// Information about updating subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_update: Option>, + pub subscription_update: + Option>, } -impl<'a> UpdateBillingPortalConfigurationFeatures<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderFeatures<'a> { pub fn new() -> Self { Self::default() } } /// Information about updating the customer details in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesCustomerUpdate<'a> { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdate<'a> { /// The types of customer updates that are supported. When empty, customers are not updateable. #[serde(skip_serializing_if = "Option::is_none")] pub allowed_updates: - Option<&'a [UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates]>, + Option<&'a [UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates]>, /// Whether the feature is enabled. #[serde(skip_serializing_if = "Option::is_none")] pub enabled: Option, } -impl<'a> UpdateBillingPortalConfigurationFeaturesCustomerUpdate<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdate<'a> { pub fn new() -> Self { Self::default() } } /// The types of customer updates that are supported. When empty, customers are not updateable. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates { Address, Email, Name, @@ -727,9 +822,9 @@ pub enum UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { Shipping, TaxId, } -impl UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates::*; + use UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates::*; match self { Address => "address", Email => "email", @@ -741,10 +836,12 @@ impl UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { } } -impl std::str::FromStr for UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::str::FromStr + for UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates::*; + use UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates::*; match s { "address" => Ok(Address), "email" => Ok(Email), @@ -756,18 +853,24 @@ impl std::str::FromStr for UpdateBillingPortalConfigurationFeaturesCustomerUpdat } } } -impl std::fmt::Display for UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::fmt::Display + for UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl std::fmt::Debug + for UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateBillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdates { +impl serde::Serialize + for UpdateBillingPortalConfigurationBuilderFeaturesCustomerUpdateAllowedUpdates +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -777,70 +880,71 @@ impl serde::Serialize for UpdateBillingPortalConfigurationFeaturesCustomerUpdate } /// Information about showing the billing history in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesInvoiceHistory { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesInvoiceHistory { /// Whether the feature is enabled. pub enabled: bool, } -impl UpdateBillingPortalConfigurationFeaturesInvoiceHistory { +impl UpdateBillingPortalConfigurationBuilderFeaturesInvoiceHistory { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// Information about updating payment methods in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesPaymentMethodUpdate { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesPaymentMethodUpdate { /// Whether the feature is enabled. pub enabled: bool, } -impl UpdateBillingPortalConfigurationFeaturesPaymentMethodUpdate { +impl UpdateBillingPortalConfigurationBuilderFeaturesPaymentMethodUpdate { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// Information about canceling subscriptions in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionCancel<'a> { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancel<'a> { /// Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: - Option>, + pub cancellation_reason: Option< + UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a>, + >, /// Whether the feature is enabled. #[serde(skip_serializing_if = "Option::is_none")] pub enabled: Option, /// Whether to cancel subscriptions immediately or at the end of the billing period. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub mode: Option, /// Whether to create prorations when canceling subscriptions. /// Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. /// No prorations are generated when canceling a subscription at the end of its natural billing period. #[serde(skip_serializing_if = "Option::is_none")] pub proration_behavior: - Option, + Option, } -impl<'a> UpdateBillingPortalConfigurationFeaturesSubscriptionCancel<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancel<'a> { pub fn new() -> Self { Self::default() } } /// Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason<'a> { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a> { /// Whether the feature is enabled. - pub enabled: bool, +pub enabled: bool, /// Which cancellation reasons will be given as options to the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option< - &'a [UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub options: Option<&'a [UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions]>, + } -impl<'a> UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReason<'a> { pub fn new(enabled: bool) -> Self { Self { enabled, options: None } } } /// Which cancellation reasons will be given as options to the customer. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions +{ CustomerService, LowQuality, MissingFeatures, @@ -850,9 +954,9 @@ pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationR TooExpensive, Unused, } -impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions { +impl UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions::*; match self { CustomerService => "customer_service", LowQuality => "low_quality", @@ -867,11 +971,11 @@ impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReaso } impl std::str::FromStr - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions::*; match s { "customer_service" => Ok(CustomerService), "low_quality" => Ok(LowQuality), @@ -886,7 +990,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -894,14 +998,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptions + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelCancellationReasonOptions { fn serialize(&self, serializer: S) -> Result where @@ -912,13 +1016,13 @@ impl serde::Serialize } /// Whether to cancel subscriptions immediately or at the end of the billing period. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { AtPeriodEnd, Immediately, } -impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode::*; match self { AtPeriodEnd => "at_period_end", Immediately => "immediately", @@ -926,10 +1030,10 @@ impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { } } -impl std::str::FromStr for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::str::FromStr for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode::*; match s { "at_period_end" => Ok(AtPeriodEnd), "immediately" => Ok(Immediately), @@ -937,18 +1041,18 @@ impl std::str::FromStr for UpdateBillingPortalConfigurationFeaturesSubscriptionC } } } -impl std::fmt::Display for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::fmt::Display for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl std::fmt::Debug for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelMode { +impl serde::Serialize for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -960,14 +1064,14 @@ impl serde::Serialize for UpdateBillingPortalConfigurationFeaturesSubscriptionCa /// Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. /// No prorations are generated when canceling a subscription at the end of its natural billing period. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior { +impl UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -977,11 +1081,11 @@ impl UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior } impl std::str::FromStr - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -991,7 +1095,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -999,14 +1103,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateBillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionCancelProrationBehavior { fn serialize(&self, serializer: S) -> Result where @@ -1017,39 +1121,37 @@ impl serde::Serialize } /// Information about updating subscriptions in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { +pub struct UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdate<'a> { /// The types of subscription updates that are supported. When empty, subscriptions are not updateable. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_allowed_updates: Option< - &'a [UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub default_allowed_updates: Option<&'a [UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates]>, /// Whether the feature is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled: Option, +#[serde(skip_serializing_if = "Option::is_none")] +pub enabled: Option, /// The list of up to 10 products that support subscription updates. - #[serde(skip_serializing_if = "Option::is_none")] - pub products: Option<&'a [SubscriptionUpdateProductParam<'a>]>, - /// Determines how to handle prorations resulting from subscription updates. +#[serde(skip_serializing_if = "Option::is_none")] +pub products: Option<&'a [SubscriptionUpdateProductParam<'a>]>, + /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: - Option, +#[serde(skip_serializing_if = "Option::is_none")] +pub proration_behavior: Option, + } -impl<'a> UpdateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { +impl<'a> UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdate<'a> { pub fn new() -> Self { Self::default() } } /// The types of subscription updates that are supported. When empty, subscriptions are not updateable. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { Price, PromotionCode, Quantity, } -impl UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates { +impl UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; match self { Price => "price", PromotionCode => "promotion_code", @@ -1059,11 +1161,11 @@ impl UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpd } impl std::str::FromStr - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates::*; match s { "price" => Ok(Price), "promotion_code" => Ok(PromotionCode), @@ -1073,7 +1175,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1081,14 +1183,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateDefaultAllowedUpdates { fn serialize(&self, serializer: S) -> Result where @@ -1100,14 +1202,14 @@ impl serde::Serialize /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior { +pub enum UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior { +impl UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -1117,11 +1219,11 @@ impl UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior } impl std::str::FromStr - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior::*; + use UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -1131,7 +1233,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1139,14 +1241,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior + for UpdateBillingPortalConfigurationBuilderFeaturesSubscriptionUpdateProrationBehavior { fn serialize(&self, serializer: S) -> Result where @@ -1158,31 +1260,154 @@ impl serde::Serialize /// The hosted login page for this configuration. /// Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationLoginPage { +pub struct UpdateBillingPortalConfigurationBuilderLoginPage { /// Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal. /// /// Set to `false` to deactivate the `login_page.url`. pub enabled: bool, } -impl UpdateBillingPortalConfigurationLoginPage { +impl UpdateBillingPortalConfigurationBuilderLoginPage { pub fn new(enabled: bool) -> Self { Self { enabled } } } +/// Updates a configuration that describes the functionality of the customer portal. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateBillingPortalConfiguration<'a> { + inner: UpdateBillingPortalConfigurationBuilder<'a>, + configuration: &'a stripe_billing::BillingPortalConfigurationId, +} impl<'a> UpdateBillingPortalConfiguration<'a> { - /// Updates a configuration that describes the functionality of the customer portal. - pub fn send( + pub fn new(configuration: &'a stripe_billing::BillingPortalConfigurationId) -> Self { + Self { configuration, inner: UpdateBillingPortalConfigurationBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn business_profile( + mut self, + business_profile: UpdateBillingPortalConfigurationBuilderBusinessProfile<'a>, + ) -> Self { + self.inner.business_profile = Some(business_profile); + self + } + + pub fn default_return_url(mut self, default_return_url: &'a str) -> Self { + self.inner.default_return_url = Some(default_return_url); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn features( + mut self, + features: UpdateBillingPortalConfigurationBuilderFeatures<'a>, + ) -> Self { + self.inner.features = Some(features); + self + } + + pub fn login_page( + mut self, + login_page: UpdateBillingPortalConfigurationBuilderLoginPage, + ) -> Self { + self.inner.login_page = Some(login_page); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateBillingPortalConfiguration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - configuration: &stripe_billing::BillingPortalConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/billing_portal/configurations/{configuration}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateBillingPortalConfiguration<'_> { + type Output = stripe_billing::BillingPortalConfiguration; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new( + StripeMethod::Post, + format!("/billing_portal/configurations/{configuration}"), ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveBillingPortalConfigurationBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveBillingPortalConfigurationBuilder<'a> { + pub fn new() -> Self { + Self::default() } } +/// Retrieves a configuration that describes the functionality of the customer portal. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveBillingPortalConfiguration<'a> { + inner: RetrieveBillingPortalConfigurationBuilder<'a>, + configuration: &'a stripe_billing::BillingPortalConfigurationId, +} +impl<'a> RetrieveBillingPortalConfiguration<'a> { + pub fn new(configuration: &'a stripe_billing::BillingPortalConfigurationId) -> Self { + Self { configuration, inner: RetrieveBillingPortalConfigurationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveBillingPortalConfiguration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveBillingPortalConfiguration<'_> { + type Output = stripe_billing::BillingPortalConfiguration; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new( + StripeMethod::Get, + format!("/billing_portal/configurations/{configuration}"), + ) + .query(&self.inner) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct SubscriptionPauseParam { /// Whether the feature is enabled. diff --git a/generated/stripe_billing/src/billing_portal_session/requests.rs b/generated/stripe_billing/src/billing_portal_session/requests.rs index 85fcfaa43..ebd282cf5 100644 --- a/generated/stripe_billing/src/billing_portal_session/requests.rs +++ b/generated/stripe_billing/src/billing_portal_session/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSession<'a> { +pub struct CreateBillingPortalSessionBuilder<'a> { /// 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")] @@ -12,7 +16,7 @@ pub struct CreateBillingPortalSession<'a> { /// Information about a specific flow for the customer to go through. /// See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. #[serde(skip_serializing_if = "Option::is_none")] - pub flow_data: Option>, + pub flow_data: Option>, /// 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")] @@ -27,7 +31,7 @@ pub struct CreateBillingPortalSession<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub return_url: Option<&'a str>, } -impl<'a> CreateBillingPortalSession<'a> { +impl<'a> CreateBillingPortalSessionBuilder<'a> { pub fn new(customer: &'a str) -> Self { Self { configuration: None, @@ -43,26 +47,28 @@ impl<'a> CreateBillingPortalSession<'a> { /// Information about a specific flow for the customer to go through. /// See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowData<'a> { +pub struct CreateBillingPortalSessionBuilderFlowData<'a> { /// Behavior after the flow is completed. #[serde(skip_serializing_if = "Option::is_none")] - pub after_completion: Option>, + pub after_completion: Option>, /// Configuration when `flow_data.type=subscription_cancel`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel: Option>, + pub subscription_cancel: + Option>, /// Configuration when `flow_data.type=subscription_update`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_update: Option>, + pub subscription_update: + Option>, /// Configuration when `flow_data.type=subscription_update_confirm`. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_update_confirm: - Option>, + Option>, /// Type of flow that the customer will go through. #[serde(rename = "type")] - pub type_: CreateBillingPortalSessionFlowDataType, + pub type_: CreateBillingPortalSessionBuilderFlowDataType, } -impl<'a> CreateBillingPortalSessionFlowData<'a> { - pub fn new(type_: CreateBillingPortalSessionFlowDataType) -> Self { +impl<'a> CreateBillingPortalSessionBuilderFlowData<'a> { + pub fn new(type_: CreateBillingPortalSessionBuilderFlowDataType) -> Self { Self { after_completion: None, subscription_cancel: None, @@ -74,56 +80,56 @@ impl<'a> CreateBillingPortalSessionFlowData<'a> { } /// Behavior after the flow is completed. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataAfterCompletion<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataAfterCompletion<'a> { /// Configuration when `after_completion.type=hosted_confirmation`. #[serde(skip_serializing_if = "Option::is_none")] pub hosted_confirmation: - Option>, + Option>, /// Configuration when `after_completion.type=redirect`. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect: Option>, + pub redirect: Option>, /// The specified behavior after the flow is completed. #[serde(rename = "type")] - pub type_: CreateBillingPortalSessionFlowDataAfterCompletionType, + pub type_: CreateBillingPortalSessionBuilderFlowDataAfterCompletionType, } -impl<'a> CreateBillingPortalSessionFlowDataAfterCompletion<'a> { - pub fn new(type_: CreateBillingPortalSessionFlowDataAfterCompletionType) -> Self { +impl<'a> CreateBillingPortalSessionBuilderFlowDataAfterCompletion<'a> { + pub fn new(type_: CreateBillingPortalSessionBuilderFlowDataAfterCompletionType) -> Self { Self { hosted_confirmation: None, redirect: None, type_ } } } /// Configuration when `after_completion.type=hosted_confirmation`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataAfterCompletionHostedConfirmation<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataAfterCompletionHostedConfirmation<'a> { /// A custom message to display to the customer after the flow is completed. #[serde(skip_serializing_if = "Option::is_none")] pub custom_message: Option<&'a str>, } -impl<'a> CreateBillingPortalSessionFlowDataAfterCompletionHostedConfirmation<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataAfterCompletionHostedConfirmation<'a> { pub fn new() -> Self { Self::default() } } /// Configuration when `after_completion.type=redirect`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataAfterCompletionRedirect<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataAfterCompletionRedirect<'a> { /// The URL the customer will be redirected to after the flow is completed. pub return_url: &'a str, } -impl<'a> CreateBillingPortalSessionFlowDataAfterCompletionRedirect<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataAfterCompletionRedirect<'a> { pub fn new(return_url: &'a str) -> Self { Self { return_url } } } /// The specified behavior after the flow is completed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalSessionFlowDataAfterCompletionType { +pub enum CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { HostedConfirmation, PortalHomepage, Redirect, } -impl CreateBillingPortalSessionFlowDataAfterCompletionType { +impl CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { pub fn as_str(self) -> &'static str { - use CreateBillingPortalSessionFlowDataAfterCompletionType::*; + use CreateBillingPortalSessionBuilderFlowDataAfterCompletionType::*; match self { HostedConfirmation => "hosted_confirmation", PortalHomepage => "portal_homepage", @@ -132,10 +138,10 @@ impl CreateBillingPortalSessionFlowDataAfterCompletionType { } } -impl std::str::FromStr for CreateBillingPortalSessionFlowDataAfterCompletionType { +impl std::str::FromStr for CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalSessionFlowDataAfterCompletionType::*; + use CreateBillingPortalSessionBuilderFlowDataAfterCompletionType::*; match s { "hosted_confirmation" => Ok(HostedConfirmation), "portal_homepage" => Ok(PortalHomepage), @@ -144,18 +150,18 @@ impl std::str::FromStr for CreateBillingPortalSessionFlowDataAfterCompletionType } } } -impl std::fmt::Display for CreateBillingPortalSessionFlowDataAfterCompletionType { +impl std::fmt::Display for CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateBillingPortalSessionFlowDataAfterCompletionType { +impl std::fmt::Debug for CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateBillingPortalSessionFlowDataAfterCompletionType { +impl serde::Serialize for CreateBillingPortalSessionBuilderFlowDataAfterCompletionType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -165,82 +171,87 @@ impl serde::Serialize for CreateBillingPortalSessionFlowDataAfterCompletionType } /// Configuration when `flow_data.type=subscription_cancel`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionCancel<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionCancel<'a> { /// Specify a retention strategy to be used in the cancellation flow. #[serde(skip_serializing_if = "Option::is_none")] - pub retention: Option>, + pub retention: Option>, /// The ID of the subscription to be canceled. pub subscription: &'a str, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionCancel<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionCancel<'a> { pub fn new(subscription: &'a str) -> Self { Self { retention: None, subscription } } } /// Specify a retention strategy to be used in the cancellation flow. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionCancelRetention<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetention<'a> { /// Configuration when `retention.type=coupon_offer`. - pub coupon_offer: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer<'a>, + pub coupon_offer: + CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionCouponOffer<'a>, /// Type of retention strategy to use with the customer. #[serde(rename = "type")] - pub type_: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType, + pub type_: CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionCancelRetention<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetention<'a> { pub fn new( - coupon_offer: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer<'a>, - type_: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType, + coupon_offer: CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionCouponOffer<'a>, + type_: CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType, ) -> Self { Self { coupon_offer, type_ } } } /// Configuration when `retention.type=coupon_offer`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionCouponOffer<'a> { /// The ID of the coupon to be offered. pub coupon: &'a str, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionCouponOffer<'a> { pub fn new(coupon: &'a str) -> Self { Self { coupon } } } /// Type of retention strategy to use with the customer. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +pub enum CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType { CouponOffer, } -impl CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +impl CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType { pub fn as_str(self) -> &'static str { - use CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType::*; + use CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType::*; match self { CouponOffer => "coupon_offer", } } } -impl std::str::FromStr for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +impl std::str::FromStr + for CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType::*; + use CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType::*; match s { "coupon_offer" => Ok(CouponOffer), _ => Err(()), } } } -impl std::fmt::Display for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +impl std::fmt::Display + for CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +impl std::fmt::Debug for CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType { +impl serde::Serialize for CreateBillingPortalSessionBuilderFlowDataSubscriptionCancelRetentionType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -250,32 +261,33 @@ impl serde::Serialize for CreateBillingPortalSessionFlowDataSubscriptionCancelRe } /// Configuration when `flow_data.type=subscription_update`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdate<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdate<'a> { /// The ID of the subscription to be updated. pub subscription: &'a str, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdate<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdate<'a> { pub fn new(subscription: &'a str) -> Self { Self { subscription } } } /// Configuration when `flow_data.type=subscription_update_confirm`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirm<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirm<'a> { /// The coupon or promotion code to apply to this subscription update. /// Currently, only up to one may be specified. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: - Option<&'a [CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts<'a>]>, + pub discounts: Option< + &'a [CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmDiscounts<'a>], + >, /// The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. /// Currently, only up to one may be specified and subscriptions with multiple items are not updatable. - pub items: &'a [CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems<'a>], + pub items: &'a [CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmItems<'a>], /// The ID of the subscription to be updated. pub subscription: &'a str, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirm<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirm<'a> { pub fn new( - items: &'a [CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems<'a>], + items: &'a [CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmItems<'a>], subscription: &'a str, ) -> Self { Self { discounts: None, items, subscription } @@ -284,7 +296,7 @@ impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirm<'a> { /// The coupon or promotion code to apply to this subscription update. /// Currently, only up to one may be specified. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmDiscounts<'a> { /// The ID of the coupon to apply to this subscription update. #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, @@ -292,7 +304,7 @@ pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts< #[serde(skip_serializing_if = "Option::is_none")] pub promotion_code: Option<&'a str>, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmDiscounts<'a> { pub fn new() -> Self { Self::default() } @@ -300,7 +312,7 @@ impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts<'a /// The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. /// Currently, only up to one may be specified and subscriptions with multiple items are not updatable. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems<'a> { +pub struct CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmItems<'a> { /// The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated. pub id: &'a str, /// The price the customer should subscribe to through this flow. @@ -311,22 +323,22 @@ pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems<'a> #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, } -impl<'a> CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems<'a> { +impl<'a> CreateBillingPortalSessionBuilderFlowDataSubscriptionUpdateConfirmItems<'a> { pub fn new(id: &'a str) -> Self { Self { id, price: None, quantity: None } } } /// Type of flow that the customer will go through. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateBillingPortalSessionFlowDataType { +pub enum CreateBillingPortalSessionBuilderFlowDataType { PaymentMethodUpdate, SubscriptionCancel, SubscriptionUpdate, SubscriptionUpdateConfirm, } -impl CreateBillingPortalSessionFlowDataType { +impl CreateBillingPortalSessionBuilderFlowDataType { pub fn as_str(self) -> &'static str { - use CreateBillingPortalSessionFlowDataType::*; + use CreateBillingPortalSessionBuilderFlowDataType::*; match self { PaymentMethodUpdate => "payment_method_update", SubscriptionCancel => "subscription_cancel", @@ -336,10 +348,10 @@ impl CreateBillingPortalSessionFlowDataType { } } -impl std::str::FromStr for CreateBillingPortalSessionFlowDataType { +impl std::str::FromStr for CreateBillingPortalSessionBuilderFlowDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreateBillingPortalSessionFlowDataType::*; + use CreateBillingPortalSessionBuilderFlowDataType::*; match s { "payment_method_update" => Ok(PaymentMethodUpdate), "subscription_cancel" => Ok(SubscriptionCancel), @@ -349,18 +361,18 @@ impl std::str::FromStr for CreateBillingPortalSessionFlowDataType { } } } -impl std::fmt::Display for CreateBillingPortalSessionFlowDataType { +impl std::fmt::Display for CreateBillingPortalSessionBuilderFlowDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateBillingPortalSessionFlowDataType { +impl std::fmt::Debug for CreateBillingPortalSessionBuilderFlowDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateBillingPortalSessionFlowDataType { +impl serde::Serialize for CreateBillingPortalSessionBuilderFlowDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -368,12 +380,65 @@ impl serde::Serialize for CreateBillingPortalSessionFlowDataType { serializer.serialize_str(self.as_str()) } } +/// Creates a session of the customer portal. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateBillingPortalSession<'a> { + inner: CreateBillingPortalSessionBuilder<'a>, +} impl<'a> CreateBillingPortalSession<'a> { - /// Creates a session of the customer portal. - pub fn send( + pub fn new(customer: &'a str) -> Self { + Self { inner: CreateBillingPortalSessionBuilder::new(customer) } + } + pub fn configuration(mut self, configuration: &'a str) -> Self { + self.inner.configuration = Some(configuration); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn flow_data(mut self, flow_data: CreateBillingPortalSessionBuilderFlowData<'a>) -> Self { + self.inner.flow_data = Some(flow_data); + self + } + + pub fn locale(mut self, locale: stripe_billing::BillingPortalSessionLocale) -> Self { + self.inner.locale = Some(locale); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } +} +impl CreateBillingPortalSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/billing_portal/sessions", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateBillingPortalSession<'_> { + type Output = stripe_billing::BillingPortalSession; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/billing_portal/sessions").form(&self.inner) } } diff --git a/generated/stripe_billing/src/credit_note/requests.rs b/generated/stripe_billing/src/credit_note/requests.rs index 7fa35022d..11a46a3c6 100644 --- a/generated/stripe_billing/src/credit_note/requests.rs +++ b/generated/stripe_billing/src/credit_note/requests.rs @@ -1,69 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCreditNote<'a> { - /// Only return credit notes for the customer specified by this customer ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Only return credit notes for the invoice specified by this invoice ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice: Option<&'a str>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListCreditNote<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListCreditNote<'a> { - /// Returns a list of credit notes. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/credit_notes", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/credit_notes", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCreditNote<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCreditNote<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveCreditNote<'a> { - /// Retrieves the credit note object with the given identifier. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::CreditNoteId, - ) -> stripe::Response { - client.get_query(&format!("/credit_notes/{id}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewCreditNote<'a> { +pub struct CreateCreditNoteBuilder<'a> { /// The integer amount in cents (or local equivalent) representing the total amount of the credit note. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -82,7 +22,7 @@ pub struct PreviewCreditNote<'a> { pub invoice: &'a str, /// Line items that make up the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub lines: Option<&'a [PreviewCreditNoteLines<'a>]>, + pub lines: Option<&'a [CreateCreditNoteBuilderLines<'a>]>, /// The credit note's memo appears on the credit note PDF. #[serde(skip_serializing_if = "Option::is_none")] pub memo: Option<&'a str>, @@ -109,7 +49,7 @@ pub struct PreviewCreditNote<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub shipping_cost: Option>, } -impl<'a> PreviewCreditNote<'a> { +impl<'a> CreateCreditNoteBuilder<'a> { pub fn new(invoice: &'a str) -> Self { Self { amount: None, @@ -130,7 +70,7 @@ impl<'a> PreviewCreditNote<'a> { } /// Line items that make up the credit note. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewCreditNoteLines<'a> { +pub struct CreateCreditNoteBuilderLines<'a> { /// The line item amount to credit. Only valid when `type` is `invoice_line_item`. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -152,7 +92,7 @@ pub struct PreviewCreditNoteLines<'a> { pub tax_rates: Option<&'a [&'a str]>, /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[serde(rename = "type")] - pub type_: PreviewCreditNoteLinesType, + pub type_: CreateCreditNoteBuilderLinesType, /// The integer unit amount in cents (or local equivalent) of the credit note line item. /// This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. /// Only valid when `type` is `custom_line_item`. @@ -163,8 +103,8 @@ pub struct PreviewCreditNoteLines<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> PreviewCreditNoteLines<'a> { - pub fn new(type_: PreviewCreditNoteLinesType) -> Self { +impl<'a> CreateCreditNoteBuilderLines<'a> { + pub fn new(type_: CreateCreditNoteBuilderLinesType) -> Self { Self { amount: None, description: None, @@ -180,13 +120,13 @@ impl<'a> PreviewCreditNoteLines<'a> { } /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PreviewCreditNoteLinesType { +pub enum CreateCreditNoteBuilderLinesType { CustomLineItem, InvoiceLineItem, } -impl PreviewCreditNoteLinesType { +impl CreateCreditNoteBuilderLinesType { pub fn as_str(self) -> &'static str { - use PreviewCreditNoteLinesType::*; + use CreateCreditNoteBuilderLinesType::*; match self { CustomLineItem => "custom_line_item", InvoiceLineItem => "invoice_line_item", @@ -194,10 +134,10 @@ impl PreviewCreditNoteLinesType { } } -impl std::str::FromStr for PreviewCreditNoteLinesType { +impl std::str::FromStr for CreateCreditNoteBuilderLinesType { type Err = (); fn from_str(s: &str) -> Result { - use PreviewCreditNoteLinesType::*; + use CreateCreditNoteBuilderLinesType::*; match s { "custom_line_item" => Ok(CustomLineItem), "invoice_line_item" => Ok(InvoiceLineItem), @@ -205,18 +145,18 @@ impl std::str::FromStr for PreviewCreditNoteLinesType { } } } -impl std::fmt::Display for PreviewCreditNoteLinesType { +impl std::fmt::Display for CreateCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PreviewCreditNoteLinesType { +impl std::fmt::Debug for CreateCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PreviewCreditNoteLinesType { +impl serde::Serialize for CreateCreditNoteBuilderLinesType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -224,14 +164,117 @@ impl serde::Serialize for PreviewCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -impl<'a> PreviewCreditNote<'a> { - /// Get a preview of a credit note without creating it. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/credit_notes/preview", self) +/// Issue a credit note to adjust the amount of a finalized invoice. +/// For a `status=open` invoice, a credit note reduces. +/// its `amount_due`. +/// For a `status=paid` invoice, a credit note does not affect its `amount_due`. +/// Instead, it can result. +/// in any combination of the following: +/// +///
    +///
  • Refund: create a new refund (using `refund_amount`) or link an existing refund (using `refund`).
  • . +///
  • Customer balance credit: credit the customer’s balance (using `credit_amount`) which will be automatically applied to their next invoice when it’s finalized.
  • . +///
  • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using `out_of_band_amount`).
  • . +///
+/// +/// For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total. +/// +/// You may issue multiple credit notes for an invoice. +/// Each credit note will increment the invoice’s `pre_payment_credit_notes_amount`. +/// or `post_payment_credit_notes_amount` depending on its `status` at the time of credit note creation. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCreditNote<'a> { + inner: CreateCreditNoteBuilder<'a>, +} +impl<'a> CreateCreditNote<'a> { + pub fn new(invoice: &'a str) -> Self { + Self { inner: CreateCreditNoteBuilder::new(invoice) } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn credit_amount(mut self, credit_amount: i64) -> Self { + self.inner.credit_amount = Some(credit_amount); + self + } + + pub fn effective_at(mut self, effective_at: stripe_types::Timestamp) -> Self { + self.inner.effective_at = Some(effective_at); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn lines(mut self, lines: &'a [CreateCreditNoteBuilderLines<'a>]) -> Self { + self.inner.lines = Some(lines); + self + } + + pub fn memo(mut self, memo: &'a str) -> Self { + self.inner.memo = Some(memo); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn out_of_band_amount(mut self, out_of_band_amount: i64) -> Self { + self.inner.out_of_band_amount = Some(out_of_band_amount); + self + } + + pub fn reason(mut self, reason: stripe_shared::CreditNoteReason) -> Self { + self.inner.reason = Some(reason); + self + } + + pub fn refund(mut self, refund: &'a str) -> Self { + self.inner.refund = Some(refund); + self + } + + pub fn refund_amount(mut self, refund_amount: i64) -> Self { + self.inner.refund_amount = Some(refund_amount); + self + } + + pub fn shipping_cost(mut self, shipping_cost: CreditNoteShippingCost<'a>) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } +} +impl CreateCreditNote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCreditNote<'_> { + type Output = stripe_shared::CreditNote; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/credit_notes").form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewLinesCreditNote<'a> { +pub struct PreviewCreditNoteBuilder<'a> { /// The integer amount in cents (or local equivalent) representing the total amount of the credit note. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -243,23 +286,14 @@ pub struct PreviewLinesCreditNote<'a> { /// When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. #[serde(skip_serializing_if = "Option::is_none")] pub effective_at: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// ID of the invoice. pub invoice: &'a str, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, /// Line items that make up the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub lines: Option<&'a [PreviewLinesCreditNoteLines<'a>]>, + pub lines: Option<&'a [PreviewCreditNoteBuilderLines<'a>]>, /// The credit note's memo appears on the credit note PDF. #[serde(skip_serializing_if = "Option::is_none")] pub memo: Option<&'a str>, @@ -285,22 +319,15 @@ pub struct PreviewLinesCreditNote<'a> { /// 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>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> PreviewLinesCreditNote<'a> { +impl<'a> PreviewCreditNoteBuilder<'a> { pub fn new(invoice: &'a str) -> Self { Self { amount: None, credit_amount: None, effective_at: None, - ending_before: None, expand: None, invoice, - limit: None, lines: None, memo: None, metadata: None, @@ -309,13 +336,12 @@ impl<'a> PreviewLinesCreditNote<'a> { refund: None, refund_amount: None, shipping_cost: None, - starting_after: None, } } } /// Line items that make up the credit note. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewLinesCreditNoteLines<'a> { +pub struct PreviewCreditNoteBuilderLines<'a> { /// The line item amount to credit. Only valid when `type` is `invoice_line_item`. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -337,7 +363,7 @@ pub struct PreviewLinesCreditNoteLines<'a> { pub tax_rates: Option<&'a [&'a str]>, /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[serde(rename = "type")] - pub type_: PreviewLinesCreditNoteLinesType, + pub type_: PreviewCreditNoteBuilderLinesType, /// The integer unit amount in cents (or local equivalent) of the credit note line item. /// This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. /// Only valid when `type` is `custom_line_item`. @@ -348,8 +374,8 @@ pub struct PreviewLinesCreditNoteLines<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> PreviewLinesCreditNoteLines<'a> { - pub fn new(type_: PreviewLinesCreditNoteLinesType) -> Self { +impl<'a> PreviewCreditNoteBuilderLines<'a> { + pub fn new(type_: PreviewCreditNoteBuilderLinesType) -> Self { Self { amount: None, description: None, @@ -365,13 +391,13 @@ impl<'a> PreviewLinesCreditNoteLines<'a> { } /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PreviewLinesCreditNoteLinesType { +pub enum PreviewCreditNoteBuilderLinesType { CustomLineItem, InvoiceLineItem, } -impl PreviewLinesCreditNoteLinesType { +impl PreviewCreditNoteBuilderLinesType { pub fn as_str(self) -> &'static str { - use PreviewLinesCreditNoteLinesType::*; + use PreviewCreditNoteBuilderLinesType::*; match self { CustomLineItem => "custom_line_item", InvoiceLineItem => "invoice_line_item", @@ -379,10 +405,10 @@ impl PreviewLinesCreditNoteLinesType { } } -impl std::str::FromStr for PreviewLinesCreditNoteLinesType { +impl std::str::FromStr for PreviewCreditNoteBuilderLinesType { type Err = (); fn from_str(s: &str) -> Result { - use PreviewLinesCreditNoteLinesType::*; + use PreviewCreditNoteBuilderLinesType::*; match s { "custom_line_item" => Ok(CustomLineItem), "invoice_line_item" => Ok(InvoiceLineItem), @@ -390,18 +416,18 @@ impl std::str::FromStr for PreviewLinesCreditNoteLinesType { } } } -impl std::fmt::Display for PreviewLinesCreditNoteLinesType { +impl std::fmt::Display for PreviewCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PreviewLinesCreditNoteLinesType { +impl std::fmt::Debug for PreviewCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PreviewLinesCreditNoteLinesType { +impl serde::Serialize for PreviewCreditNoteBuilderLinesType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -409,23 +435,364 @@ impl serde::Serialize for PreviewLinesCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -impl<'a> PreviewLinesCreditNote<'a> { - /// When retrieving a credit note preview, you’ll get a **lines** property containing the first handful of those items. - /// This URL you can retrieve the full (paginated) list of line items. - pub fn send( +/// Get a preview of a credit note without creating it. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PreviewCreditNote<'a> { + inner: PreviewCreditNoteBuilder<'a>, +} +impl<'a> PreviewCreditNote<'a> { + pub fn new(invoice: &'a str) -> Self { + Self { inner: PreviewCreditNoteBuilder::new(invoice) } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn credit_amount(mut self, credit_amount: i64) -> Self { + self.inner.credit_amount = Some(credit_amount); + self + } + + pub fn effective_at(mut self, effective_at: stripe_types::Timestamp) -> Self { + self.inner.effective_at = Some(effective_at); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn lines(mut self, lines: &'a [PreviewCreditNoteBuilderLines<'a>]) -> Self { + self.inner.lines = Some(lines); + self + } + + pub fn memo(mut self, memo: &'a str) -> Self { + self.inner.memo = Some(memo); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn out_of_band_amount(mut self, out_of_band_amount: i64) -> Self { + self.inner.out_of_band_amount = Some(out_of_band_amount); + self + } + + pub fn reason(mut self, reason: stripe_shared::CreditNoteReason) -> Self { + self.inner.reason = Some(reason); + self + } + + pub fn refund(mut self, refund: &'a str) -> Self { + self.inner.refund = Some(refund); + self + } + + pub fn refund_amount(mut self, refund_amount: i64) -> Self { + self.inner.refund_amount = Some(refund_amount); + self + } + + pub fn shipping_cost(mut self, shipping_cost: CreditNoteShippingCost<'a>) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } +} +impl PreviewCreditNote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for PreviewCreditNote<'_> { + type Output = stripe_shared::CreditNote; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/credit_notes/preview").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveCreditNoteBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveCreditNoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the credit note object with the given identifier. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCreditNote<'a> { + inner: RetrieveCreditNoteBuilder<'a>, + id: &'a stripe_shared::CreditNoteId, +} +impl<'a> RetrieveCreditNote<'a> { + pub fn new(id: &'a stripe_shared::CreditNoteId) -> Self { + Self { id, inner: RetrieveCreditNoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCreditNote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCreditNote<'_> { + type Output = stripe_shared::CreditNote; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/credit_notes/{id}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListCreditNoteBuilder<'a> { + /// Only return credit notes for the customer specified by this customer ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Only return credit notes for the invoice specified by this invoice ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice: Option<&'a str>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListCreditNoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of credit notes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCreditNote<'a> { + inner: ListCreditNoteBuilder<'a>, +} +impl<'a> ListCreditNote<'a> { + pub fn new() -> Self { + Self { inner: ListCreditNoteBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice(mut self, invoice: &'a str) -> Self { + self.inner.invoice = Some(invoice); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListCreditNote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCreditNote<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/credit_notes").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCreditNoteBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Credit note memo. + #[serde(skip_serializing_if = "Option::is_none")] + pub memo: Option<&'a str>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, +} +impl<'a> UpdateCreditNoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Updates an existing credit note. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCreditNote<'a> { + inner: UpdateCreditNoteBuilder<'a>, + id: &'a stripe_shared::CreditNoteId, +} +impl<'a> UpdateCreditNote<'a> { + pub fn new(id: &'a stripe_shared::CreditNoteId) -> Self { + Self { id, inner: UpdateCreditNoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn memo(mut self, memo: &'a str) -> Self { + self.inner.memo = Some(memo); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateCreditNote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCreditNote<'_> { + type Output = stripe_shared::CreditNote; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/credit_notes/{id}")).form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct VoidCreditNoteCreditNoteBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> VoidCreditNoteCreditNoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Marks a credit note as void. +/// Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). +#[derive(Clone, Debug, serde::Serialize)] +pub struct VoidCreditNoteCreditNote<'a> { + inner: VoidCreditNoteCreditNoteBuilder<'a>, + id: &'a stripe_shared::CreditNoteId, +} +impl<'a> VoidCreditNoteCreditNote<'a> { + pub fn new(id: &'a stripe_shared::CreditNoteId) -> Self { + Self { id, inner: VoidCreditNoteCreditNoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl VoidCreditNoteCreditNote<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/credit_notes/preview/lines", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/credit_notes/preview/lines", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for VoidCreditNoteCreditNote<'_> { + type Output = stripe_shared::CreditNote; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/credit_notes/{id}/void")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCreditNote<'a> { +pub struct PreviewLinesCreditNoteBuilder<'a> { /// The integer amount in cents (or local equivalent) representing the total amount of the credit note. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -437,14 +804,23 @@ pub struct CreateCreditNote<'a> { /// When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. #[serde(skip_serializing_if = "Option::is_none")] pub effective_at: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// ID of the invoice. pub invoice: &'a str, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, /// Line items that make up the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub lines: Option<&'a [CreateCreditNoteLines<'a>]>, + pub lines: Option<&'a [PreviewLinesCreditNoteBuilderLines<'a>]>, /// The credit note's memo appears on the credit note PDF. #[serde(skip_serializing_if = "Option::is_none")] pub memo: Option<&'a str>, @@ -470,15 +846,22 @@ pub struct CreateCreditNote<'a> { /// 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>, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, } -impl<'a> CreateCreditNote<'a> { +impl<'a> PreviewLinesCreditNoteBuilder<'a> { pub fn new(invoice: &'a str) -> Self { Self { amount: None, credit_amount: None, effective_at: None, + ending_before: None, expand: None, invoice, + limit: None, lines: None, memo: None, metadata: None, @@ -487,12 +870,13 @@ impl<'a> CreateCreditNote<'a> { refund: None, refund_amount: None, shipping_cost: None, + starting_after: None, } } } /// Line items that make up the credit note. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCreditNoteLines<'a> { +pub struct PreviewLinesCreditNoteBuilderLines<'a> { /// The line item amount to credit. Only valid when `type` is `invoice_line_item`. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -514,7 +898,7 @@ pub struct CreateCreditNoteLines<'a> { pub tax_rates: Option<&'a [&'a str]>, /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[serde(rename = "type")] - pub type_: CreateCreditNoteLinesType, + pub type_: PreviewLinesCreditNoteBuilderLinesType, /// The integer unit amount in cents (or local equivalent) of the credit note line item. /// This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. /// Only valid when `type` is `custom_line_item`. @@ -525,8 +909,8 @@ pub struct CreateCreditNoteLines<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateCreditNoteLines<'a> { - pub fn new(type_: CreateCreditNoteLinesType) -> Self { +impl<'a> PreviewLinesCreditNoteBuilderLines<'a> { + pub fn new(type_: PreviewLinesCreditNoteBuilderLinesType) -> Self { Self { amount: None, description: None, @@ -542,13 +926,13 @@ impl<'a> CreateCreditNoteLines<'a> { } /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCreditNoteLinesType { +pub enum PreviewLinesCreditNoteBuilderLinesType { CustomLineItem, InvoiceLineItem, } -impl CreateCreditNoteLinesType { +impl PreviewLinesCreditNoteBuilderLinesType { pub fn as_str(self) -> &'static str { - use CreateCreditNoteLinesType::*; + use PreviewLinesCreditNoteBuilderLinesType::*; match self { CustomLineItem => "custom_line_item", InvoiceLineItem => "invoice_line_item", @@ -556,10 +940,10 @@ impl CreateCreditNoteLinesType { } } -impl std::str::FromStr for CreateCreditNoteLinesType { +impl std::str::FromStr for PreviewLinesCreditNoteBuilderLinesType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCreditNoteLinesType::*; + use PreviewLinesCreditNoteBuilderLinesType::*; match s { "custom_line_item" => Ok(CustomLineItem), "invoice_line_item" => Ok(InvoiceLineItem), @@ -567,18 +951,18 @@ impl std::str::FromStr for CreateCreditNoteLinesType { } } } -impl std::fmt::Display for CreateCreditNoteLinesType { +impl std::fmt::Display for PreviewLinesCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCreditNoteLinesType { +impl std::fmt::Debug for PreviewLinesCreditNoteBuilderLinesType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCreditNoteLinesType { +impl serde::Serialize for PreviewLinesCreditNoteBuilderLinesType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -586,81 +970,115 @@ impl serde::Serialize for CreateCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -impl<'a> CreateCreditNote<'a> { - /// Issue a credit note to adjust the amount of a finalized invoice. - /// For a `status=open` invoice, a credit note reduces. - /// its `amount_due`. - /// For a `status=paid` invoice, a credit note does not affect its `amount_due`. - /// Instead, it can result. - /// in any combination of the following: - /// - ///
    - ///
  • Refund: create a new refund (using `refund_amount`) or link an existing refund (using `refund`).
  • . - ///
  • Customer balance credit: credit the customer’s balance (using `credit_amount`) which will be automatically applied to their next invoice when it’s finalized.
  • . - ///
  • Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using `out_of_band_amount`).
  • . - ///
- /// - /// For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total. - /// - /// You may issue multiple credit notes for an invoice. - /// Each credit note will increment the invoice’s `pre_payment_credit_notes_amount`. - /// or `post_payment_credit_notes_amount` depending on its `status` at the time of credit note creation. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/credit_notes", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCreditNote<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Credit note memo. - #[serde(skip_serializing_if = "Option::is_none")] - pub memo: Option<&'a str>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, +/// When retrieving a credit note preview, you’ll get a **lines** property containing the first handful of those items. +/// This URL you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PreviewLinesCreditNote<'a> { + inner: PreviewLinesCreditNoteBuilder<'a>, } -impl<'a> UpdateCreditNote<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> PreviewLinesCreditNote<'a> { + pub fn new(invoice: &'a str) -> Self { + Self { inner: PreviewLinesCreditNoteBuilder::new(invoice) } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn credit_amount(mut self, credit_amount: i64) -> Self { + self.inner.credit_amount = Some(credit_amount); + self + } + + pub fn effective_at(mut self, effective_at: stripe_types::Timestamp) -> Self { + self.inner.effective_at = Some(effective_at); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn lines(mut self, lines: &'a [PreviewLinesCreditNoteBuilderLines<'a>]) -> Self { + self.inner.lines = Some(lines); + self + } + + pub fn memo(mut self, memo: &'a str) -> Self { + self.inner.memo = Some(memo); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn out_of_band_amount(mut self, out_of_band_amount: i64) -> Self { + self.inner.out_of_band_amount = Some(out_of_band_amount); + self + } + + pub fn reason(mut self, reason: stripe_shared::CreditNoteReason) -> Self { + self.inner.reason = Some(reason); + self + } + + pub fn refund(mut self, refund: &'a str) -> Self { + self.inner.refund = Some(refund); + self + } + + pub fn refund_amount(mut self, refund_amount: i64) -> Self { + self.inner.refund_amount = Some(refund_amount); + self + } + + pub fn shipping_cost(mut self, shipping_cost: CreditNoteShippingCost<'a>) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> UpdateCreditNote<'a> { - /// Updates an existing credit note. - pub fn send( +impl PreviewLinesCreditNote<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_shared::CreditNoteId, - ) -> stripe::Response { - client.send_form(&format!("/credit_notes/{id}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct VoidCreditNoteCreditNote<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> VoidCreditNoteCreditNote<'a> { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> VoidCreditNoteCreditNote<'a> { - /// Marks a credit note as void. - /// Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::CreditNoteId, - ) -> stripe::Response { - client.send_form(&format!("/credit_notes/{id}/void"), self, http_types::Method::Post) + +impl StripeRequest for PreviewLinesCreditNote<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/credit_notes/preview/lines").query(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct TaxAmountWithTaxRateParam<'a> { /// The amount, in cents (or local equivalent), of the tax. diff --git a/generated/stripe_billing/src/credit_note_line_item/requests.rs b/generated/stripe_billing/src/credit_note_line_item/requests.rs index bc841a139..48960f1a5 100644 --- a/generated/stripe_billing/src/credit_note_line_item/requests.rs +++ b/generated/stripe_billing/src/credit_note_line_item/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCreditNoteCreditNoteLineItem<'a> { +pub struct ListCreditNoteCreditNoteLineItemBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,25 +22,64 @@ pub struct ListCreditNoteCreditNoteLineItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCreditNoteCreditNoteLineItem<'a> { +impl<'a> ListCreditNoteCreditNoteLineItemBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// When retrieving a credit note, you’ll get a **lines** property containing the the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCreditNoteCreditNoteLineItem<'a> { + inner: ListCreditNoteCreditNoteLineItemBuilder<'a>, + credit_note: &'a stripe_shared::CreditNoteId, +} impl<'a> ListCreditNoteCreditNoteLineItem<'a> { - /// When retrieving a credit note, you’ll get a **lines** property containing the the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( + pub fn new(credit_note: &'a stripe_shared::CreditNoteId) -> Self { + Self { credit_note, inner: ListCreditNoteCreditNoteLineItemBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListCreditNoteCreditNoteLineItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - credit_note: &stripe_shared::CreditNoteId, - ) -> stripe::Response> { - client.get_query(&format!("/credit_notes/{credit_note}/lines"), self) - } - pub fn paginate( - self, - credit_note: &stripe_shared::CreditNoteId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/credit_notes/{credit_note}/lines"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCreditNoteCreditNoteLineItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let credit_note = self.credit_note; + RequestBuilder::new(StripeMethod::Get, format!("/credit_notes/{credit_note}/lines")) + .query(&self.inner) } } diff --git a/generated/stripe_billing/src/invoice/requests.rs b/generated/stripe_billing/src/invoice/requests.rs index ae4506f97..26a094b5e 100644 --- a/generated/stripe_billing/src/invoice/requests.rs +++ b/generated/stripe_billing/src/invoice/requests.rs @@ -1,100 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteInvoice {} -impl DeleteInvoice { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteInvoice { - /// Permanently deletes a one-off invoice draft. - /// This cannot be undone. - /// Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice). - pub fn send( - &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListInvoice<'a> { - /// The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// Only return invoices for the customer specified by this customer ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub due_date: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. - /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Only return invoices for the subscription specified by this subscription ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub subscription: Option<&'a str>, -} -impl<'a> ListInvoice<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListInvoice<'a> { - /// You can list all invoices, or list the invoices for a specific customer. - /// The invoices are returned sorted by creation date, with the most recently created invoices appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/invoices", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/invoices", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveInvoice<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveInvoice<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveInvoice<'a> { - /// Retrieves the invoice with the given ID. - pub fn send( - &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.get_query(&format!("/invoices/{invoice}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchInvoice<'a> { +pub struct SearchInvoiceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -111,35 +20,68 @@ pub struct SearchInvoice<'a> { /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for invoices](https://stripe.com/docs/search#query-fields-for-invoices). pub query: &'a str, } -impl<'a> SearchInvoice<'a> { +impl<'a> SearchInvoiceBuilder<'a> { pub fn new(query: &'a str) -> Self { Self { expand: None, limit: None, page: None, query } } } +/// Search for invoices you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchInvoice<'a> { + inner: SearchInvoiceBuilder<'a>, +} impl<'a> SearchInvoice<'a> { - /// Search for invoices you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( + pub fn new(query: &'a str) -> Self { + Self { inner: SearchInvoiceBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self + } +} +impl SearchInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/invoices/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/invoices/search", self) +} + +impl StripeRequest for SearchInvoice<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/invoices/search").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoice<'a> { +pub struct UpcomingInvoiceBuilder<'a> { /// Settings for automatic tax lookup for this invoice preview. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// The code of the coupon to apply. /// If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. /// Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. @@ -156,7 +98,7 @@ pub struct UpcomingInvoice<'a> { /// Details about the customer you want to invoice or overrides for an existing customer. /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_details: Option>, + pub customer_details: Option>, /// The coupons to redeem into discounts for the invoice preview. /// If not specified, inherits the discount from the customer or subscription. /// This only works for coupons directly applied to the invoice. @@ -170,16 +112,7 @@ pub struct UpcomingInvoice<'a> { pub expand: Option<&'a [&'a str]>, /// List of invoice items to add or update in the upcoming invoice preview. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_items: Option<&'a [UpcomingInvoiceInvoiceItems<'a>]>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, - /// The account (if any) for which the funds of the invoice payment are intended. - /// If set, the invoice will be presented with the branding and support information of the specified account. - /// See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details. - #[serde(skip_serializing_if = "Option::is_none")] - pub on_behalf_of: Option<&'a str>, + pub invoice_items: Option<&'a [UpcomingInvoiceBuilderInvoiceItems<'a>]>, /// The identifier of the schedule whose upcoming invoice you'd like to retrieve. /// Cannot be used with subscription or subscription fields. #[serde(skip_serializing_if = "Option::is_none")] @@ -193,10 +126,10 @@ pub struct UpcomingInvoice<'a> { /// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. /// For existing subscriptions, the value can only be set to `now` or `unchanged`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_billing_cycle_anchor: Option, - /// A timestamp at which the subscription should cancel. - /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. - /// If set during a future period, this will always cause a proration for that period. + pub subscription_billing_cycle_anchor: + Option, + /// Timestamp indicating when the subscription should be scheduled to cancel. + /// Will prorate if within the current period and prorations have been enabled using `proration_behavior`. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_cancel_at: Option, /// Boolean indicating whether this subscription should cancel at the end of the current period. @@ -211,11 +144,12 @@ pub struct UpcomingInvoice<'a> { pub subscription_default_tax_rates: Option<&'a [&'a str]>, /// A list of up to 20 subscription items, each with an attached price. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_items: Option<&'a [UpcomingInvoiceSubscriptionItems<'a>]>, + pub subscription_items: Option<&'a [UpcomingInvoiceBuilderSubscriptionItems<'a>]>, /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_proration_behavior: Option, + pub subscription_proration_behavior: + Option, /// If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. /// The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. /// If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. @@ -224,14 +158,14 @@ pub struct UpcomingInvoice<'a> { pub subscription_proration_date: Option, /// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_resume_at: Option, - /// Date a subscription is intended to start (can be future or past). + pub subscription_resume_at: Option, + /// Date a subscription is intended to start (can be future or past) #[serde(skip_serializing_if = "Option::is_none")] pub subscription_start_date: Option, /// If provided, the invoice returned will preview updating or creating a subscription with that trial end. /// If set, one of `subscription_items` or `subscription` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_trial_end: Option, + pub subscription_trial_end: Option, /// Indicates if a plan's `trial_period_days` should be applied to the subscription. /// Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. /// Setting this flag to `true` together with `subscription_trial_end` is not allowed. @@ -239,95 +173,15 @@ pub struct UpcomingInvoice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub subscription_trial_from_plan: Option, } -impl<'a> UpcomingInvoice<'a> { +impl<'a> UpcomingInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this invoice preview. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceAutomaticTax<'a> { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpcomingInvoiceAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpcomingInvoiceAutomaticTaxLiabilityType, -} -impl<'a> UpcomingInvoiceAutomaticTaxLiability<'a> { - pub fn new(type_: UpcomingInvoiceAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpcomingInvoiceAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpcomingInvoiceAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpcomingInvoiceAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpcomingInvoiceAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpcomingInvoiceAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpcomingInvoiceAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpcomingInvoiceAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Details about the customer you want to invoice or overrides for an existing customer. /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetails<'a> { +pub struct UpcomingInvoiceBuilderCustomerDetails<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, @@ -339,26 +193,26 @@ pub struct UpcomingInvoiceCustomerDetails<'a> { pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, + pub tax_exempt: Option, /// The customer's tax IDs. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_ids: Option<&'a [UpcomingInvoiceCustomerDetailsTaxIds<'a>]>, + pub tax_ids: Option<&'a [UpcomingInvoiceBuilderCustomerDetailsTaxIds<'a>]>, } -impl<'a> UpcomingInvoiceCustomerDetails<'a> { +impl<'a> UpcomingInvoiceBuilderCustomerDetails<'a> { pub fn new() -> Self { Self::default() } } /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceCustomerDetailsTaxExempt { +pub enum UpcomingInvoiceBuilderCustomerDetailsTaxExempt { Exempt, None, Reverse, } -impl UpcomingInvoiceCustomerDetailsTaxExempt { +impl UpcomingInvoiceBuilderCustomerDetailsTaxExempt { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceCustomerDetailsTaxExempt::*; + use UpcomingInvoiceBuilderCustomerDetailsTaxExempt::*; match self { Exempt => "exempt", None => "none", @@ -367,10 +221,10 @@ impl UpcomingInvoiceCustomerDetailsTaxExempt { } } -impl std::str::FromStr for UpcomingInvoiceCustomerDetailsTaxExempt { +impl std::str::FromStr for UpcomingInvoiceBuilderCustomerDetailsTaxExempt { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceCustomerDetailsTaxExempt::*; + use UpcomingInvoiceBuilderCustomerDetailsTaxExempt::*; match s { "exempt" => Ok(Exempt), "none" => Ok(None), @@ -379,18 +233,18 @@ impl std::str::FromStr for UpcomingInvoiceCustomerDetailsTaxExempt { } } } -impl std::fmt::Display for UpcomingInvoiceCustomerDetailsTaxExempt { +impl std::fmt::Display for UpcomingInvoiceBuilderCustomerDetailsTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceCustomerDetailsTaxExempt { +impl std::fmt::Debug for UpcomingInvoiceBuilderCustomerDetailsTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceCustomerDetailsTaxExempt { +impl serde::Serialize for UpcomingInvoiceBuilderCustomerDetailsTaxExempt { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -400,22 +254,22 @@ impl serde::Serialize for UpcomingInvoiceCustomerDetailsTaxExempt { } /// The customer's tax IDs. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetailsTaxIds<'a> { +pub struct UpcomingInvoiceBuilderCustomerDetailsTaxIds<'a> { /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[serde(rename = "type")] - pub type_: UpcomingInvoiceCustomerDetailsTaxIdsType, + pub type_: UpcomingInvoiceBuilderCustomerDetailsTaxIdsType, /// Value of the tax ID. pub value: &'a str, } -impl<'a> UpcomingInvoiceCustomerDetailsTaxIds<'a> { - pub fn new(type_: UpcomingInvoiceCustomerDetailsTaxIdsType, value: &'a str) -> Self { +impl<'a> UpcomingInvoiceBuilderCustomerDetailsTaxIds<'a> { + pub fn new(type_: UpcomingInvoiceBuilderCustomerDetailsTaxIdsType, value: &'a str) -> Self { Self { type_, value } } } /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpcomingInvoiceCustomerDetailsTaxIdsType { +pub enum UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { AdNrt, AeTrn, ArCuit, @@ -485,9 +339,9 @@ pub enum UpcomingInvoiceCustomerDetailsTaxIdsType { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpcomingInvoiceCustomerDetailsTaxIdsType { +impl UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceCustomerDetailsTaxIdsType::*; + use UpcomingInvoiceBuilderCustomerDetailsTaxIdsType::*; match self { AdNrt => "ad_nrt", AeTrn => "ae_trn", @@ -560,10 +414,10 @@ impl UpcomingInvoiceCustomerDetailsTaxIdsType { } } -impl std::str::FromStr for UpcomingInvoiceCustomerDetailsTaxIdsType { +impl std::str::FromStr for UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceCustomerDetailsTaxIdsType::*; + use UpcomingInvoiceBuilderCustomerDetailsTaxIdsType::*; match s { "ad_nrt" => Ok(AdNrt), "ae_trn" => Ok(AeTrn), @@ -635,18 +489,18 @@ impl std::str::FromStr for UpcomingInvoiceCustomerDetailsTaxIdsType { } } } -impl std::fmt::Display for UpcomingInvoiceCustomerDetailsTaxIdsType { +impl std::fmt::Display for UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceCustomerDetailsTaxIdsType { +impl std::fmt::Debug for UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceCustomerDetailsTaxIdsType { +impl serde::Serialize for UpcomingInvoiceBuilderCustomerDetailsTaxIdsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -656,7 +510,7 @@ impl serde::Serialize for UpcomingInvoiceCustomerDetailsTaxIdsType { } /// List of invoice items to add or update in the upcoming invoice preview. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceInvoiceItems<'a> { +pub struct UpcomingInvoiceBuilderInvoiceItems<'a> { /// The integer amount in cents (or local equivalent) of previewed invoice item. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -697,7 +551,7 @@ pub struct UpcomingInvoiceInvoiceItems<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Non-negative integer. The quantity of units for the invoice item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -706,7 +560,7 @@ pub struct UpcomingInvoiceInvoiceItems<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, @@ -723,14 +577,14 @@ pub struct UpcomingInvoiceInvoiceItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpcomingInvoiceInvoiceItems<'a> { +impl<'a> UpcomingInvoiceBuilderInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceInvoiceItemsPriceData<'a> { +pub struct UpcomingInvoiceBuilderInvoiceItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -741,7 +595,7 @@ pub struct UpcomingInvoiceInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -750,7 +604,7 @@ pub struct UpcomingInvoiceInvoiceItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpcomingInvoiceInvoiceItemsPriceData<'a> { +impl<'a> UpcomingInvoiceBuilderInvoiceItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -760,14 +614,14 @@ impl<'a> UpcomingInvoiceInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +pub enum UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +impl UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior::*; + use UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -776,10 +630,10 @@ impl UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior::*; + use UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -788,18 +642,18 @@ impl std::str::FromStr for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { +impl serde::Serialize for UpcomingInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -812,14 +666,14 @@ impl serde::Serialize for UpcomingInvoiceInvoiceItemsPriceDataTaxBehavior { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceInvoiceItemsTaxBehavior { +pub enum UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpcomingInvoiceInvoiceItemsTaxBehavior { +impl UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceInvoiceItemsTaxBehavior::*; + use UpcomingInvoiceBuilderInvoiceItemsTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -828,10 +682,10 @@ impl UpcomingInvoiceInvoiceItemsTaxBehavior { } } -impl std::str::FromStr for UpcomingInvoiceInvoiceItemsTaxBehavior { +impl std::str::FromStr for UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceInvoiceItemsTaxBehavior::*; + use UpcomingInvoiceBuilderInvoiceItemsTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -840,80 +694,18 @@ impl std::str::FromStr for UpcomingInvoiceInvoiceItemsTaxBehavior { } } } -impl std::fmt::Display for UpcomingInvoiceInvoiceItemsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpcomingInvoiceInvoiceItemsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpcomingInvoiceInvoiceItemsTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpcomingInvoiceIssuerType, -} -impl<'a> UpcomingInvoiceIssuer<'a> { - pub fn new(type_: UpcomingInvoiceIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceIssuerType { - Account, - Self_, -} -impl UpcomingInvoiceIssuerType { - pub fn as_str(self) -> &'static str { - use UpcomingInvoiceIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpcomingInvoiceIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpcomingInvoiceIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpcomingInvoiceIssuerType { +impl std::fmt::Display for UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceIssuerType { +impl std::fmt::Debug for UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceIssuerType { +impl serde::Serialize for UpcomingInvoiceBuilderInvoiceItemsTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -926,14 +718,14 @@ impl serde::Serialize for UpcomingInvoiceIssuerType { /// For existing subscriptions, the value can only be set to `now` or `unchanged`. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpcomingInvoiceSubscriptionBillingCycleAnchor { +pub enum UpcomingInvoiceBuilderSubscriptionBillingCycleAnchor { Now, Unchanged, Timestamp(stripe_types::Timestamp), } /// A list of up to 20 subscription items, each with an attached price. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceSubscriptionItems<'a> { +pub struct UpcomingInvoiceBuilderSubscriptionItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -963,7 +755,7 @@ pub struct UpcomingInvoiceSubscriptionItems<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -973,27 +765,27 @@ pub struct UpcomingInvoiceSubscriptionItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpcomingInvoiceSubscriptionItems<'a> { +impl<'a> UpcomingInvoiceBuilderSubscriptionItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceSubscriptionItemsPriceData<'a> { +pub struct UpcomingInvoiceBuilderSubscriptionItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: UpcomingInvoiceSubscriptionItemsPriceDataRecurring, + pub recurring: UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -1002,11 +794,11 @@ pub struct UpcomingInvoiceSubscriptionItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpcomingInvoiceSubscriptionItemsPriceData<'a> { +impl<'a> UpcomingInvoiceBuilderSubscriptionItemsPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: UpcomingInvoiceSubscriptionItemsPriceDataRecurring, + recurring: UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurring, ) -> Self { Self { currency, @@ -1020,31 +812,33 @@ impl<'a> UpcomingInvoiceSubscriptionItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceSubscriptionItemsPriceDataRecurring { +pub struct UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval, + pub interval: UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpcomingInvoiceSubscriptionItemsPriceDataRecurring { - pub fn new(interval: UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval) -> Self { +impl UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurring { + pub fn new( + interval: UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval, + ) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +pub enum UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval::*; + use UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -1054,10 +848,10 @@ impl UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::str::FromStr for UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval::*; + use UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -1067,18 +861,18 @@ impl std::str::FromStr for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInt } } } -impl std::fmt::Display for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Display for UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Debug for UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl serde::Serialize for UpcomingInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1091,14 +885,14 @@ impl serde::Serialize for UpcomingInvoiceSubscriptionItemsPriceDataRecurringInte /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +pub enum UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior::*; + use UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1107,10 +901,10 @@ impl UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior::*; + use UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1119,18 +913,18 @@ impl std::str::FromStr for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior } } } -impl std::fmt::Display for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl serde::Serialize for UpcomingInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1141,14 +935,14 @@ impl serde::Serialize for UpcomingInvoiceSubscriptionItemsPriceDataTaxBehavior { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceSubscriptionProrationBehavior { +pub enum UpcomingInvoiceBuilderSubscriptionProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpcomingInvoiceSubscriptionProrationBehavior { +impl UpcomingInvoiceBuilderSubscriptionProrationBehavior { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceSubscriptionProrationBehavior::*; + use UpcomingInvoiceBuilderSubscriptionProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -1157,10 +951,10 @@ impl UpcomingInvoiceSubscriptionProrationBehavior { } } -impl std::str::FromStr for UpcomingInvoiceSubscriptionProrationBehavior { +impl std::str::FromStr for UpcomingInvoiceBuilderSubscriptionProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceSubscriptionProrationBehavior::*; + use UpcomingInvoiceBuilderSubscriptionProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -1169,18 +963,18 @@ impl std::str::FromStr for UpcomingInvoiceSubscriptionProrationBehavior { } } } -impl std::fmt::Display for UpcomingInvoiceSubscriptionProrationBehavior { +impl std::fmt::Display for UpcomingInvoiceBuilderSubscriptionProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceSubscriptionProrationBehavior { +impl std::fmt::Debug for UpcomingInvoiceBuilderSubscriptionProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceSubscriptionProrationBehavior { +impl serde::Serialize for UpcomingInvoiceBuilderSubscriptionProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1190,40 +984,40 @@ impl serde::Serialize for UpcomingInvoiceSubscriptionProrationBehavior { } /// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingInvoiceSubscriptionResumeAt { +pub enum UpcomingInvoiceBuilderSubscriptionResumeAt { Now, } -impl UpcomingInvoiceSubscriptionResumeAt { +impl UpcomingInvoiceBuilderSubscriptionResumeAt { pub fn as_str(self) -> &'static str { - use UpcomingInvoiceSubscriptionResumeAt::*; + use UpcomingInvoiceBuilderSubscriptionResumeAt::*; match self { Now => "now", } } } -impl std::str::FromStr for UpcomingInvoiceSubscriptionResumeAt { +impl std::str::FromStr for UpcomingInvoiceBuilderSubscriptionResumeAt { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingInvoiceSubscriptionResumeAt::*; + use UpcomingInvoiceBuilderSubscriptionResumeAt::*; match s { "now" => Ok(Now), _ => Err(()), } } } -impl std::fmt::Display for UpcomingInvoiceSubscriptionResumeAt { +impl std::fmt::Display for UpcomingInvoiceBuilderSubscriptionResumeAt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingInvoiceSubscriptionResumeAt { +impl std::fmt::Debug for UpcomingInvoiceBuilderSubscriptionResumeAt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingInvoiceSubscriptionResumeAt { +impl serde::Serialize for UpcomingInvoiceBuilderSubscriptionResumeAt { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1235,298 +1029,486 @@ impl serde::Serialize for UpcomingInvoiceSubscriptionResumeAt { /// If set, one of `subscription_items` or `subscription` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpcomingInvoiceSubscriptionTrialEnd { +pub enum UpcomingInvoiceBuilderSubscriptionTrialEnd { Now, Timestamp(stripe_types::Timestamp), } +/// At any time, you can preview the upcoming invoice for a customer. +/// This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. +/// It will also show you any discounts that are applicable to the invoice. +/// +/// Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. +/// As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. +/// If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount. +/// +/// You can preview the effects of updating a subscription, including a preview of what proration will take place. +/// To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a `proration_date` parameter when doing the actual subscription update. +/// The value passed in should be the same as the `subscription_proration_date` returned on the upcoming invoice resource. +/// The recommended way to get only the prorations being previewed is to consider only proration line items where `period[start]` is equal to the `subscription_proration_date` on the upcoming invoice resource. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpcomingInvoice<'a> { + inner: UpcomingInvoiceBuilder<'a>, +} impl<'a> UpcomingInvoice<'a> { - /// At any time, you can preview the upcoming invoice for a customer. - /// This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. - /// It will also show you any discounts that are applicable to the invoice. - /// - /// Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. - /// As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. - /// If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount. - /// - /// You can preview the effects of updating a subscription, including a preview of what proration will take place. - /// To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a `proration_date` parameter when doing the actual subscription update. - /// The value passed in should be the same as the `subscription_proration_date` returned on the upcoming invoice resource. - /// The recommended way to get only the prorations being previewed is to consider only proration line items where `period[start]` is equal to the `subscription_proration_date` on the upcoming invoice resource. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/invoices/upcoming", self) + pub fn new() -> Self { + Self { inner: UpcomingInvoiceBuilder::new() } + } + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_details( + mut self, + customer_details: UpcomingInvoiceBuilderCustomerDetails<'a>, + ) -> Self { + self.inner.customer_details = Some(customer_details); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_items( + mut self, + invoice_items: &'a [UpcomingInvoiceBuilderInvoiceItems<'a>], + ) -> Self { + self.inner.invoice_items = Some(invoice_items); + self + } + + pub fn schedule(mut self, schedule: &'a str) -> Self { + self.inner.schedule = Some(schedule); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self + } + + pub fn subscription_billing_cycle_anchor( + mut self, + subscription_billing_cycle_anchor: UpcomingInvoiceBuilderSubscriptionBillingCycleAnchor, + ) -> Self { + self.inner.subscription_billing_cycle_anchor = Some(subscription_billing_cycle_anchor); + self + } + + pub fn subscription_cancel_at( + mut self, + subscription_cancel_at: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_cancel_at = Some(subscription_cancel_at); + self + } + + pub fn subscription_cancel_at_period_end( + mut self, + subscription_cancel_at_period_end: bool, + ) -> Self { + self.inner.subscription_cancel_at_period_end = Some(subscription_cancel_at_period_end); + self + } + + pub fn subscription_cancel_now(mut self, subscription_cancel_now: bool) -> Self { + self.inner.subscription_cancel_now = Some(subscription_cancel_now); + self + } + + pub fn subscription_default_tax_rates( + mut self, + subscription_default_tax_rates: &'a [&'a str], + ) -> Self { + self.inner.subscription_default_tax_rates = Some(subscription_default_tax_rates); + self + } + + pub fn subscription_items( + mut self, + subscription_items: &'a [UpcomingInvoiceBuilderSubscriptionItems<'a>], + ) -> Self { + self.inner.subscription_items = Some(subscription_items); + self + } + + pub fn subscription_proration_behavior( + mut self, + subscription_proration_behavior: UpcomingInvoiceBuilderSubscriptionProrationBehavior, + ) -> Self { + self.inner.subscription_proration_behavior = Some(subscription_proration_behavior); + self + } + + pub fn subscription_proration_date( + mut self, + subscription_proration_date: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_proration_date = Some(subscription_proration_date); + self + } + + pub fn subscription_resume_at( + mut self, + subscription_resume_at: UpcomingInvoiceBuilderSubscriptionResumeAt, + ) -> Self { + self.inner.subscription_resume_at = Some(subscription_resume_at); + self + } + + pub fn subscription_start_date( + mut self, + subscription_start_date: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_start_date = Some(subscription_start_date); + self + } + + pub fn subscription_trial_end( + mut self, + subscription_trial_end: UpcomingInvoiceBuilderSubscriptionTrialEnd, + ) -> Self { + self.inner.subscription_trial_end = Some(subscription_trial_end); + self + } + + pub fn subscription_trial_from_plan(mut self, subscription_trial_from_plan: bool) -> Self { + self.inner.subscription_trial_from_plan = Some(subscription_trial_from_plan); + self + } +} +impl UpcomingInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpcomingInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/invoices/upcoming").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoice<'a> { - /// Settings for automatic tax lookup for this invoice preview. +pub struct UpdateInvoiceBuilder<'a> { + /// The account tax IDs associated with the invoice. Only editable when the invoice is a draft. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, - /// The code of the coupon to apply. - /// If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. - /// Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. - /// The invoice can be previewed without a coupon by passing this value as an empty string. + pub account_tax_ids: Option<&'a [&'a str]>, + /// A fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account. + /// The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. + /// For more information, see the application fees [documentation](https://stripe.com/docs/billing/invoices/connect#collecting-fees). #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// The currency to preview this invoice in. Defaults to that of `customer` if not specified. + pub application_fee_amount: Option, + /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, - /// The identifier of the customer whose upcoming invoice you'd like to retrieve. - /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. + pub auto_advance: Option, + /// Settings for automatic tax lookup for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// Details about the customer you want to invoice or overrides for an existing customer. - /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. + pub automatic_tax: Option, + /// Either `charge_automatically` or `send_invoice`. + /// This field can be updated only on `draft` invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_details: Option>, - /// The coupons to redeem into discounts for the invoice preview. - /// If not specified, inherits the discount from the customer or subscription. - /// This only works for coupons directly applied to the invoice. - /// To apply a coupon to a subscription, you must use the `coupon` parameter instead. - /// Pass an empty string to avoid inheriting any discounts. - /// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. + pub collection_method: Option, + /// A list of up to 4 custom fields to be displayed on the invoice. + /// If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. + /// Pass an empty string to remove previously-defined fields. + #[serde(skip_serializing_if = "Option::is_none")] + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, + /// The number of days from which the invoice is created until it is due. + /// Only valid for invoices where `collection_method=send_invoice`. + /// This field can only be updated on `draft` invoices. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, + /// ID of the default payment method for the invoice. + /// It must belong to the customer associated with the invoice. + /// If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_payment_method: Option<&'a str>, + /// ID of the default payment source for the invoice. + /// It must belong to the customer associated with the invoice and be in a chargeable state. + /// If not set, defaults to the subscription's default source, if any, or to the customer's default source. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_source: Option<&'a str>, + /// The tax rates that will apply to any line item that does not have `tax_rates` set. + /// Pass an empty string to remove previously-defined tax rates. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_tax_rates: Option<&'a [&'a str]>, + /// An arbitrary string attached to the object. + /// Often useful for displaying to users. + /// Referenced as 'memo' in the Dashboard. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// The discounts that will apply to the invoice. + /// Pass an empty string to remove previously-defined discounts. #[serde(skip_serializing_if = "Option::is_none")] pub discounts: Option<&'a [DiscountsDataParam<'a>]>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + /// The date on which payment for this invoice is due. + /// Only valid for invoices where `collection_method=send_invoice`. + /// This field can only be updated on `draft` invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, + pub due_date: Option, + /// The date when this invoice is in effect. + /// Same as `finalized_at` unless overwritten. + /// When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. + #[serde(skip_serializing_if = "Option::is_none")] + pub effective_at: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// List of invoice items to add or update in the upcoming invoice preview. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_items: Option<&'a [UpcomingLinesInvoiceInvoiceItems<'a>]>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. + /// Footer to be displayed on the invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. + pub footer: Option<&'a str>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub metadata: Option<&'a std::collections::HashMap>, /// The account (if any) for which the funds of the invoice payment are intended. /// If set, the invoice will be presented with the branding and support information of the specified account. /// See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details. #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, - /// The identifier of the schedule whose upcoming invoice you'd like to retrieve. - /// Cannot be used with subscription or subscription fields. + /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. #[serde(skip_serializing_if = "Option::is_none")] - pub schedule: Option<&'a str>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + pub payment_settings: Option>, + /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// The identifier of the subscription for which you'd like to retrieve the upcoming invoice. - /// If not provided, but a `subscription_items` is provided, you will preview creating a subscription with those items. - /// If neither `subscription` nor `subscription_items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. + pub rendering: Option, + /// This is a legacy field that will be removed soon. + /// For details about `rendering_options`, refer to `rendering` instead. + /// Options for invoice PDF rendering. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription: Option<&'a str>, - /// For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). - /// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. - /// For existing subscriptions, the value can only be set to `now` or `unchanged`. + pub rendering_options: Option, + /// Settings for the cost of shipping for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_billing_cycle_anchor: - Option, - /// A timestamp at which the subscription should cancel. - /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. - /// If set during a future period, this will always cause a proration for that period. + pub shipping_cost: Option>, + /// Shipping details for the invoice. + /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel_at: Option, - /// Boolean indicating whether this subscription should cancel at the end of the current period. + pub shipping_details: Option>, + /// Extra information about a charge for the customer's credit card statement. + /// It must contain at least one letter. + /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel_at_period_end: Option, - /// This simulates the subscription being canceled or expired immediately. + pub statement_descriptor: Option<&'a str>, + /// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. + /// This will be unset if you POST an empty value. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_cancel_now: Option, - /// If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. - /// The default tax rates will apply to any line item that does not have `tax_rates` set. + pub transfer_data: Option>, +} +impl<'a> UpdateInvoiceBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettings<'a> { + /// ID of the mandate to be used for this invoice. + /// It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_default_tax_rates: Option<&'a [&'a str]>, - /// A list of up to 20 subscription items, each with an attached price. + pub default_mandate: Option<&'a str>, + /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_items: Option<&'a [UpcomingLinesInvoiceSubscriptionItems<'a>]>, - /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. - /// The default value is `create_prorations`. + pub payment_method_options: Option>, + /// The list of payment method types (e.g. + /// card) to provide to the invoice’s PaymentIntent. + /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_proration_behavior: Option, - /// If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. - /// The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. - /// If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. - /// Also, `subscription_proration_behavior` cannot be set to 'none'. + pub payment_method_types: Option<&'a [UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes]>, +} +impl<'a> UpdateInvoiceBuilderPaymentSettings<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptions<'a> { + /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_proration_date: Option, - /// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. + pub acss_debit: Option, + /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_resume_at: Option, - /// Date a subscription is intended to start (can be future or past). + pub bancontact: Option, + /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_start_date: Option, - /// If provided, the invoice returned will preview updating or creating a subscription with that trial end. - /// If set, one of `subscription_items` or `subscription` is required. + pub card: Option, + /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_trial_end: Option, - /// Indicates if a plan's `trial_period_days` should be applied to the subscription. - /// Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. - /// Setting this flag to `true` together with `subscription_trial_end` is not allowed. - /// See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. + pub customer_balance: Option>, + /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_trial_from_plan: Option, + pub konbini: Option<&'a serde_json::Value>, + /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. + #[serde(skip_serializing_if = "Option::is_none")] + pub us_bank_account: + Option>, } -impl<'a> UpcomingLinesInvoice<'a> { +impl<'a> UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this invoice preview. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceAutomaticTax<'a> { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. +/// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { + /// Additional fields for Mandate creation + #[serde(skip_serializing_if = "Option::is_none")] + pub mandate_options: + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, + pub verification_method: + Option, } -impl<'a> UpcomingLinesInvoiceAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { + pub fn new() -> Self { + Self::default() } } -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpcomingLinesInvoiceAutomaticTaxLiabilityType, +/// Additional fields for Mandate creation +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { + /// Transaction type of the mandate. +#[serde(skip_serializing_if = "Option::is_none")] +pub transaction_type: Option, + } -impl<'a> UpcomingLinesInvoiceAutomaticTaxLiability<'a> { - pub fn new(type_: UpcomingLinesInvoiceAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { + pub fn new() -> Self { + Self::default() } } -/// Type of the account referenced in the request. +/// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceAutomaticTaxLiabilityType { - Account, - Self_, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType +{ + Business, + Personal, } -impl UpcomingLinesInvoiceAutomaticTaxLiabilityType { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceAutomaticTaxLiabilityType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { - Account => "account", - Self_ => "self", + Business => "business", + Personal => "personal", } } } -impl std::str::FromStr for UpcomingLinesInvoiceAutomaticTaxLiabilityType { +impl std::str::FromStr for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceAutomaticTaxLiabilityType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), + "business" => Ok(Business), +"personal" => Ok(Personal), +_ => Err(()) + } } } -impl std::fmt::Display for UpcomingLinesInvoiceAutomaticTaxLiabilityType { +impl std::fmt::Display for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceAutomaticTaxLiabilityType { +impl std::fmt::Debug for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } -/// Details about the customer you want to invoice or overrides for an existing customer. -/// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetails<'a> { - /// The customer's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// The customer's shipping information. Appears on invoices emailed to this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, - /// Tax details about the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, - /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, - /// The customer's tax IDs. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_ids: Option<&'a [UpcomingLinesInvoiceCustomerDetailsTaxIds<'a>]>, -} -impl<'a> UpcomingLinesInvoiceCustomerDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceCustomerDetailsTaxExempt { - Exempt, - None, - Reverse, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { + Automatic, + Instant, + Microdeposits, } -impl UpcomingLinesInvoiceCustomerDetailsTaxExempt { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceCustomerDetailsTaxExempt::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { - Exempt => "exempt", - None => "none", - Reverse => "reverse", + Automatic => "automatic", + Instant => "instant", + Microdeposits => "microdeposits", } } } -impl std::str::FromStr for UpcomingLinesInvoiceCustomerDetailsTaxExempt { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceCustomerDetailsTaxExempt::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { - "exempt" => Ok(Exempt), - "none" => Ok(None), - "reverse" => Ok(Reverse), + "automatic" => Ok(Automatic), + "instant" => Ok(Instant), + "microdeposits" => Ok(Microdeposits), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceCustomerDetailsTaxExempt { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceCustomerDetailsTaxExempt { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceCustomerDetailsTaxExempt { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1534,255 +1516,72 @@ impl serde::Serialize for UpcomingLinesInvoiceCustomerDetailsTaxExempt { serializer.serialize_str(self.as_str()) } } -/// The customer's tax IDs. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetailsTaxIds<'a> { - /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. - #[serde(rename = "type")] - pub type_: UpcomingLinesInvoiceCustomerDetailsTaxIdsType, - /// Value of the tax ID. - pub value: &'a str, +/// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontact { + /// Preferred language of the Bancontact authorization page that the customer is redirected to. + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_language: + Option, } -impl<'a> UpcomingLinesInvoiceCustomerDetailsTaxIds<'a> { - pub fn new(type_: UpcomingLinesInvoiceCustomerDetailsTaxIdsType, value: &'a str) -> Self { - Self { type_, value } +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontact { + pub fn new() -> Self { + Self::default() } } -/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. +/// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum UpcomingLinesInvoiceCustomerDetailsTaxIdsType { - AdNrt, - AeTrn, - ArCuit, - AuAbn, - AuArn, - BgUic, - BoTin, - BrCnpj, - BrCpf, - CaBn, - CaGstHst, - CaPstBc, - CaPstMb, - CaPstSk, - CaQst, - ChVat, - ClTin, - CnTin, - CoNit, - CrTin, - DoRcn, - EcRuc, - EgTin, - EsCif, - EuOssVat, - EuVat, - GbVat, - GeVat, - HkBr, - HuTin, - IdNpwp, - IlVat, - InGst, - IsVat, - JpCn, - JpRn, - JpTrn, - KePin, - KrBrn, - LiUid, - MxRfc, - MyFrp, - MyItn, - MySst, - NoVat, - NzGst, - PeRuc, - PhTin, - RoTin, - RsPib, - RuInn, - RuKpp, - SaVat, - SgGst, - SgUen, - SiTin, - SvNit, - ThVat, - TrTin, - TwVat, - UaVat, - UsEin, - UyRuc, - VeRif, - VnTin, - ZaVat, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { + De, + En, + Fr, + Nl, } -impl UpcomingLinesInvoiceCustomerDetailsTaxIdsType { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceCustomerDetailsTaxIdsType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match self { - AdNrt => "ad_nrt", - AeTrn => "ae_trn", - ArCuit => "ar_cuit", - AuAbn => "au_abn", - AuArn => "au_arn", - BgUic => "bg_uic", - BoTin => "bo_tin", - BrCnpj => "br_cnpj", - BrCpf => "br_cpf", - CaBn => "ca_bn", - CaGstHst => "ca_gst_hst", - CaPstBc => "ca_pst_bc", - CaPstMb => "ca_pst_mb", - CaPstSk => "ca_pst_sk", - CaQst => "ca_qst", - ChVat => "ch_vat", - ClTin => "cl_tin", - CnTin => "cn_tin", - CoNit => "co_nit", - CrTin => "cr_tin", - DoRcn => "do_rcn", - EcRuc => "ec_ruc", - EgTin => "eg_tin", - EsCif => "es_cif", - EuOssVat => "eu_oss_vat", - EuVat => "eu_vat", - GbVat => "gb_vat", - GeVat => "ge_vat", - HkBr => "hk_br", - HuTin => "hu_tin", - IdNpwp => "id_npwp", - IlVat => "il_vat", - InGst => "in_gst", - IsVat => "is_vat", - JpCn => "jp_cn", - JpRn => "jp_rn", - JpTrn => "jp_trn", - KePin => "ke_pin", - KrBrn => "kr_brn", - LiUid => "li_uid", - MxRfc => "mx_rfc", - MyFrp => "my_frp", - MyItn => "my_itn", - MySst => "my_sst", - NoVat => "no_vat", - NzGst => "nz_gst", - PeRuc => "pe_ruc", - PhTin => "ph_tin", - RoTin => "ro_tin", - RsPib => "rs_pib", - RuInn => "ru_inn", - RuKpp => "ru_kpp", - SaVat => "sa_vat", - SgGst => "sg_gst", - SgUen => "sg_uen", - SiTin => "si_tin", - SvNit => "sv_nit", - ThVat => "th_vat", - TrTin => "tr_tin", - TwVat => "tw_vat", - UaVat => "ua_vat", - UsEin => "us_ein", - UyRuc => "uy_ruc", - VeRif => "ve_rif", - VnTin => "vn_tin", - ZaVat => "za_vat", - Unknown => "unknown", + De => "de", + En => "en", + Fr => "fr", + Nl => "nl", } } } -impl std::str::FromStr for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceCustomerDetailsTaxIdsType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match s { - "ad_nrt" => Ok(AdNrt), - "ae_trn" => Ok(AeTrn), - "ar_cuit" => Ok(ArCuit), - "au_abn" => Ok(AuAbn), - "au_arn" => Ok(AuArn), - "bg_uic" => Ok(BgUic), - "bo_tin" => Ok(BoTin), - "br_cnpj" => Ok(BrCnpj), - "br_cpf" => Ok(BrCpf), - "ca_bn" => Ok(CaBn), - "ca_gst_hst" => Ok(CaGstHst), - "ca_pst_bc" => Ok(CaPstBc), - "ca_pst_mb" => Ok(CaPstMb), - "ca_pst_sk" => Ok(CaPstSk), - "ca_qst" => Ok(CaQst), - "ch_vat" => Ok(ChVat), - "cl_tin" => Ok(ClTin), - "cn_tin" => Ok(CnTin), - "co_nit" => Ok(CoNit), - "cr_tin" => Ok(CrTin), - "do_rcn" => Ok(DoRcn), - "ec_ruc" => Ok(EcRuc), - "eg_tin" => Ok(EgTin), - "es_cif" => Ok(EsCif), - "eu_oss_vat" => Ok(EuOssVat), - "eu_vat" => Ok(EuVat), - "gb_vat" => Ok(GbVat), - "ge_vat" => Ok(GeVat), - "hk_br" => Ok(HkBr), - "hu_tin" => Ok(HuTin), - "id_npwp" => Ok(IdNpwp), - "il_vat" => Ok(IlVat), - "in_gst" => Ok(InGst), - "is_vat" => Ok(IsVat), - "jp_cn" => Ok(JpCn), - "jp_rn" => Ok(JpRn), - "jp_trn" => Ok(JpTrn), - "ke_pin" => Ok(KePin), - "kr_brn" => Ok(KrBrn), - "li_uid" => Ok(LiUid), - "mx_rfc" => Ok(MxRfc), - "my_frp" => Ok(MyFrp), - "my_itn" => Ok(MyItn), - "my_sst" => Ok(MySst), - "no_vat" => Ok(NoVat), - "nz_gst" => Ok(NzGst), - "pe_ruc" => Ok(PeRuc), - "ph_tin" => Ok(PhTin), - "ro_tin" => Ok(RoTin), - "rs_pib" => Ok(RsPib), - "ru_inn" => Ok(RuInn), - "ru_kpp" => Ok(RuKpp), - "sa_vat" => Ok(SaVat), - "sg_gst" => Ok(SgGst), - "sg_uen" => Ok(SgUen), - "si_tin" => Ok(SiTin), - "sv_nit" => Ok(SvNit), - "th_vat" => Ok(ThVat), - "tr_tin" => Ok(TrTin), - "tw_vat" => Ok(TwVat), - "ua_vat" => Ok(UaVat), - "us_ein" => Ok(UsEin), - "uy_ruc" => Ok(UyRuc), - "ve_rif" => Ok(VeRif), - "vn_tin" => Ok(VnTin), - "za_vat" => Ok(ZaVat), + "de" => Ok(De), + "en" => Ok(En), + "fr" => Ok(Fr), + "nl" => Ok(Nl), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1790,152 +1589,112 @@ impl serde::Serialize for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { serializer.serialize_str(self.as_str()) } } -/// List of invoice items to add or update in the upcoming invoice preview. +/// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceInvoiceItems<'a> { - /// The integer amount in cents (or local equivalent) of previewed invoice item. +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCard { + /// Installment configuration for payments attempted on this invoice (Mexico Only). + /// + /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - /// Only applicable to new invoice items. + pub installments: + Option, + /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). + /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. + /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, - /// An arbitrary string which you can attach to the invoice item. - /// The description is displayed in the invoice for easy tracking. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// Explicitly controls whether discounts apply to this invoice item. - /// Defaults to true, except for negative invoice items. - #[serde(skip_serializing_if = "Option::is_none")] - pub discountable: Option, - /// The coupons to redeem into discounts for the invoice item in the preview. - #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [DiscountsDataParam<'a>]>, - /// The ID of the invoice item to update in preview. - /// If not specified, a new invoice item will be added to the preview of the upcoming invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoiceitem: Option<&'a str>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The period associated with this invoice item. - /// When set to different values, the period will be rendered on the invoice. - /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. - /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. - #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, - /// The ID of the price object. - #[serde(skip_serializing_if = "Option::is_none")] - pub price: Option<&'a str>, - /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. - #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, - /// Non-negative integer. The quantity of units for the invoice item. - #[serde(skip_serializing_if = "Option::is_none")] - pub quantity: Option, - /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. - /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. - /// One of `inclusive`, `exclusive`, or `unspecified`. - /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, - /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_code: Option<&'a str>, - /// The tax rates that apply to the item. When set, any `default_tax_rates` do not apply to this item. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_rates: Option<&'a [&'a str]>, - /// The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. - /// This unit_amount will be multiplied by the quantity to get the full amount. - /// If you want to apply a credit to the customer's account, pass a negative unit_amount. + pub request_three_d_secure: + Option, +} +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCard { + pub fn new() -> Self { + Self::default() + } +} +/// Installment configuration for payments attempted on this invoice (Mexico Only). +/// +/// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallments { + /// Setting to true enables installments for this invoice. + /// Setting to false will prevent any selected plan from applying to a payment. #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount: Option, - /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. - /// Only one of `unit_amount` and `unit_amount_decimal` can be set. + pub enabled: Option, + /// The selected installment plan to use for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount_decimal: Option<&'a str>, + pub plan: Option, } -impl<'a> UpcomingLinesInvoiceInvoiceItems<'a> { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } } -/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. +/// The selected installment plan to use for this invoice. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceInvoiceItemsPriceData<'a> { - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// The ID of the product that this price will belong to. - pub product: &'a str, - /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. - /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. - /// One of `inclusive`, `exclusive`, or `unspecified`. - /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, - /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount: Option, - /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. - /// Only one of `unit_amount` and `unit_amount_decimal` can be set. - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount_decimal: Option<&'a str>, +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { + /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + pub count: u64, + /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + /// One of `month`. + pub interval: + UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, + /// Type of installment plan, one of `fixed_count`. + #[serde(rename = "type")] + pub type_: UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, } -impl<'a> UpcomingLinesInvoiceInvoiceItemsPriceData<'a> { - pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { - Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { + pub fn new( + count: u64, + interval: UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, + type_: UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, + ) -> Self { + Self { count, interval, type_ } } } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. +/// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. +/// One of `month`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { + Month, } -impl UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", + Month => "month", } } } -impl std::str::FromStr for UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), + "month" => Ok(Month), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1943,51 +1702,50 @@ impl serde::Serialize for UpcomingLinesInvoiceInvoiceItemsPriceDataTaxBehavior { serializer.serialize_str(self.as_str()) } } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. +/// Type of installment plan, one of `fixed_count`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceInvoiceItemsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { + FixedCount, } -impl UpcomingLinesInvoiceInvoiceItemsTaxBehavior { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceInvoiceItemsTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", + FixedCount => "fixed_count", } } } -impl std::str::FromStr for UpcomingLinesInvoiceInvoiceItemsTaxBehavior { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceInvoiceItemsTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), + "fixed_count" => Ok(FixedCount), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceInvoiceItemsTaxBehavior { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceInvoiceItemsTaxBehavior { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceInvoiceItemsTaxBehavior { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1995,61 +1753,55 @@ impl serde::Serialize for UpcomingLinesInvoiceInvoiceItemsTaxBehavior { serializer.serialize_str(self.as_str()) } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpcomingLinesInvoiceIssuerType, -} -impl<'a> UpcomingLinesInvoiceIssuer<'a> { - pub fn new(type_: UpcomingLinesInvoiceIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. +/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). +/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. +/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceIssuerType { - Account, - Self_, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + Any, + Automatic, } -impl UpcomingLinesInvoiceIssuerType { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceIssuerType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match self { - Account => "account", - Self_ => "self", + Any => "any", + Automatic => "automatic", } } } -impl std::str::FromStr for UpcomingLinesInvoiceIssuerType { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceIssuerType::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match s { - "account" => Ok(Account), - "self" => Ok(Self_), + "any" => Ok(Any), + "automatic" => Ok(Automatic), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceIssuerType { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceIssuerType { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceIssuerType { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2057,216 +1809,195 @@ impl serde::Serialize for UpcomingLinesInvoiceIssuerType { serializer.serialize_str(self.as_str()) } } -/// For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). -/// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. -/// For existing subscriptions, the value can only be set to `now` or `unchanged`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -#[serde(untagged)] -pub enum UpcomingLinesInvoiceSubscriptionBillingCycleAnchor { - Now, - Unchanged, - Timestamp(stripe_types::Timestamp), -} -/// A list of up to 20 subscription items, each with an attached price. +/// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceSubscriptionItems<'a> { - /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. - /// When updating, pass an empty string to remove previously-defined thresholds. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, - /// Delete all usage for a given subscription item. - /// Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. - #[serde(skip_serializing_if = "Option::is_none")] - pub clear_usage: Option, - /// A flag that, if set to `true`, will delete the specified item. - #[serde(skip_serializing_if = "Option::is_none")] - pub deleted: Option, - /// Subscription item to update. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option<&'a str>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// Plan ID for this item, as a string. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option<&'a str>, - /// The ID of the price object. - /// When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub price: Option<&'a str>, - /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. - #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, - /// Quantity for this item. +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { + /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub quantity: Option, - /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. - /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. - /// When updating, pass an empty string to remove previously-defined tax rates. + pub financial_connections: Option< + UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections< + 'a, + >, + >, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub tax_rates: Option<&'a [&'a str]>, + pub verification_method: Option< + UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod, + >, } -impl<'a> UpcomingLinesInvoiceSubscriptionItems<'a> { +impl<'a> UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } -/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceSubscriptionItemsPriceData<'a> { - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// The ID of the product that this price will belong to. - pub product: &'a str, - /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurring, - /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. - /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. - /// One of `inclusive`, `exclusive`, or `unspecified`. - /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, - /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount: Option, - /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. - /// Only one of `unit_amount` and `unit_amount_decimal` can be set. - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_amount_decimal: Option<&'a str>, +/// Additional fields for Financial Connections Session creation +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. + /// If this parameter is passed, the `payment_method` permission must be included. + /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, + /// List of data features that you would like to retrieve upon account creation. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + } -impl<'a> UpcomingLinesInvoiceSubscriptionItemsPriceData<'a> { - pub fn new( - currency: stripe_types::Currency, - product: &'a str, - recurring: UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurring, - ) -> Self { - Self { - currency, - product, - recurring, - tax_behavior: None, - unit_amount: None, - unit_amount_decimal: None, +impl<'a> + UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> +{ + pub fn new() -> Self { + Self::default() + } +} +/// The list of permissions to request. +/// If this parameter is passed, the `payment_method` permission must be included. +/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ + Balances, + Ownership, + PaymentMethod, + Transactions, +} +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + pub fn as_str(self) -> &'static str { + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + match self { +Balances => "balances", +Ownership => "ownership", +PaymentMethod => "payment_method", +Transactions => "transactions", + } } } -/// The recurring components of a price such as `interval` and `interval_count`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurring { - /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval, - /// The number of intervals between subscription billings. - /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). - #[serde(skip_serializing_if = "Option::is_none")] - pub interval_count: Option, + +impl std::str::FromStr for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + match s { + "balances" => Ok(Balances), +"ownership" => Ok(Ownership), +"payment_method" => Ok(PaymentMethod), +"transactions" => Ok(Transactions), +_ => Err(()) + + } + } } -impl UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurring { - pub fn new(interval: UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval) -> Self { - Self { interval, interval_count: None } +impl std::fmt::Display for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// Specifies billing frequency. Either `day`, `week`, `month` or `year`. + +impl std::fmt::Debug for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { + serializer.serialize_str(self.as_str()) + } +} +/// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { - Day, - Month, - Week, - Year, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +{ + Balances, } -impl UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl + UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +{ pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { - Day => "day", - Month => "month", - Week => "week", - Year => "year", + Balances => "balances", } } } -impl std::str::FromStr for UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::str::FromStr for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { - "day" => Ok(Day), - "month" => Ok(Month), - "week" => Ok(Week), - "year" => Ok(Year), - _ => Err(()), + "balances" => Ok(Balances), +_ => Err(()) + } } } -impl std::fmt::Display for UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Display for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Debug for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceSubscriptionItemsPriceDataRecurringInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { + Automatic, + Instant, + Microdeposits, } -impl UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", + Automatic => "automatic", + Instant => "instant", + Microdeposits => "microdeposits", } } } -impl std::str::FromStr for UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::str::FromStr + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), + "automatic" => Ok(Automatic), + "instant" => Ok(Instant), + "microdeposits" => Ok(Microdeposits), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Display + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Debug + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehavior { +impl serde::Serialize + for UpdateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2274,49 +2005,117 @@ impl serde::Serialize for UpcomingLinesInvoiceSubscriptionItemsPriceDataTaxBehav serializer.serialize_str(self.as_str()) } } -/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. -/// The default value is `create_prorations`. +/// The list of payment method types (e.g. +/// card) to provide to the invoice’s PaymentIntent. +/// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceSubscriptionProrationBehavior { - AlwaysInvoice, - CreateProrations, - None, +#[non_exhaustive] +pub enum UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { + AchCreditTransfer, + AchDebit, + AcssDebit, + AuBecsDebit, + BacsDebit, + Bancontact, + Boleto, + Card, + Cashapp, + CustomerBalance, + Fpx, + Giropay, + Grabpay, + Ideal, + Konbini, + Link, + Paynow, + Paypal, + Promptpay, + SepaCreditTransfer, + SepaDebit, + Sofort, + UsBankAccount, + WechatPay, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, } -impl UpcomingLinesInvoiceSubscriptionProrationBehavior { +impl UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceSubscriptionProrationBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes::*; match self { - AlwaysInvoice => "always_invoice", - CreateProrations => "create_prorations", - None => "none", + AchCreditTransfer => "ach_credit_transfer", + AchDebit => "ach_debit", + AcssDebit => "acss_debit", + AuBecsDebit => "au_becs_debit", + BacsDebit => "bacs_debit", + Bancontact => "bancontact", + Boleto => "boleto", + Card => "card", + Cashapp => "cashapp", + CustomerBalance => "customer_balance", + Fpx => "fpx", + Giropay => "giropay", + Grabpay => "grabpay", + Ideal => "ideal", + Konbini => "konbini", + Link => "link", + Paynow => "paynow", + Paypal => "paypal", + Promptpay => "promptpay", + SepaCreditTransfer => "sepa_credit_transfer", + SepaDebit => "sepa_debit", + Sofort => "sofort", + UsBankAccount => "us_bank_account", + WechatPay => "wechat_pay", + Unknown => "unknown", } } } -impl std::str::FromStr for UpcomingLinesInvoiceSubscriptionProrationBehavior { +impl std::str::FromStr for UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceSubscriptionProrationBehavior::*; + use UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes::*; match s { - "always_invoice" => Ok(AlwaysInvoice), - "create_prorations" => Ok(CreateProrations), - "none" => Ok(None), + "ach_credit_transfer" => Ok(AchCreditTransfer), + "ach_debit" => Ok(AchDebit), + "acss_debit" => Ok(AcssDebit), + "au_becs_debit" => Ok(AuBecsDebit), + "bacs_debit" => Ok(BacsDebit), + "bancontact" => Ok(Bancontact), + "boleto" => Ok(Boleto), + "card" => Ok(Card), + "cashapp" => Ok(Cashapp), + "customer_balance" => Ok(CustomerBalance), + "fpx" => Ok(Fpx), + "giropay" => Ok(Giropay), + "grabpay" => Ok(Grabpay), + "ideal" => Ok(Ideal), + "konbini" => Ok(Konbini), + "link" => Ok(Link), + "paynow" => Ok(Paynow), + "paypal" => Ok(Paypal), + "promptpay" => Ok(Promptpay), + "sepa_credit_transfer" => Ok(SepaCreditTransfer), + "sepa_debit" => Ok(SepaDebit), + "sofort" => Ok(Sofort), + "us_bank_account" => Ok(UsBankAccount), + "wechat_pay" => Ok(WechatPay), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceSubscriptionProrationBehavior { +impl std::fmt::Display for UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceSubscriptionProrationBehavior { +impl std::fmt::Debug for UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceSubscriptionProrationBehavior { +impl serde::Serialize for UpdateInvoiceBuilderPaymentSettingsPaymentMethodTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2324,42 +2123,66 @@ impl serde::Serialize for UpcomingLinesInvoiceSubscriptionProrationBehavior { serializer.serialize_str(self.as_str()) } } -/// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. +/// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderRendering { + /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + /// One of `exclude_tax` or `include_inclusive_tax`. + /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. + /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_tax_display: Option, + /// Invoice pdf rendering options + #[serde(skip_serializing_if = "Option::is_none")] + pub pdf: Option, +} +impl UpdateInvoiceBuilderRendering { + pub fn new() -> Self { + Self::default() + } +} +/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. +/// One of `exclude_tax` or `include_inclusive_tax`. +/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. +/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpcomingLinesInvoiceSubscriptionResumeAt { - Now, +pub enum UpdateInvoiceBuilderRenderingAmountTaxDisplay { + ExcludeTax, + IncludeInclusiveTax, } -impl UpcomingLinesInvoiceSubscriptionResumeAt { +impl UpdateInvoiceBuilderRenderingAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use UpcomingLinesInvoiceSubscriptionResumeAt::*; + use UpdateInvoiceBuilderRenderingAmountTaxDisplay::*; match self { - Now => "now", + ExcludeTax => "exclude_tax", + IncludeInclusiveTax => "include_inclusive_tax", } } } -impl std::str::FromStr for UpcomingLinesInvoiceSubscriptionResumeAt { +impl std::str::FromStr for UpdateInvoiceBuilderRenderingAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use UpcomingLinesInvoiceSubscriptionResumeAt::*; + use UpdateInvoiceBuilderRenderingAmountTaxDisplay::*; match s { - "now" => Ok(Now), + "exclude_tax" => Ok(ExcludeTax), + "include_inclusive_tax" => Ok(IncludeInclusiveTax), _ => Err(()), } } } -impl std::fmt::Display for UpcomingLinesInvoiceSubscriptionResumeAt { +impl std::fmt::Display for UpdateInvoiceBuilderRenderingAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpcomingLinesInvoiceSubscriptionResumeAt { +impl std::fmt::Debug for UpdateInvoiceBuilderRenderingAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpcomingLinesInvoiceSubscriptionResumeAt { +impl serde::Serialize for UpdateInvoiceBuilderRenderingAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2367,240 +2190,64 @@ impl serde::Serialize for UpcomingLinesInvoiceSubscriptionResumeAt { serializer.serialize_str(self.as_str()) } } -/// If provided, the invoice returned will preview updating or creating a subscription with that trial end. -/// If set, one of `subscription_items` or `subscription` is required. -#[derive(Copy, Clone, Debug, serde::Serialize)] -#[serde(untagged)] -pub enum UpcomingLinesInvoiceSubscriptionTrialEnd { - Now, - Timestamp(stripe_types::Timestamp), +/// Invoice pdf rendering options +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceBuilderRenderingPdf { + /// Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`. + /// If set to `auto`, invoice PDF page size defaults to `a4` for customers with + /// Japanese locale and `letter` for customers with other locales. + #[serde(skip_serializing_if = "Option::is_none")] + pub page_size: Option, } -impl<'a> UpcomingLinesInvoice<'a> { - /// When retrieving an upcoming invoice, you’ll get a **lines** property containing the total count of line items and the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/invoices/upcoming/lines", self) +impl UpdateInvoiceBuilderRenderingPdf { + pub fn new() -> Self { + Self::default() } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/invoices/upcoming/lines", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoice<'a> { - /// The account tax IDs associated with the invoice. Only editable when the invoice is a draft. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// A fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account. - /// The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. - /// For more information, see the application fees [documentation](https://stripe.com/docs/billing/invoices/connect#collecting-fees). - #[serde(skip_serializing_if = "Option::is_none")] - pub application_fee_amount: Option, - /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. - /// If `false`, the invoice's state doesn't automatically advance without an explicit action. - #[serde(skip_serializing_if = "Option::is_none")] - pub auto_advance: Option, - /// Settings for automatic tax lookup for this invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, - /// Either `charge_automatically`, or `send_invoice`. - /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. - /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. - /// Defaults to `charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, - /// The currency to create this invoice in. Defaults to that of `customer` if not specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, - /// A list of up to 4 custom fields to be displayed on the invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, - /// The ID of the customer who will be billed. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// The number of days from when the invoice is created until it is due. - /// Valid only for invoices where `collection_method=send_invoice`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// ID of the default payment method for the invoice. - /// It must belong to the customer associated with the invoice. - /// If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_payment_method: Option<&'a str>, - /// ID of the default payment source for the invoice. - /// It must belong to the customer associated with the invoice and be in a chargeable state. - /// If not set, defaults to the subscription's default source, if any, or to the customer's default source. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_source: Option<&'a str>, - /// The tax rates that will apply to any line item that does not have `tax_rates` set. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_tax_rates: Option<&'a [&'a str]>, - /// An arbitrary string attached to the object. - /// Often useful for displaying to users. - /// Referenced as 'memo' in the Dashboard. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// The coupons to redeem into discounts for the invoice. - /// If not specified, inherits the discount from the invoice's customer. - /// Pass an empty string to avoid inheriting any discounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [CreateInvoiceDiscounts<'a>]>, - /// The date on which payment for this invoice is due. - /// Valid only for invoices where `collection_method=send_invoice`. - #[serde(skip_serializing_if = "Option::is_none")] - pub due_date: Option, - /// The date when this invoice is in effect. - /// Same as `finalized_at` unless overwritten. - /// When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. - #[serde(skip_serializing_if = "Option::is_none")] - pub effective_at: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Footer to be displayed on the invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub footer: Option<&'a str>, - /// Revise an existing invoice. - /// The new invoice will be created in `status=draft`. - /// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. - #[serde(skip_serializing_if = "Option::is_none")] - pub from_invoice: Option>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The account (if any) for which the funds of the invoice payment are intended. - /// If set, the invoice will be presented with the branding and support information of the specified account. - /// See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details. - #[serde(skip_serializing_if = "Option::is_none")] - pub on_behalf_of: Option<&'a str>, - /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_settings: Option>, - /// How to handle pending invoice items on invoice creation. - /// One of `include` or `exclude`. - /// `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. - /// `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. - /// Defaults to `exclude` if the parameter is omitted. - #[serde(skip_serializing_if = "Option::is_none")] - pub pending_invoice_items_behavior: Option, - /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. - #[serde(skip_serializing_if = "Option::is_none")] - pub rendering: Option, - /// This is a legacy field that will be removed soon. - /// For details about `rendering_options`, refer to `rendering` instead. - /// Options for invoice PDF rendering. - #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, - /// Settings for the cost of shipping for this invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, - /// Shipping details for the invoice. - /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_details: Option>, - /// Extra information about a charge for the customer's credit card statement. - /// It must contain at least one letter. - /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, - /// The ID of the subscription to invoice, if any. - /// If set, the created invoice will only include pending invoice items for that subscription. - /// The subscription's billing cycle and regular subscription events won't be affected. - #[serde(skip_serializing_if = "Option::is_none")] - pub subscription: Option<&'a str>, - /// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, -} -impl<'a> CreateInvoice<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings for automatic tax lookup for this invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceAutomaticTax<'a> { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> CreateInvoiceAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateInvoiceAutomaticTaxLiabilityType, -} -impl<'a> CreateInvoiceAutomaticTaxLiability<'a> { - pub fn new(type_: CreateInvoiceAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateInvoiceAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateInvoiceAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } +} +/// Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`. +/// If set to `auto`, invoice PDF page size defaults to `a4` for customers with +/// Japanese locale and `letter` for customers with other locales. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateInvoiceBuilderRenderingPdfPageSize { + A4, + Auto, + Letter, +} +impl UpdateInvoiceBuilderRenderingPdfPageSize { + pub fn as_str(self) -> &'static str { + use UpdateInvoiceBuilderRenderingPdfPageSize::*; + match self { + A4 => "a4", + Auto => "auto", + Letter => "letter", + } } } -impl std::str::FromStr for CreateInvoiceAutomaticTaxLiabilityType { +impl std::str::FromStr for UpdateInvoiceBuilderRenderingPdfPageSize { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceAutomaticTaxLiabilityType::*; + use UpdateInvoiceBuilderRenderingPdfPageSize::*; match s { - "account" => Ok(Account), - "self" => Ok(Self_), + "a4" => Ok(A4), + "auto" => Ok(Auto), + "letter" => Ok(Letter), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceAutomaticTaxLiabilityType { +impl std::fmt::Display for UpdateInvoiceBuilderRenderingPdfPageSize { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceAutomaticTaxLiabilityType { +impl std::fmt::Debug for UpdateInvoiceBuilderRenderingPdfPageSize { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceAutomaticTaxLiabilityType { +impl serde::Serialize for UpdateInvoiceBuilderRenderingPdfPageSize { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2608,138 +2255,65 @@ impl serde::Serialize for CreateInvoiceAutomaticTaxLiabilityType { serializer.serialize_str(self.as_str()) } } -/// The coupons to redeem into discounts for the invoice. -/// If not specified, inherits the discount from the invoice's customer. -/// Pass an empty string to avoid inheriting any discounts. +/// This is a legacy field that will be removed soon. +/// For details about `rendering_options`, refer to `rendering` instead. +/// Options for invoice PDF rendering. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. +pub struct UpdateInvoiceBuilderRenderingOptions { + /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + /// One of `exclude_tax` or `include_inclusive_tax`. + /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. + /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, + pub amount_tax_display: Option, } -impl<'a> CreateInvoiceDiscounts<'a> { +impl UpdateInvoiceBuilderRenderingOptions { pub fn new() -> Self { Self::default() } } -/// Revise an existing invoice. -/// The new invoice will be created in `status=draft`. -/// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceFromInvoice<'a> { - /// The relation between the new invoice and the original invoice. - /// Currently, only 'revision' is permitted. - pub action: CreateInvoiceFromInvoiceAction, - /// The `id` of the invoice that will be cloned. - pub invoice: &'a str, -} -impl<'a> CreateInvoiceFromInvoice<'a> { - pub fn new(action: CreateInvoiceFromInvoiceAction, invoice: &'a str) -> Self { - Self { action, invoice } - } -} -/// The relation between the new invoice and the original invoice. -/// Currently, only 'revision' is permitted. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceFromInvoiceAction { - Revision, -} -impl CreateInvoiceFromInvoiceAction { - pub fn as_str(self) -> &'static str { - use CreateInvoiceFromInvoiceAction::*; - match self { - Revision => "revision", - } - } -} - -impl std::str::FromStr for CreateInvoiceFromInvoiceAction { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoiceFromInvoiceAction::*; - match s { - "revision" => Ok(Revision), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateInvoiceFromInvoiceAction { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateInvoiceFromInvoiceAction { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateInvoiceFromInvoiceAction { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateInvoiceIssuerType, -} -impl<'a> CreateInvoiceIssuer<'a> { - pub fn new(type_: CreateInvoiceIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. +/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. +/// One of `exclude_tax` or `include_inclusive_tax`. +/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. +/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceIssuerType { - Account, - Self_, +pub enum UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { + ExcludeTax, + IncludeInclusiveTax, } -impl CreateInvoiceIssuerType { +impl UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use CreateInvoiceIssuerType::*; + use UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay::*; match self { - Account => "account", - Self_ => "self", + ExcludeTax => "exclude_tax", + IncludeInclusiveTax => "include_inclusive_tax", } } } -impl std::str::FromStr for CreateInvoiceIssuerType { +impl std::str::FromStr for UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceIssuerType::*; + use UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay::*; match s { - "account" => Ok(Account), - "self" => Ok(Self_), + "exclude_tax" => Ok(ExcludeTax), + "include_inclusive_tax" => Ok(IncludeInclusiveTax), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceIssuerType { +impl std::fmt::Display for UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceIssuerType { +impl std::fmt::Debug for UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceIssuerType { +impl serde::Serialize for UpdateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2747,116 +2321,138 @@ impl serde::Serialize for CreateInvoiceIssuerType { serializer.serialize_str(self.as_str()) } } -/// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. +/// Settings for the cost of shipping for this invoice. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettings<'a> { - /// ID of the mandate to be used for this invoice. - /// It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_mandate: Option<&'a str>, - /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. +pub struct UpdateInvoiceBuilderShippingCost<'a> { + /// The ID of the shipping rate to use for this order. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, - /// The list of payment method types (e.g. - /// card) to provide to the invoice’s PaymentIntent. - /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + pub shipping_rate: Option<&'a str>, + /// Parameters to create a new ad-hoc shipping rate for this order. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [CreateInvoicePaymentSettingsPaymentMethodTypes]>, + pub shipping_rate_data: Option>, } -impl<'a> CreateInvoicePaymentSettings<'a> { +impl<'a> UpdateInvoiceBuilderShippingCost<'a> { pub fn new() -> Self { Self::default() } } -/// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptions<'a> { - /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, - /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. +/// Parameters to create a new ad-hoc shipping rate for this order. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceBuilderShippingCostShippingRateData<'a> { + /// The estimated range for how long shipping will take, meant to be displayable to the customer. + /// This will appear on CheckoutSessions. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, - /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. + pub delivery_estimate: Option, + /// The name of the shipping rate, meant to be displayable to the customer. + /// This will appear on CheckoutSessions. + pub display_name: &'a str, + /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, - /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. + pub fixed_amount: Option>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option>, - /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. + pub metadata: Option<&'a std::collections::HashMap>, + /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. + /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option<&'a serde_json::Value>, - /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. + pub tax_behavior: Option, + /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. + /// The Shipping tax code is `txcd_92010001`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option<&'a str>, + /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. + #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub type_: Option, } -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptions<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> UpdateInvoiceBuilderShippingCostShippingRateData<'a> { + pub fn new(display_name: &'a str) -> Self { + Self { + delivery_estimate: None, + display_name, + fixed_amount: None, + metadata: None, + tax_behavior: None, + tax_code: None, + type_: None, + } } } -/// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. +/// The estimated range for how long shipping will take, meant to be displayable to the customer. +/// This will appear on CheckoutSessions. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit { - /// Additional fields for Mandate creation +pub struct UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimate { + /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: - Option, - /// Verification method for the intent + pub maximum: Option, + /// The lower bound of the estimated range. If empty, represents no lower bound. #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, + pub minimum: Option, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit { +impl UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimate { pub fn new() -> Self { Self::default() } } -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { - /// Transaction type of the mandate. - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: Option< - CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, - >, +/// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximum { + /// A unit of time. + pub unit: UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit, + /// Must be greater than 0. + pub value: i64, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { - pub fn new() -> Self { - Self::default() +impl UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximum { + pub fn new( + unit: UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit, + value: i64, + ) -> Self { + Self { unit, value } } } -/// Transaction type of the mandate. +/// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { - Business, - Personal, +pub enum UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { + BusinessDay, + Day, + Hour, + Month, + Week, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; match self { - Business => "business", - Personal => "personal", + BusinessDay => "business_day", + Day => "day", + Hour => "hour", + Month => "month", + Week => "week", } } } impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; match s { - "business" => Ok(Business), - "personal" => Ok(Personal), + "business_day" => Ok(BusinessDay), + "day" => Ok(Day), + "hour" => Ok(Hour), + "month" => Ok(Month), + "week" => Ok(Week), _ => Err(()), } } } impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2864,14 +2460,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { fn serialize(&self, serializer: S) -> Result where @@ -2880,40 +2476,62 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Verification method for the intent +/// The lower bound of the estimated range. If empty, represents no lower bound. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimum { + /// A unit of time. + pub unit: UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit, + /// Must be greater than 0. + pub value: i64, +} +impl UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimum { + pub fn new( + unit: UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit, + value: i64, + ) -> Self { + Self { unit, value } + } +} +/// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { - Automatic, - Instant, - Microdeposits, +pub enum UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { + BusinessDay, + Day, + Hour, + Month, + Week, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +impl UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; match self { - Automatic => "automatic", - Instant => "instant", - Microdeposits => "microdeposits", + BusinessDay => "business_day", + Day => "day", + Hour => "hour", + Month => "month", + Week => "week", } } } impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; match s { - "automatic" => Ok(Automatic), - "instant" => Ok(Instant), - "microdeposits" => Ok(Microdeposits), + "business_day" => Ok(BusinessDay), + "day" => Ok(Day), + "hour" => Ok(Hour), + "month" => Ok(Month), + "week" => Ok(Week), _ => Err(()), } } } impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2921,14 +2539,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { fn serialize(&self, serializer: S) -> Result where @@ -2937,56 +2555,82 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsBancontact { - /// Preferred language of the Bancontact authorization page that the customer is redirected to. +/// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmount<'a> { + /// A non-negative integer in cents representing how much to charge. + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// Shipping rates defined in each available currency option. + /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: - Option, + pub currency_options: Option< + &'a std::collections::HashMap< + stripe_types::Currency, + UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions, + >, + >, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsBancontact { - pub fn new() -> Self { - Self::default() +impl<'a> UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmount<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { amount, currency, currency_options: None } } } -/// Preferred language of the Bancontact authorization page that the customer is redirected to. +/// Shipping rates defined in each available currency option. +/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions { + /// A non-negative integer in cents representing how much to charge. + pub amount: i64, + /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. + /// One of `inclusive`, `exclusive`, or `unspecified`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option< + UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior, + >, +} +impl UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions { + pub fn new(amount: i64) -> Self { + Self { amount, tax_behavior: None } + } +} +/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { - De, - En, - Fr, - Nl, +pub enum UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { + Exclusive, + Inclusive, + Unspecified, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +impl UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; match self { - De => "de", - En => "en", - Fr => "fr", - Nl => "nl", + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", } } } impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; match s { - "de" => Ok(De), - "en" => Ok(En), - "fr" => Ok(Fr), - "nl" => Ok(Nl), + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), _ => Err(()), } } } impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2994,14 +2638,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { fn serialize(&self, serializer: S) -> Result where @@ -3010,110 +2654,49 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCard { - /// Installment configuration for payments attempted on this invoice (Mexico Only). - /// - /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). - #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, - /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). - /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_three_d_secure: - Option, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCard { - pub fn new() -> Self { - Self::default() - } -} -/// Installment configuration for payments attempted on this invoice (Mexico Only). -/// -/// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments { - /// Setting to true enables installments for this invoice. - /// Setting to false will prevent any selected plan from applying to a payment. - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled: Option, - /// The selected installment plan to use for this invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments { - pub fn new() -> Self { - Self::default() - } -} -/// The selected installment plan to use for this invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { - /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. - pub count: u64, - /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. - /// One of `month`. - pub interval: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, - /// Type of installment plan, one of `fixed_count`. - #[serde(rename = "type")] - pub type_: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { - pub fn new( - count: u64, - interval: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, - type_: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, - ) -> Self { - Self { count, interval, type_ } - } -} -/// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. -/// One of `month`. +/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { - Month, +pub enum UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { +impl UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior::*; match self { - Month => "month", + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", } } } -impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval -{ +impl std::str::FromStr for UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior::*; match s { - "month" => Ok(Month), + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), _ => Err(()), } } } -impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval -{ +impl std::fmt::Display for UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval -{ +impl std::fmt::Debug for UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval -{ +impl serde::Serialize for UpdateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3121,46 +2704,42 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Type of installment plan, one of `fixed_count`. +/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { - FixedCount, +pub enum UpdateInvoiceBuilderShippingCostShippingRateDataType { + FixedAmount, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl UpdateInvoiceBuilderShippingCostShippingRateDataType { pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataType::*; match self { - FixedCount => "fixed_count", + FixedAmount => "fixed_amount", } } } -impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType -{ +impl std::str::FromStr for UpdateInvoiceBuilderShippingCostShippingRateDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; + use UpdateInvoiceBuilderShippingCostShippingRateDataType::*; match s { - "fixed_count" => Ok(FixedCount), + "fixed_amount" => Ok(FixedAmount), _ => Err(()), } } } -impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType -{ +impl std::fmt::Display for UpdateInvoiceBuilderShippingCostShippingRateDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Debug for UpdateInvoiceBuilderShippingCostShippingRateDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl serde::Serialize for UpdateInvoiceBuilderShippingCostShippingRateDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3168,437 +2747,477 @@ impl serde::Serialize for CreateInvoicePaymentSettingsPaymentMethodOptionsCardIn serializer.serialize_str(self.as_str()) } } -/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). -/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - Any, - Automatic, - Challenge, +/// Draft invoices are fully editable. +/// Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),. +/// monetary values, as well as `collection_method`, become uneditable. +/// +/// If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,. +/// sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass. +/// `auto_advance=false`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateInvoice<'a> { + inner: UpdateInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, } -impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; - match self { - Any => "any", - Automatic => "automatic", - Challenge => "challenge", - } +impl<'a> UpdateInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: UpdateInvoiceBuilder::new() } + } + pub fn account_tax_ids(mut self, account_tax_ids: &'a [&'a str]) -> Self { + self.inner.account_tax_ids = Some(account_tax_ids); + self } -} -impl std::str::FromStr for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; - match s { - "any" => Ok(Any), - "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), - _ => Err(()), - } + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self } -} -impl std::fmt::Display for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn auto_advance(mut self, auto_advance: bool) -> Self { + self.inner.auto_advance = Some(auto_advance); + self } -} -impl std::fmt::Debug for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self } -} -impl serde::Serialize for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn collection_method( + mut self, + collection_method: stripe_shared::InvoiceCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self } -} -/// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { - /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: Option< - CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, - >, - /// Verification method for the intent - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, -} -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { - pub fn new() -> Self { - Self::default() + + pub fn custom_fields(mut self, custom_fields: &'a [CustomFieldParams<'a>]) -> Self { + self.inner.custom_fields = Some(custom_fields); + self } -} -/// Additional fields for Financial Connections Session creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. - /// If this parameter is passed, the `payment_method` permission must be included. - /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. -#[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, - /// List of data features that you would like to retrieve upon account creation. -#[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, -} -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - pub fn new() -> Self { - Self::default() + pub fn days_until_due(mut self, days_until_due: u32) -> Self { + self.inner.days_until_due = Some(days_until_due); + self } -} -/// The list of permissions to request. -/// If this parameter is passed, the `payment_method` permission must be included. -/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - Balances, - Ownership, - PaymentMethod, - Transactions, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { - pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; - match self { - Balances => "balances", - Ownership => "ownership", - PaymentMethod => "payment_method", - Transactions => "transactions", - } + + pub fn default_payment_method(mut self, default_payment_method: &'a str) -> Self { + self.inner.default_payment_method = Some(default_payment_method); + self } -} -impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; - match s { - "balances" => Ok(Balances), - "ownership" => Ok(Ownership), - "payment_method" => Ok(PaymentMethod), - "transactions" => Ok(Transactions), - _ => Err(()), - } + pub fn default_source(mut self, default_source: &'a str) -> Self { + self.inner.default_source = Some(default_source); + self } -} -impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self } -} -impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self } -} -impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self } -} -/// List of data features that you would like to retrieve upon account creation. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { - Balances, - Transactions, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { - pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; - match self { - Balances => "balances", - Transactions => "transactions", - } + + pub fn due_date(mut self, due_date: stripe_types::Timestamp) -> Self { + self.inner.due_date = Some(due_date); + self } -} -impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; - match s { - "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } + pub fn effective_at(mut self, effective_at: stripe_types::Timestamp) -> Self { + self.inner.effective_at = Some(effective_at); + self } -} -impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn footer(mut self, footer: &'a str) -> Self { + self.inner.footer = Some(footer); + self } -} -impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self } -} -/// Verification method for the intent -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { - Automatic, - Instant, - Microdeposits, -} -impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { - pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; - match self { - Automatic => "automatic", - Instant => "instant", - Microdeposits => "microdeposits", - } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self } -} -impl std::str::FromStr - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; - match s { - "automatic" => Ok(Automatic), - "instant" => Ok(Instant), - "microdeposits" => Ok(Microdeposits), - _ => Err(()), - } + pub fn payment_settings( + mut self, + payment_settings: UpdateInvoiceBuilderPaymentSettings<'a>, + ) -> Self { + self.inner.payment_settings = Some(payment_settings); + self } -} -impl std::fmt::Display - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn rendering(mut self, rendering: UpdateInvoiceBuilderRendering) -> Self { + self.inner.rendering = Some(rendering); + self + } + + pub fn rendering_options( + mut self, + rendering_options: UpdateInvoiceBuilderRenderingOptions, + ) -> Self { + self.inner.rendering_options = Some(rendering_options); + self + } + + pub fn shipping_cost(mut self, shipping_cost: UpdateInvoiceBuilderShippingCost<'a>) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } + + pub fn shipping_details( + mut self, + shipping_details: RecipientShippingWithOptionalFieldsAddress<'a>, + ) -> Self { + self.inner.shipping_details = Some(shipping_details); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self } } +impl UpdateInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } -impl std::fmt::Debug - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize - for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for UpdateInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}")).form(&self.inner) } } -/// The list of payment method types (e.g. -/// card) to provide to the invoice’s PaymentIntent. -/// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateInvoicePaymentSettingsPaymentMethodTypes { - AchCreditTransfer, - AchDebit, - AcssDebit, - AuBecsDebit, - BacsDebit, - Bancontact, - Boleto, - Card, - Cashapp, - CustomerBalance, - Eps, - Fpx, - Giropay, - Grabpay, - Ideal, - Konbini, - Link, - P24, - Paynow, - Paypal, - Promptpay, - SepaCreditTransfer, - SepaDebit, - Sofort, - UsBankAccount, - WechatPay, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PayInvoiceBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. + /// This effectively forgives the difference between the amount available on the source and the amount due. + /// + /// + /// Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the right amount. + /// An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference. + /// Defaults to `false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub forgive: Option, + /// ID of the mandate to be used for this invoice. + /// It must correspond to the payment method used to pay the invoice, including the payment_method param or the invoice's default_payment_method or default_source, if set. + #[serde(skip_serializing_if = "Option::is_none")] + pub mandate: Option<&'a str>, + /// Indicates if a customer is on or off-session while an invoice payment is attempted. + /// Defaults to `true` (off-session). + #[serde(skip_serializing_if = "Option::is_none")] + pub off_session: Option, + /// Boolean representing whether an invoice is paid outside of Stripe. + /// This will result in no charge being made. + /// Defaults to `false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub paid_out_of_band: Option, + /// A PaymentMethod to be charged. + /// The PaymentMethod must be the ID of a PaymentMethod belonging to the customer associated with the invoice being paid. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method: Option<&'a str>, + /// A payment source to be charged. + /// The source must be the ID of a source belonging to the customer associated with the invoice being paid. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option<&'a str>, } -impl CreateInvoicePaymentSettingsPaymentMethodTypes { - pub fn as_str(self) -> &'static str { - use CreateInvoicePaymentSettingsPaymentMethodTypes::*; - match self { - AchCreditTransfer => "ach_credit_transfer", - AchDebit => "ach_debit", - AcssDebit => "acss_debit", - AuBecsDebit => "au_becs_debit", - BacsDebit => "bacs_debit", - Bancontact => "bancontact", - Boleto => "boleto", - Card => "card", - Cashapp => "cashapp", - CustomerBalance => "customer_balance", - Eps => "eps", - Fpx => "fpx", - Giropay => "giropay", - Grabpay => "grabpay", - Ideal => "ideal", - Konbini => "konbini", - Link => "link", - P24 => "p24", - Paynow => "paynow", - Paypal => "paypal", - Promptpay => "promptpay", - SepaCreditTransfer => "sepa_credit_transfer", - SepaDebit => "sepa_debit", - Sofort => "sofort", - UsBankAccount => "us_bank_account", - WechatPay => "wechat_pay", - Unknown => "unknown", - } +impl<'a> PayInvoiceBuilder<'a> { + pub fn new() -> Self { + Self::default() } } +/// Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). +/// However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PayInvoice<'a> { + inner: PayInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} +impl<'a> PayInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: PayInvoiceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } -impl std::str::FromStr for CreateInvoicePaymentSettingsPaymentMethodTypes { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoicePaymentSettingsPaymentMethodTypes::*; - match s { - "ach_credit_transfer" => Ok(AchCreditTransfer), - "ach_debit" => Ok(AchDebit), - "acss_debit" => Ok(AcssDebit), - "au_becs_debit" => Ok(AuBecsDebit), - "bacs_debit" => Ok(BacsDebit), - "bancontact" => Ok(Bancontact), - "boleto" => Ok(Boleto), - "card" => Ok(Card), - "cashapp" => Ok(Cashapp), - "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), - "fpx" => Ok(Fpx), - "giropay" => Ok(Giropay), - "grabpay" => Ok(Grabpay), - "ideal" => Ok(Ideal), - "konbini" => Ok(Konbini), - "link" => Ok(Link), - "p24" => Ok(P24), - "paynow" => Ok(Paynow), - "paypal" => Ok(Paypal), - "promptpay" => Ok(Promptpay), - "sepa_credit_transfer" => Ok(SepaCreditTransfer), - "sepa_debit" => Ok(SepaDebit), - "sofort" => Ok(Sofort), - "us_bank_account" => Ok(UsBankAccount), - "wechat_pay" => Ok(WechatPay), - _ => Err(()), - } + pub fn forgive(mut self, forgive: bool) -> Self { + self.inner.forgive = Some(forgive); + self + } + + pub fn mandate(mut self, mandate: &'a str) -> Self { + self.inner.mandate = Some(mandate); + self + } + + pub fn off_session(mut self, off_session: bool) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn paid_out_of_band(mut self, paid_out_of_band: bool) -> Self { + self.inner.paid_out_of_band = Some(paid_out_of_band); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self } } -impl std::fmt::Display for CreateInvoicePaymentSettingsPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl PayInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for CreateInvoicePaymentSettingsPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for PayInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/pay")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpcomingLinesInvoiceBuilder<'a> { + /// Settings for automatic tax lookup for this invoice preview. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// The code of the coupon to apply. + /// If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. + /// Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. + /// The invoice can be previewed without a coupon by passing this value as an empty string. + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// The currency to preview this invoice in. Defaults to that of `customer` if not specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, + /// The identifier of the customer whose upcoming invoice you'd like to retrieve. + /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// Details about the customer you want to invoice or overrides for an existing customer. + /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer_details: Option>, + /// The coupons to redeem into discounts for the invoice preview. + /// If not specified, inherits the discount from the customer or subscription. + /// This only works for coupons directly applied to the invoice. + /// To apply a coupon to a subscription, you must use the `coupon` parameter instead. + /// Pass an empty string to avoid inheriting any discounts. + /// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. + #[serde(skip_serializing_if = "Option::is_none")] + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// List of invoice items to add or update in the upcoming invoice preview. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_items: Option<&'a [UpcomingLinesInvoiceBuilderInvoiceItems<'a>]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// The identifier of the schedule whose upcoming invoice you'd like to retrieve. + /// Cannot be used with subscription or subscription fields. + #[serde(skip_serializing_if = "Option::is_none")] + pub schedule: Option<&'a str>, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// The identifier of the subscription for which you'd like to retrieve the upcoming invoice. + /// If not provided, but a `subscription_items` is provided, you will preview creating a subscription with those items. + /// If neither `subscription` nor `subscription_items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription: Option<&'a str>, + /// For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). + /// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. + /// For existing subscriptions, the value can only be set to `now` or `unchanged`. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_billing_cycle_anchor: + Option, + /// Timestamp indicating when the subscription should be scheduled to cancel. + /// Will prorate if within the current period and prorations have been enabled using `proration_behavior`. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_cancel_at: Option, + /// Boolean indicating whether this subscription should cancel at the end of the current period. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_cancel_at_period_end: Option, + /// This simulates the subscription being canceled or expired immediately. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_cancel_now: Option, + /// If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. + /// The default tax rates will apply to any line item that does not have `tax_rates` set. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_default_tax_rates: Option<&'a [&'a str]>, + /// A list of up to 20 subscription items, each with an attached price. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_items: Option<&'a [UpcomingLinesInvoiceBuilderSubscriptionItems<'a>]>, + /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. + /// The default value is `create_prorations`. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_proration_behavior: + Option, + /// If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. + /// The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. + /// If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. + /// Also, `subscription_proration_behavior` cannot be set to 'none'. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_proration_date: Option, + /// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_resume_at: Option, + /// Date a subscription is intended to start (can be future or past) + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_start_date: Option, + /// If provided, the invoice returned will preview updating or creating a subscription with that trial end. + /// If set, one of `subscription_items` or `subscription` is required. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_trial_end: Option, + /// Indicates if a plan's `trial_period_days` should be applied to the subscription. + /// Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. + /// Setting this flag to `true` together with `subscription_trial_end` is not allowed. + /// See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_trial_from_plan: Option, +} +impl<'a> UpcomingLinesInvoiceBuilder<'a> { + pub fn new() -> Self { + Self::default() } } -impl serde::Serialize for CreateInvoicePaymentSettingsPaymentMethodTypes { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +/// Details about the customer you want to invoice or overrides for an existing customer. +/// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpcomingLinesInvoiceBuilderCustomerDetails<'a> { + /// The customer's address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// The customer's shipping information. Appears on invoices emailed to this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping: Option>, + /// Tax details about the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax: Option>, + /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_exempt: Option, + /// The customer's tax IDs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_ids: Option<&'a [UpcomingLinesInvoiceBuilderCustomerDetailsTaxIds<'a>]>, +} +impl<'a> UpcomingLinesInvoiceBuilderCustomerDetails<'a> { + pub fn new() -> Self { + Self::default() } } -/// How to handle pending invoice items on invoice creation. -/// One of `include` or `exclude`. -/// `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. -/// `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. -/// Defaults to `exclude` if the parameter is omitted. +/// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoicePendingInvoiceItemsBehavior { - Exclude, - Include, - IncludeAndRequire, +pub enum UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { + Exempt, + None, + Reverse, } -impl CreateInvoicePendingInvoiceItemsBehavior { +impl UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { pub fn as_str(self) -> &'static str { - use CreateInvoicePendingInvoiceItemsBehavior::*; + use UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt::*; match self { - Exclude => "exclude", - Include => "include", - IncludeAndRequire => "include_and_require", + Exempt => "exempt", + None => "none", + Reverse => "reverse", } } } -impl std::str::FromStr for CreateInvoicePendingInvoiceItemsBehavior { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoicePendingInvoiceItemsBehavior::*; + use UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt::*; match s { - "exclude" => Ok(Exclude), - "include" => Ok(Include), - "include_and_require" => Ok(IncludeAndRequire), + "exempt" => Ok(Exempt), + "none" => Ok(None), + "reverse" => Ok(Reverse), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoicePendingInvoiceItemsBehavior { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoicePendingInvoiceItemsBehavior { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoicePendingInvoiceItemsBehavior { +impl serde::Serialize for UpcomingLinesInvoiceBuilderCustomerDetailsTaxExempt { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3606,66 +3225,258 @@ impl serde::Serialize for CreateInvoicePendingInvoiceItemsBehavior { serializer.serialize_str(self.as_str()) } } -/// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceRendering { - /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. - /// One of `exclude_tax` or `include_inclusive_tax`. - /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. - /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, - /// Invoice pdf rendering options - #[serde(skip_serializing_if = "Option::is_none")] - pub pdf: Option, +/// The customer's tax IDs. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpcomingLinesInvoiceBuilderCustomerDetailsTaxIds<'a> { + /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. + #[serde(rename = "type")] + pub type_: UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType, + /// Value of the tax ID. + pub value: &'a str, } -impl CreateInvoiceRendering { - pub fn new() -> Self { - Self::default() +impl<'a> UpcomingLinesInvoiceBuilderCustomerDetailsTaxIds<'a> { + pub fn new( + type_: UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType, + value: &'a str, + ) -> Self { + Self { type_, value } } } -/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. -/// One of `exclude_tax` or `include_inclusive_tax`. -/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. -/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. +/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceRenderingAmountTaxDisplay { - ExcludeTax, - IncludeInclusiveTax, +#[non_exhaustive] +pub enum UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { + AdNrt, + AeTrn, + ArCuit, + AuAbn, + AuArn, + BgUic, + BoTin, + BrCnpj, + BrCpf, + CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, + CaQst, + ChVat, + ClTin, + CnTin, + CoNit, + CrTin, + DoRcn, + EcRuc, + EgTin, + EsCif, + EuOssVat, + EuVat, + GbVat, + GeVat, + HkBr, + HuTin, + IdNpwp, + IlVat, + InGst, + IsVat, + JpCn, + JpRn, + JpTrn, + KePin, + KrBrn, + LiUid, + MxRfc, + MyFrp, + MyItn, + MySst, + NoVat, + NzGst, + PeRuc, + PhTin, + RoTin, + RsPib, + RuInn, + RuKpp, + SaVat, + SgGst, + SgUen, + SiTin, + SvNit, + ThVat, + TrTin, + TwVat, + UaVat, + UsEin, + UyRuc, + VeRif, + VnTin, + ZaVat, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, } -impl CreateInvoiceRenderingAmountTaxDisplay { +impl UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { pub fn as_str(self) -> &'static str { - use CreateInvoiceRenderingAmountTaxDisplay::*; + use UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType::*; match self { - ExcludeTax => "exclude_tax", - IncludeInclusiveTax => "include_inclusive_tax", + AdNrt => "ad_nrt", + AeTrn => "ae_trn", + ArCuit => "ar_cuit", + AuAbn => "au_abn", + AuArn => "au_arn", + BgUic => "bg_uic", + BoTin => "bo_tin", + BrCnpj => "br_cnpj", + BrCpf => "br_cpf", + CaBn => "ca_bn", + CaGstHst => "ca_gst_hst", + CaPstBc => "ca_pst_bc", + CaPstMb => "ca_pst_mb", + CaPstSk => "ca_pst_sk", + CaQst => "ca_qst", + ChVat => "ch_vat", + ClTin => "cl_tin", + CnTin => "cn_tin", + CoNit => "co_nit", + CrTin => "cr_tin", + DoRcn => "do_rcn", + EcRuc => "ec_ruc", + EgTin => "eg_tin", + EsCif => "es_cif", + EuOssVat => "eu_oss_vat", + EuVat => "eu_vat", + GbVat => "gb_vat", + GeVat => "ge_vat", + HkBr => "hk_br", + HuTin => "hu_tin", + IdNpwp => "id_npwp", + IlVat => "il_vat", + InGst => "in_gst", + IsVat => "is_vat", + JpCn => "jp_cn", + JpRn => "jp_rn", + JpTrn => "jp_trn", + KePin => "ke_pin", + KrBrn => "kr_brn", + LiUid => "li_uid", + MxRfc => "mx_rfc", + MyFrp => "my_frp", + MyItn => "my_itn", + MySst => "my_sst", + NoVat => "no_vat", + NzGst => "nz_gst", + PeRuc => "pe_ruc", + PhTin => "ph_tin", + RoTin => "ro_tin", + RsPib => "rs_pib", + RuInn => "ru_inn", + RuKpp => "ru_kpp", + SaVat => "sa_vat", + SgGst => "sg_gst", + SgUen => "sg_uen", + SiTin => "si_tin", + SvNit => "sv_nit", + ThVat => "th_vat", + TrTin => "tr_tin", + TwVat => "tw_vat", + UaVat => "ua_vat", + UsEin => "us_ein", + UyRuc => "uy_ruc", + VeRif => "ve_rif", + VnTin => "vn_tin", + ZaVat => "za_vat", + Unknown => "unknown", } } } -impl std::str::FromStr for CreateInvoiceRenderingAmountTaxDisplay { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceRenderingAmountTaxDisplay::*; + use UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType::*; match s { - "exclude_tax" => Ok(ExcludeTax), - "include_inclusive_tax" => Ok(IncludeInclusiveTax), + "ad_nrt" => Ok(AdNrt), + "ae_trn" => Ok(AeTrn), + "ar_cuit" => Ok(ArCuit), + "au_abn" => Ok(AuAbn), + "au_arn" => Ok(AuArn), + "bg_uic" => Ok(BgUic), + "bo_tin" => Ok(BoTin), + "br_cnpj" => Ok(BrCnpj), + "br_cpf" => Ok(BrCpf), + "ca_bn" => Ok(CaBn), + "ca_gst_hst" => Ok(CaGstHst), + "ca_pst_bc" => Ok(CaPstBc), + "ca_pst_mb" => Ok(CaPstMb), + "ca_pst_sk" => Ok(CaPstSk), + "ca_qst" => Ok(CaQst), + "ch_vat" => Ok(ChVat), + "cl_tin" => Ok(ClTin), + "cn_tin" => Ok(CnTin), + "co_nit" => Ok(CoNit), + "cr_tin" => Ok(CrTin), + "do_rcn" => Ok(DoRcn), + "ec_ruc" => Ok(EcRuc), + "eg_tin" => Ok(EgTin), + "es_cif" => Ok(EsCif), + "eu_oss_vat" => Ok(EuOssVat), + "eu_vat" => Ok(EuVat), + "gb_vat" => Ok(GbVat), + "ge_vat" => Ok(GeVat), + "hk_br" => Ok(HkBr), + "hu_tin" => Ok(HuTin), + "id_npwp" => Ok(IdNpwp), + "il_vat" => Ok(IlVat), + "in_gst" => Ok(InGst), + "is_vat" => Ok(IsVat), + "jp_cn" => Ok(JpCn), + "jp_rn" => Ok(JpRn), + "jp_trn" => Ok(JpTrn), + "ke_pin" => Ok(KePin), + "kr_brn" => Ok(KrBrn), + "li_uid" => Ok(LiUid), + "mx_rfc" => Ok(MxRfc), + "my_frp" => Ok(MyFrp), + "my_itn" => Ok(MyItn), + "my_sst" => Ok(MySst), + "no_vat" => Ok(NoVat), + "nz_gst" => Ok(NzGst), + "pe_ruc" => Ok(PeRuc), + "ph_tin" => Ok(PhTin), + "ro_tin" => Ok(RoTin), + "rs_pib" => Ok(RsPib), + "ru_inn" => Ok(RuInn), + "ru_kpp" => Ok(RuKpp), + "sa_vat" => Ok(SaVat), + "sg_gst" => Ok(SgGst), + "sg_uen" => Ok(SgUen), + "si_tin" => Ok(SiTin), + "sv_nit" => Ok(SvNit), + "th_vat" => Ok(ThVat), + "tr_tin" => Ok(TrTin), + "tw_vat" => Ok(TwVat), + "ua_vat" => Ok(UaVat), + "us_ein" => Ok(UsEin), + "uy_ruc" => Ok(UyRuc), + "ve_rif" => Ok(VeRif), + "vn_tin" => Ok(VnTin), + "za_vat" => Ok(ZaVat), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceRenderingAmountTaxDisplay { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceRenderingAmountTaxDisplay { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceRenderingAmountTaxDisplay { +impl serde::Serialize for UpcomingLinesInvoiceBuilderCustomerDetailsTaxIdsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3673,64 +3484,152 @@ impl serde::Serialize for CreateInvoiceRenderingAmountTaxDisplay { serializer.serialize_str(self.as_str()) } } -/// Invoice pdf rendering options +/// List of invoice items to add or update in the upcoming invoice preview. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceRenderingPdf { - /// Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`. - /// If set to `auto`, invoice PDF page size defaults to `a4` for customers with - /// Japanese locale and `letter` for customers with other locales. +pub struct UpcomingLinesInvoiceBuilderInvoiceItems<'a> { + /// The integer amount in cents (or local equivalent) of previewed invoice item. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + /// Only applicable to new invoice items. + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, + /// An arbitrary string which you can attach to the invoice item. + /// The description is displayed in the invoice for easy tracking. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// Explicitly controls whether discounts apply to this invoice item. + /// Defaults to true, except for negative invoice items. + #[serde(skip_serializing_if = "Option::is_none")] + pub discountable: Option, + /// The coupons to redeem into discounts for the invoice item in the preview. + #[serde(skip_serializing_if = "Option::is_none")] + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, + /// The ID of the invoice item to update in preview. + /// If not specified, a new invoice item will be added to the preview of the upcoming invoice. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoiceitem: Option<&'a str>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The period associated with this invoice item. + /// When set to different values, the period will be rendered on the invoice. + /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. + /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. + #[serde(skip_serializing_if = "Option::is_none")] + pub period: Option, + /// The ID of the price object. + #[serde(skip_serializing_if = "Option::is_none")] + pub price: Option<&'a str>, + /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. + #[serde(skip_serializing_if = "Option::is_none")] + pub price_data: Option>, + /// Non-negative integer. The quantity of units for the invoice item. + #[serde(skip_serializing_if = "Option::is_none")] + pub quantity: Option, + /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option<&'a str>, + /// The tax rates that apply to the item. When set, any `default_tax_rates` do not apply to this item. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_rates: Option<&'a [&'a str]>, + /// The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. + /// This unit_amount will be multiplied by the quantity to get the full amount. + /// If you want to apply a credit to the customer's account, pass a negative unit_amount. + #[serde(skip_serializing_if = "Option::is_none")] + pub unit_amount: Option, + /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. + /// Only one of `unit_amount` and `unit_amount_decimal` can be set. #[serde(skip_serializing_if = "Option::is_none")] - pub page_size: Option, + pub unit_amount_decimal: Option<&'a str>, } -impl CreateInvoiceRenderingPdf { +impl<'a> UpcomingLinesInvoiceBuilderInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } -/// Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`. -/// If set to `auto`, invoice PDF page size defaults to `a4` for customers with -/// Japanese locale and `letter` for customers with other locales. +/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpcomingLinesInvoiceBuilderInvoiceItemsPriceData<'a> { + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// The ID of the product that this price will belong to. + pub product: &'a str, + /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. + #[serde(skip_serializing_if = "Option::is_none")] + pub unit_amount: Option, + /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. + /// Only one of `unit_amount` and `unit_amount_decimal` can be set. + #[serde(skip_serializing_if = "Option::is_none")] + pub unit_amount_decimal: Option<&'a str>, +} +impl<'a> UpcomingLinesInvoiceBuilderInvoiceItemsPriceData<'a> { + pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { + Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } + } +} +/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. +/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. +/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceRenderingPdfPageSize { - A4, - Auto, - Letter, +pub enum UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, } -impl CreateInvoiceRenderingPdfPageSize { +impl UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceRenderingPdfPageSize::*; + use UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior::*; match self { - A4 => "a4", - Auto => "auto", - Letter => "letter", + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", } } } -impl std::str::FromStr for CreateInvoiceRenderingPdfPageSize { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceRenderingPdfPageSize::*; + use UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior::*; match s { - "a4" => Ok(A4), - "auto" => Ok(Auto), - "letter" => Ok(Letter), + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceRenderingPdfPageSize { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceRenderingPdfPageSize { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceRenderingPdfPageSize { +impl serde::Serialize for UpcomingLinesInvoiceBuilderInvoiceItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3738,65 +3637,51 @@ impl serde::Serialize for CreateInvoiceRenderingPdfPageSize { serializer.serialize_str(self.as_str()) } } -/// This is a legacy field that will be removed soon. -/// For details about `rendering_options`, refer to `rendering` instead. -/// Options for invoice PDF rendering. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceRenderingOptions { - /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. - /// One of `exclude_tax` or `include_inclusive_tax`. - /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. - /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, -} -impl CreateInvoiceRenderingOptions { - pub fn new() -> Self { - Self::default() - } -} -/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. -/// One of `exclude_tax` or `include_inclusive_tax`. -/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. -/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. +/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. +/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. +/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceRenderingOptionsAmountTaxDisplay { - ExcludeTax, - IncludeInclusiveTax, +pub enum UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { + Exclusive, + Inclusive, + Unspecified, } -impl CreateInvoiceRenderingOptionsAmountTaxDisplay { +impl UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceRenderingOptionsAmountTaxDisplay::*; + use UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior::*; match self { - ExcludeTax => "exclude_tax", - IncludeInclusiveTax => "include_inclusive_tax", + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", } } } -impl std::str::FromStr for CreateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceRenderingOptionsAmountTaxDisplay::*; + use UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior::*; match s { - "exclude_tax" => Ok(ExcludeTax), - "include_inclusive_tax" => Ok(IncludeInclusiveTax), + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceRenderingOptionsAmountTaxDisplay { +impl serde::Serialize for UpcomingLinesInvoiceBuilderInvoiceItemsTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3804,146 +3689,166 @@ impl serde::Serialize for CreateInvoiceRenderingOptionsAmountTaxDisplay { serializer.serialize_str(self.as_str()) } } -/// Settings for the cost of shipping for this invoice. +/// For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). +/// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. +/// For existing subscriptions, the value can only be set to `now` or `unchanged`. +#[derive(Copy, Clone, Debug, serde::Serialize)] +#[serde(untagged)] +pub enum UpcomingLinesInvoiceBuilderSubscriptionBillingCycleAnchor { + Now, + Unchanged, + Timestamp(stripe_types::Timestamp), +} +/// A list of up to 20 subscription items, each with an attached price. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceShippingCost<'a> { - /// The ID of the shipping rate to use for this order. +pub struct UpcomingLinesInvoiceBuilderSubscriptionItems<'a> { + /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. + /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate: Option<&'a str>, - /// Parameters to create a new ad-hoc shipping rate for this order. + pub billing_thresholds: Option, + /// Delete all usage for a given subscription item. + /// Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate_data: Option>, -} -impl<'a> CreateInvoiceShippingCost<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Parameters to create a new ad-hoc shipping rate for this order. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateData<'a> { - /// The estimated range for how long shipping will take, meant to be displayable to the customer. - /// This will appear on CheckoutSessions. + pub clear_usage: Option, + /// A flag that, if set to `true`, will delete the specified item. #[serde(skip_serializing_if = "Option::is_none")] - pub delivery_estimate: Option, - /// The name of the shipping rate, meant to be displayable to the customer. - /// This will appear on CheckoutSessions. - pub display_name: &'a str, - /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. + pub deleted: Option, + /// Subscription item to update. #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amount: Option>, + pub id: Option<&'a str>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, - /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. + /// Plan ID for this item, as a string. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan: Option<&'a str>, + /// The ID of the price object. + /// When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub price: Option<&'a str>, + /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. + #[serde(skip_serializing_if = "Option::is_none")] + pub price_data: Option>, + /// Quantity for this item. + #[serde(skip_serializing_if = "Option::is_none")] + pub quantity: Option, + /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. + /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. + /// When updating, pass an empty string to remove previously-defined tax rates. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_rates: Option<&'a [&'a str]>, +} +impl<'a> UpcomingLinesInvoiceBuilderSubscriptionItems<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct UpcomingLinesInvoiceBuilderSubscriptionItemsPriceData<'a> { + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// The ID of the product that this price will belong to. + pub product: &'a str, + /// The recurring components of a price such as `interval` and `interval_count`. + pub recurring: UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurring, + /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, - /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. - /// The Shipping tax code is `txcd_92010001`. + pub tax_behavior: Option, + /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_code: Option<&'a str>, - /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. - #[serde(rename = "type")] + pub unit_amount: Option, + /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. + /// Only one of `unit_amount` and `unit_amount_decimal` can be set. #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateInvoiceShippingCostShippingRateData<'a> { - pub fn new(display_name: &'a str) -> Self { +impl<'a> UpcomingLinesInvoiceBuilderSubscriptionItemsPriceData<'a> { + pub fn new( + currency: stripe_types::Currency, + product: &'a str, + recurring: UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurring, + ) -> Self { Self { - delivery_estimate: None, - display_name, - fixed_amount: None, - metadata: None, + currency, + product, + recurring, tax_behavior: None, - tax_code: None, - type_: None, + unit_amount: None, + unit_amount_decimal: None, } } } -/// The estimated range for how long shipping will take, meant to be displayable to the customer. -/// This will appear on CheckoutSessions. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimate { - /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The lower bound of the estimated range. If empty, represents no lower bound. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, -} -impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimate { - pub fn new() -> Self { - Self::default() - } -} -/// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. +/// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum { - /// A unit of time. - pub unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit, - /// Must be greater than 0. - pub value: i64, +pub struct UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurring { + /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. + pub interval: UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval, + /// The number of intervals between subscription billings. + /// For example, `interval=month` and `interval_count=3` bills every 3 months. + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + #[serde(skip_serializing_if = "Option::is_none")] + pub interval_count: Option, } -impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum { +impl UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurring { pub fn new( - unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit, - value: i64, + interval: UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval, ) -> Self { - Self { unit, value } + Self { interval, interval_count: None } } } -/// A unit of time. +/// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { - BusinessDay, +pub enum UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { Day, - Hour, Month, Week, + Year, } -impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; + use UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval::*; match self { - BusinessDay => "business_day", Day => "day", - Hour => "hour", Month => "month", Week => "week", + Year => "year", } } } -impl std::str::FromStr for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; + use UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval::*; match s { - "business_day" => Ok(BusinessDay), "day" => Ok(Day), - "hour" => Ok(Hour), "month" => Ok(Month), "week" => Ok(Week), + "year" => Ok(Year), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl serde::Serialize for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3951,70 +3856,51 @@ impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataDeliveryEstim serializer.serialize_str(self.as_str()) } } -/// The lower bound of the estimated range. If empty, represents no lower bound. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum { - /// A unit of time. - pub unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit, - /// Must be greater than 0. - pub value: i64, -} -impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum { - pub fn new( - unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit, - value: i64, - ) -> Self { - Self { unit, value } - } -} -/// A unit of time. +/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. +/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. +/// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { - BusinessDay, - Day, - Hour, - Month, - Week, +pub enum UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, } -impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; + use UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior::*; match self { - BusinessDay => "business_day", - Day => "day", - Hour => "hour", - Month => "month", - Week => "week", + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", } } } -impl std::str::FromStr for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; + use UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior::*; match s { - "business_day" => Ok(BusinessDay), - "day" => Ok(Day), - "hour" => Ok(Hour), - "month" => Ok(Month), - "week" => Ok(Week), + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl serde::Serialize for UpcomingLinesInvoiceBuilderSubscriptionItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4022,97 +3908,49 @@ impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataDeliveryEstim serializer.serialize_str(self.as_str()) } } -/// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateDataFixedAmount<'a> { - /// A non-negative integer in cents representing how much to charge. - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// Shipping rates defined in each available currency option. - /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). - #[serde(skip_serializing_if = "Option::is_none")] - pub currency_options: Option< - &'a std::collections::HashMap< - stripe_types::Currency, - CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions, - >, - >, -} -impl<'a> CreateInvoiceShippingCostShippingRateDataFixedAmount<'a> { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { amount, currency, currency_options: None } - } -} -/// Shipping rates defined in each available currency option. -/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions { - /// A non-negative integer in cents representing how much to charge. - pub amount: i64, - /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. - /// One of `inclusive`, `exclusive`, or `unspecified`. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: - Option, -} -impl CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions { - pub fn new(amount: i64) -> Self { - Self { amount, tax_behavior: None } - } -} -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. +/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. +/// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +pub enum UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { + AlwaysInvoice, + CreateProrations, + None, } -impl CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { +impl UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + use UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior::*; match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", + AlwaysInvoice => "always_invoice", + CreateProrations => "create_prorations", + None => "none", } } } -impl std::str::FromStr - for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::str::FromStr for UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + use UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), + "always_invoice" => Ok(AlwaysInvoice), + "create_prorations" => Ok(CreateProrations), + "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display - for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::fmt::Display for UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl serde::Serialize for UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4120,49 +3958,42 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. +/// For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceShippingCostShippingRateDataTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +pub enum UpcomingLinesInvoiceBuilderSubscriptionResumeAt { + Now, } -impl CreateInvoiceShippingCostShippingRateDataTaxBehavior { +impl UpcomingLinesInvoiceBuilderSubscriptionResumeAt { pub fn as_str(self) -> &'static str { - use CreateInvoiceShippingCostShippingRateDataTaxBehavior::*; + use UpcomingLinesInvoiceBuilderSubscriptionResumeAt::*; match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", + Now => "now", } } } -impl std::str::FromStr for CreateInvoiceShippingCostShippingRateDataTaxBehavior { +impl std::str::FromStr for UpcomingLinesInvoiceBuilderSubscriptionResumeAt { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceShippingCostShippingRateDataTaxBehavior::*; + use UpcomingLinesInvoiceBuilderSubscriptionResumeAt::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), + "now" => Ok(Now), _ => Err(()), } } } -impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataTaxBehavior { +impl std::fmt::Display for UpcomingLinesInvoiceBuilderSubscriptionResumeAt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceShippingCostShippingRateDataTaxBehavior { +impl std::fmt::Debug for UpcomingLinesInvoiceBuilderSubscriptionResumeAt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataTaxBehavior { +impl serde::Serialize for UpcomingLinesInvoiceBuilderSubscriptionResumeAt { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4170,58 +4001,210 @@ impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataTaxBehavior { serializer.serialize_str(self.as_str()) } } -/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceShippingCostShippingRateDataType { - FixedAmount, +/// If provided, the invoice returned will preview updating or creating a subscription with that trial end. +/// If set, one of `subscription_items` or `subscription` is required. +#[derive(Copy, Clone, Debug, serde::Serialize)] +#[serde(untagged)] +pub enum UpcomingLinesInvoiceBuilderSubscriptionTrialEnd { + Now, + Timestamp(stripe_types::Timestamp), } -impl CreateInvoiceShippingCostShippingRateDataType { - pub fn as_str(self) -> &'static str { - use CreateInvoiceShippingCostShippingRateDataType::*; - match self { - FixedAmount => "fixed_amount", - } - } +/// When retrieving an upcoming invoice, you’ll get a **lines** property containing the total count of line items and the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpcomingLinesInvoice<'a> { + inner: UpcomingLinesInvoiceBuilder<'a>, } +impl<'a> UpcomingLinesInvoice<'a> { + pub fn new() -> Self { + Self { inner: UpcomingLinesInvoiceBuilder::new() } + } + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } -impl std::str::FromStr for CreateInvoiceShippingCostShippingRateDataType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoiceShippingCostShippingRateDataType::*; - match s { - "fixed_amount" => Ok(FixedAmount), - _ => Err(()), - } + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self } -} -impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_details( + mut self, + customer_details: UpcomingLinesInvoiceBuilderCustomerDetails<'a>, + ) -> Self { + self.inner.customer_details = Some(customer_details); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_items( + mut self, + invoice_items: &'a [UpcomingLinesInvoiceBuilderInvoiceItems<'a>], + ) -> Self { + self.inner.invoice_items = Some(invoice_items); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn schedule(mut self, schedule: &'a str) -> Self { + self.inner.schedule = Some(schedule); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self + } + + pub fn subscription_billing_cycle_anchor( + mut self, + subscription_billing_cycle_anchor: UpcomingLinesInvoiceBuilderSubscriptionBillingCycleAnchor, + ) -> Self { + self.inner.subscription_billing_cycle_anchor = Some(subscription_billing_cycle_anchor); + self + } + + pub fn subscription_cancel_at( + mut self, + subscription_cancel_at: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_cancel_at = Some(subscription_cancel_at); + self + } + + pub fn subscription_cancel_at_period_end( + mut self, + subscription_cancel_at_period_end: bool, + ) -> Self { + self.inner.subscription_cancel_at_period_end = Some(subscription_cancel_at_period_end); + self + } + + pub fn subscription_cancel_now(mut self, subscription_cancel_now: bool) -> Self { + self.inner.subscription_cancel_now = Some(subscription_cancel_now); + self + } + + pub fn subscription_default_tax_rates( + mut self, + subscription_default_tax_rates: &'a [&'a str], + ) -> Self { + self.inner.subscription_default_tax_rates = Some(subscription_default_tax_rates); + self + } + + pub fn subscription_items( + mut self, + subscription_items: &'a [UpcomingLinesInvoiceBuilderSubscriptionItems<'a>], + ) -> Self { + self.inner.subscription_items = Some(subscription_items); + self + } + + pub fn subscription_proration_behavior( + mut self, + subscription_proration_behavior: UpcomingLinesInvoiceBuilderSubscriptionProrationBehavior, + ) -> Self { + self.inner.subscription_proration_behavior = Some(subscription_proration_behavior); + self + } + + pub fn subscription_proration_date( + mut self, + subscription_proration_date: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_proration_date = Some(subscription_proration_date); + self + } + + pub fn subscription_resume_at( + mut self, + subscription_resume_at: UpcomingLinesInvoiceBuilderSubscriptionResumeAt, + ) -> Self { + self.inner.subscription_resume_at = Some(subscription_resume_at); + self + } + + pub fn subscription_start_date( + mut self, + subscription_start_date: stripe_types::Timestamp, + ) -> Self { + self.inner.subscription_start_date = Some(subscription_start_date); + self + } + + pub fn subscription_trial_end( + mut self, + subscription_trial_end: UpcomingLinesInvoiceBuilderSubscriptionTrialEnd, + ) -> Self { + self.inner.subscription_trial_end = Some(subscription_trial_end); + self } -} -impl std::fmt::Debug for CreateInvoiceShippingCostShippingRateDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn subscription_trial_from_plan(mut self, subscription_trial_from_plan: bool) -> Self { + self.inner.subscription_trial_from_plan = Some(subscription_trial_from_plan); + self } } -impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +impl UpcomingLinesInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateInvoice<'a> { - /// This endpoint creates a draft invoice for a given customer. - /// The invoice remains a draft until you [finalize](https://stripe.com/docs/api#finalize_invoice) the invoice, which allows you to [pay](https://stripe.com/docs/api#pay_invoice) or [send](https://stripe.com/docs/api#send_invoice) the invoice to your customers. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/invoices", self, http_types::Method::Post) + +impl StripeRequest for UpcomingLinesInvoice<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/invoices/upcoming/lines").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoice<'a> { +pub struct CreateInvoiceBuilder<'a> { /// The account tax IDs associated with the invoice. Only editable when the invoice is a draft. #[serde(skip_serializing_if = "Option::is_none")] pub account_tax_ids: Option<&'a [&'a str]>, @@ -4231,23 +4214,29 @@ pub struct UpdateInvoice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_amount: Option, /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. + /// If `false`, the invoice's state doesn't automatically advance without an explicit action. #[serde(skip_serializing_if = "Option::is_none")] pub auto_advance: Option, /// Settings for automatic tax lookup for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, - /// Either `charge_automatically` or `send_invoice`. - /// This field can be updated only on `draft` invoices. + pub automatic_tax: Option, + /// Either `charge_automatically`, or `send_invoice`. + /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. + /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. + /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] pub collection_method: Option, + /// The currency to create this invoice in. Defaults to that of `customer` if not specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, /// A list of up to 4 custom fields to be displayed on the invoice. - /// If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. - /// Pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, - /// The number of days from which the invoice is created until it is due. - /// Only valid for invoices where `collection_method=send_invoice`. - /// This field can only be updated on `draft` invoices. + /// The ID of the customer who will be billed. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// The number of days from when the invoice is created until it is due. + /// Valid only for invoices where `collection_method=send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] pub days_until_due: Option, /// ID of the default payment method for the invoice. @@ -4261,7 +4250,6 @@ pub struct UpdateInvoice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub default_source: Option<&'a str>, /// The tax rates that will apply to any line item that does not have `tax_rates` set. - /// Pass an empty string to remove previously-defined tax rates. #[serde(skip_serializing_if = "Option::is_none")] pub default_tax_rates: Option<&'a [&'a str]>, /// An arbitrary string attached to the object. @@ -4269,13 +4257,13 @@ pub struct UpdateInvoice<'a> { /// Referenced as 'memo' in the Dashboard. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, - /// The discounts that will apply to the invoice. - /// Pass an empty string to remove previously-defined discounts. + /// The coupons to redeem into discounts for the invoice. + /// If not specified, inherits the discount from the invoice's customer. + /// Pass an empty string to avoid inheriting any discounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpdateInvoiceDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// The date on which payment for this invoice is due. - /// Only valid for invoices where `collection_method=send_invoice`. - /// This field can only be updated on `draft` invoices. + /// Valid only for invoices where `collection_method=send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] pub due_date: Option, /// The date when this invoice is in effect. @@ -4289,10 +4277,11 @@ pub struct UpdateInvoice<'a> { /// Footer to be displayed on the invoice. #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<&'a str>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. + /// Revise an existing invoice. + /// The new invoice will be created in `status=draft`. + /// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, + pub from_invoice: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -4306,18 +4295,25 @@ pub struct UpdateInvoice<'a> { pub on_behalf_of: Option<&'a str>, /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_settings: Option>, + pub payment_settings: Option>, + /// How to handle pending invoice items on invoice creation. + /// One of `include` or `exclude`. + /// `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. + /// `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. + /// Defaults to `exclude` if the parameter is omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub pending_invoice_items_behavior: Option, /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. #[serde(skip_serializing_if = "Option::is_none")] - pub rendering: Option, + pub rendering: Option, /// This is a legacy field that will be removed soon. /// For details about `rendering_options`, refer to `rendering` instead. /// Options for invoice PDF rendering. #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, + pub rendering_options: Option, /// Settings for the cost of shipping for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, + pub shipping_cost: Option>, /// Shipping details for the invoice. /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. #[serde(skip_serializing_if = "Option::is_none")] @@ -4327,167 +4323,73 @@ pub struct UpdateInvoice<'a> { /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, + /// The ID of the subscription to invoice, if any. + /// If set, the created invoice will only include pending invoice items for that subscription. + /// The subscription's billing cycle and regular subscription events won't be affected. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription: Option<&'a str>, /// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. - /// This will be unset if you POST an empty value. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, } -impl<'a> UpdateInvoice<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings for automatic tax lookup for this invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceAutomaticTax<'a> { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpdateInvoiceAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateInvoiceAutomaticTaxLiabilityType, -} -impl<'a> UpdateInvoiceAutomaticTaxLiability<'a> { - pub fn new(type_: UpdateInvoiceAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdateInvoiceAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdateInvoiceAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateInvoiceAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateInvoiceAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateInvoiceAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateInvoiceAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateInvoiceAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The discounts that will apply to the invoice. -/// Pass an empty string to remove previously-defined discounts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpdateInvoiceDiscounts<'a> { +impl<'a> CreateInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. +/// Revise an existing invoice. +/// The new invoice will be created in `status=draft`. +/// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateInvoiceIssuerType, +pub struct CreateInvoiceBuilderFromInvoice<'a> { + /// The relation between the new invoice and the original invoice. + /// Currently, only 'revision' is permitted. + pub action: CreateInvoiceBuilderFromInvoiceAction, + /// The `id` of the invoice that will be cloned. + pub invoice: &'a str, } -impl<'a> UpdateInvoiceIssuer<'a> { - pub fn new(type_: UpdateInvoiceIssuerType) -> Self { - Self { account: None, type_ } +impl<'a> CreateInvoiceBuilderFromInvoice<'a> { + pub fn new(action: CreateInvoiceBuilderFromInvoiceAction, invoice: &'a str) -> Self { + Self { action, invoice } } } -/// Type of the account referenced in the request. +/// The relation between the new invoice and the original invoice. +/// Currently, only 'revision' is permitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceIssuerType { - Account, - Self_, +pub enum CreateInvoiceBuilderFromInvoiceAction { + Revision, } -impl UpdateInvoiceIssuerType { +impl CreateInvoiceBuilderFromInvoiceAction { pub fn as_str(self) -> &'static str { - use UpdateInvoiceIssuerType::*; + use CreateInvoiceBuilderFromInvoiceAction::*; match self { - Account => "account", - Self_ => "self", + Revision => "revision", } } } -impl std::str::FromStr for UpdateInvoiceIssuerType { +impl std::str::FromStr for CreateInvoiceBuilderFromInvoiceAction { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceIssuerType::*; + use CreateInvoiceBuilderFromInvoiceAction::*; match s { - "account" => Ok(Account), - "self" => Ok(Self_), + "revision" => Ok(Revision), _ => Err(()), } } } -impl std::fmt::Display for UpdateInvoiceIssuerType { +impl std::fmt::Display for CreateInvoiceBuilderFromInvoiceAction { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceIssuerType { +impl std::fmt::Debug for CreateInvoiceBuilderFromInvoiceAction { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceIssuerType { +impl serde::Serialize for CreateInvoiceBuilderFromInvoiceAction { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4497,37 +4399,37 @@ impl serde::Serialize for UpdateInvoiceIssuerType { } /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettings<'a> { +pub struct CreateInvoiceBuilderPaymentSettings<'a> { /// ID of the mandate to be used for this invoice. /// It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set. #[serde(skip_serializing_if = "Option::is_none")] pub default_mandate: Option<&'a str>, /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The list of payment method types (e.g. /// card) to provide to the invoice’s PaymentIntent. /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [UpdateInvoicePaymentSettingsPaymentMethodTypes]>, + pub payment_method_types: Option<&'a [CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes]>, } -impl<'a> UpdateInvoicePaymentSettings<'a> { +impl<'a> CreateInvoiceBuilderPaymentSettings<'a> { pub fn new() -> Self { Self::default() } } /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptions<'a> { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptions<'a> { /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, + pub acss_debit: Option, /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, + pub card: Option, /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub customer_balance: Option>, @@ -4536,53 +4438,54 @@ pub struct UpdateInvoicePaymentSettingsPaymentMethodOptions<'a> { pub konbini: Option<&'a serde_json::Value>, /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: + Option>, } -impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptions<'a> { +impl<'a> CreateInvoiceBuilderPaymentSettingsPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option, + Option, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { /// Transaction type of the mandate. - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: Option< - UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub transaction_type: Option, + } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { pub fn new() -> Self { Self::default() } } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType +{ Business, Personal, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -4590,54 +4493,44 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTran } } -impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::str::FromStr for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { - "business" => Ok(Business), - "personal" => Ok(Personal), - _ => Err(()), + "business" => Ok(Business), +"personal" => Ok(Personal), +_ => Err(()) + } } } -impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Display for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Debug for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -4647,11 +4540,11 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod } impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -4661,7 +4554,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4669,14 +4562,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -4687,28 +4580,28 @@ impl serde::Serialize } /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontact { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_language: - Option, + Option, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontact { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -4719,11 +4612,11 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage } impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -4734,7 +4627,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4742,14 +4635,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn serialize(&self, serializer: S) -> Result where @@ -4760,20 +4653,21 @@ impl serde::Serialize } /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCard { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCard { /// Installment configuration for payments attempted on this invoice (Mexico Only). /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, + pub installments: + Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, + Option, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCard { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCard { pub fn new() -> Self { Self::default() } @@ -4782,37 +4676,38 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCard { /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallments { /// Setting to true enables installments for this invoice. /// Setting to false will prevent any selected plan from applying to a payment. #[serde(skip_serializing_if = "Option::is_none")] pub enabled: Option, /// The selected installment plan to use for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option, + pub plan: Option, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } } /// The selected installment plan to use for this invoice. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. pub count: u64, /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. - pub interval: UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, + pub interval: + CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, /// Type of installment plan, one of `fixed_count`. #[serde(rename = "type")] - pub type_: UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, + pub type_: CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { pub fn new( count: u64, - interval: UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, - type_: UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, + interval: CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval, + type_: CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType, ) -> Self { Self { count, interval, type_ } } @@ -4820,12 +4715,12 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { Month, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; match self { Month => "month", } @@ -4833,11 +4728,11 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterva } impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::*; match s { "month" => Ok(Month), _ => Err(()), @@ -4845,7 +4740,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4853,14 +4748,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval { fn serialize(&self, serializer: S) -> Result where @@ -4871,12 +4766,12 @@ impl serde::Serialize } /// Type of installment plan, one of `fixed_count`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { FixedCount, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; match self { FixedCount => "fixed_count", } @@ -4884,11 +4779,11 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { } impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::*; match s { "fixed_count" => Ok(FixedCount), _ => Err(()), @@ -4896,19 +4791,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Debug + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType { +impl serde::Serialize + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4920,46 +4819,51 @@ impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardIn /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } -impl std::str::FromStr for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } -impl std::fmt::Display for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4969,36 +4873,41 @@ impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRe } /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: Option< - UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, + CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections< + 'a, + >, >, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, + pub verification_method: Option< + CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod, + >, } -impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +pub struct CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, +pub permissions: Option<&'a [CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, +pub prefetch: Option<&'a [CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, } -impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> + CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> +{ pub fn new() -> Self { Self::default() } @@ -5007,129 +4916,110 @@ impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialC /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { Balances, Ownership, PaymentMethod, Transactions, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { - Balances => "balances", - Ownership => "ownership", - PaymentMethod => "payment_method", - Transactions => "transactions", +Balances => "balances", +Ownership => "ownership", +PaymentMethod => "payment_method", +Transactions => "transactions", + } } } -impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ +impl std::str::FromStr for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { - "balances" => Ok(Balances), - "ownership" => Ok(Ownership), - "payment_method" => Ok(PaymentMethod), - "transactions" => Ok(Transactions), - _ => Err(()), + "balances" => Ok(Balances), +"ownership" => Ok(Ownership), +"payment_method" => Ok(PaymentMethod), +"transactions" => Ok(Transactions), +_ => Err(()) + } } } -impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ +impl std::fmt::Display for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ +impl std::fmt::Debug for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +{ Balances, - Transactions, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl + CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +{ pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } -impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ +impl std::str::FromStr for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { - "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), + "balances" => Ok(Balances), +_ => Err(()) + } } } -impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ +impl std::fmt::Display for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ +impl std::fmt::Debug for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -5139,11 +5029,11 @@ impl UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMe } impl std::str::FromStr - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -5153,7 +5043,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -5161,14 +5051,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateInvoiceBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -5182,7 +5072,7 @@ impl serde::Serialize /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateInvoicePaymentSettingsPaymentMethodTypes { +pub enum CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { AchCreditTransfer, AchDebit, AcssDebit, @@ -5193,14 +5083,12 @@ pub enum UpdateInvoicePaymentSettingsPaymentMethodTypes { Card, Cashapp, CustomerBalance, - Eps, Fpx, Giropay, Grabpay, Ideal, Konbini, Link, - P24, Paynow, Paypal, Promptpay, @@ -5212,9 +5100,9 @@ pub enum UpdateInvoicePaymentSettingsPaymentMethodTypes { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateInvoicePaymentSettingsPaymentMethodTypes { +impl CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { pub fn as_str(self) -> &'static str { - use UpdateInvoicePaymentSettingsPaymentMethodTypes::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes::*; match self { AchCreditTransfer => "ach_credit_transfer", AchDebit => "ach_debit", @@ -5226,14 +5114,12 @@ impl UpdateInvoicePaymentSettingsPaymentMethodTypes { Card => "card", Cashapp => "cashapp", CustomerBalance => "customer_balance", - Eps => "eps", Fpx => "fpx", Giropay => "giropay", Grabpay => "grabpay", Ideal => "ideal", Konbini => "konbini", Link => "link", - P24 => "p24", Paynow => "paynow", Paypal => "paypal", Promptpay => "promptpay", @@ -5247,10 +5133,10 @@ impl UpdateInvoicePaymentSettingsPaymentMethodTypes { } } -impl std::str::FromStr for UpdateInvoicePaymentSettingsPaymentMethodTypes { +impl std::str::FromStr for CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoicePaymentSettingsPaymentMethodTypes::*; + use CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes::*; match s { "ach_credit_transfer" => Ok(AchCreditTransfer), "ach_debit" => Ok(AchDebit), @@ -5262,14 +5148,12 @@ impl std::str::FromStr for UpdateInvoicePaymentSettingsPaymentMethodTypes { "card" => Ok(Card), "cashapp" => Ok(Cashapp), "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), "fpx" => Ok(Fpx), "giropay" => Ok(Giropay), "grabpay" => Ok(Grabpay), "ideal" => Ok(Ideal), "konbini" => Ok(Konbini), "link" => Ok(Link), - "p24" => Ok(P24), "paynow" => Ok(Paynow), "paypal" => Ok(Paypal), "promptpay" => Ok(Promptpay), @@ -5282,18 +5166,71 @@ impl std::str::FromStr for UpdateInvoicePaymentSettingsPaymentMethodTypes { } } } -impl std::fmt::Display for UpdateInvoicePaymentSettingsPaymentMethodTypes { +impl std::fmt::Display for CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreateInvoiceBuilderPaymentSettingsPaymentMethodTypes { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// How to handle pending invoice items on invoice creation. +/// One of `include` or `exclude`. +/// `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. +/// `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. +/// Defaults to `exclude` if the parameter is omitted. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateInvoiceBuilderPendingInvoiceItemsBehavior { + Exclude, + Include, + IncludeAndRequire, +} +impl CreateInvoiceBuilderPendingInvoiceItemsBehavior { + pub fn as_str(self) -> &'static str { + use CreateInvoiceBuilderPendingInvoiceItemsBehavior::*; + match self { + Exclude => "exclude", + Include => "include", + IncludeAndRequire => "include_and_require", + } + } +} + +impl std::str::FromStr for CreateInvoiceBuilderPendingInvoiceItemsBehavior { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateInvoiceBuilderPendingInvoiceItemsBehavior::*; + match s { + "exclude" => Ok(Exclude), + "include" => Ok(Include), + "include_and_require" => Ok(IncludeAndRequire), + _ => Err(()), + } + } +} +impl std::fmt::Display for CreateInvoiceBuilderPendingInvoiceItemsBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoicePaymentSettingsPaymentMethodTypes { +impl std::fmt::Debug for CreateInvoiceBuilderPendingInvoiceItemsBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodTypes { +impl serde::Serialize for CreateInvoiceBuilderPendingInvoiceItemsBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5303,18 +5240,18 @@ impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodTypes { } /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceRendering { +pub struct CreateInvoiceBuilderRendering { /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. /// One of `exclude_tax` or `include_inclusive_tax`. /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, + pub amount_tax_display: Option, /// Invoice pdf rendering options #[serde(skip_serializing_if = "Option::is_none")] - pub pdf: Option, + pub pdf: Option, } -impl UpdateInvoiceRendering { +impl CreateInvoiceBuilderRendering { pub fn new() -> Self { Self::default() } @@ -5324,13 +5261,13 @@ impl UpdateInvoiceRendering { /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceRenderingAmountTaxDisplay { +pub enum CreateInvoiceBuilderRenderingAmountTaxDisplay { ExcludeTax, IncludeInclusiveTax, } -impl UpdateInvoiceRenderingAmountTaxDisplay { +impl CreateInvoiceBuilderRenderingAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use UpdateInvoiceRenderingAmountTaxDisplay::*; + use CreateInvoiceBuilderRenderingAmountTaxDisplay::*; match self { ExcludeTax => "exclude_tax", IncludeInclusiveTax => "include_inclusive_tax", @@ -5338,10 +5275,10 @@ impl UpdateInvoiceRenderingAmountTaxDisplay { } } -impl std::str::FromStr for UpdateInvoiceRenderingAmountTaxDisplay { +impl std::str::FromStr for CreateInvoiceBuilderRenderingAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceRenderingAmountTaxDisplay::*; + use CreateInvoiceBuilderRenderingAmountTaxDisplay::*; match s { "exclude_tax" => Ok(ExcludeTax), "include_inclusive_tax" => Ok(IncludeInclusiveTax), @@ -5349,18 +5286,18 @@ impl std::str::FromStr for UpdateInvoiceRenderingAmountTaxDisplay { } } } -impl std::fmt::Display for UpdateInvoiceRenderingAmountTaxDisplay { +impl std::fmt::Display for CreateInvoiceBuilderRenderingAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceRenderingAmountTaxDisplay { +impl std::fmt::Debug for CreateInvoiceBuilderRenderingAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceRenderingAmountTaxDisplay { +impl serde::Serialize for CreateInvoiceBuilderRenderingAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5370,14 +5307,14 @@ impl serde::Serialize for UpdateInvoiceRenderingAmountTaxDisplay { } /// Invoice pdf rendering options #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceRenderingPdf { +pub struct CreateInvoiceBuilderRenderingPdf { /// Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`. /// If set to `auto`, invoice PDF page size defaults to `a4` for customers with /// Japanese locale and `letter` for customers with other locales. #[serde(skip_serializing_if = "Option::is_none")] - pub page_size: Option, + pub page_size: Option, } -impl UpdateInvoiceRenderingPdf { +impl CreateInvoiceBuilderRenderingPdf { pub fn new() -> Self { Self::default() } @@ -5386,14 +5323,14 @@ impl UpdateInvoiceRenderingPdf { /// If set to `auto`, invoice PDF page size defaults to `a4` for customers with /// Japanese locale and `letter` for customers with other locales. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceRenderingPdfPageSize { +pub enum CreateInvoiceBuilderRenderingPdfPageSize { A4, Auto, Letter, } -impl UpdateInvoiceRenderingPdfPageSize { +impl CreateInvoiceBuilderRenderingPdfPageSize { pub fn as_str(self) -> &'static str { - use UpdateInvoiceRenderingPdfPageSize::*; + use CreateInvoiceBuilderRenderingPdfPageSize::*; match self { A4 => "a4", Auto => "auto", @@ -5402,10 +5339,10 @@ impl UpdateInvoiceRenderingPdfPageSize { } } -impl std::str::FromStr for UpdateInvoiceRenderingPdfPageSize { +impl std::str::FromStr for CreateInvoiceBuilderRenderingPdfPageSize { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceRenderingPdfPageSize::*; + use CreateInvoiceBuilderRenderingPdfPageSize::*; match s { "a4" => Ok(A4), "auto" => Ok(Auto), @@ -5414,18 +5351,18 @@ impl std::str::FromStr for UpdateInvoiceRenderingPdfPageSize { } } } -impl std::fmt::Display for UpdateInvoiceRenderingPdfPageSize { +impl std::fmt::Display for CreateInvoiceBuilderRenderingPdfPageSize { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceRenderingPdfPageSize { +impl std::fmt::Debug for CreateInvoiceBuilderRenderingPdfPageSize { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceRenderingPdfPageSize { +impl serde::Serialize for CreateInvoiceBuilderRenderingPdfPageSize { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5437,15 +5374,15 @@ impl serde::Serialize for UpdateInvoiceRenderingPdfPageSize { /// For details about `rendering_options`, refer to `rendering` instead. /// Options for invoice PDF rendering. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceRenderingOptions { +pub struct CreateInvoiceBuilderRenderingOptions { /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. /// One of `exclude_tax` or `include_inclusive_tax`. /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, + pub amount_tax_display: Option, } -impl UpdateInvoiceRenderingOptions { +impl CreateInvoiceBuilderRenderingOptions { pub fn new() -> Self { Self::default() } @@ -5455,13 +5392,13 @@ impl UpdateInvoiceRenderingOptions { /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceRenderingOptionsAmountTaxDisplay { +pub enum CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { ExcludeTax, IncludeInclusiveTax, } -impl UpdateInvoiceRenderingOptionsAmountTaxDisplay { +impl CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use UpdateInvoiceRenderingOptionsAmountTaxDisplay::*; + use CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay::*; match self { ExcludeTax => "exclude_tax", IncludeInclusiveTax => "include_inclusive_tax", @@ -5469,10 +5406,10 @@ impl UpdateInvoiceRenderingOptionsAmountTaxDisplay { } } -impl std::str::FromStr for UpdateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::str::FromStr for CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceRenderingOptionsAmountTaxDisplay::*; + use CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay::*; match s { "exclude_tax" => Ok(ExcludeTax), "include_inclusive_tax" => Ok(IncludeInclusiveTax), @@ -5480,18 +5417,18 @@ impl std::str::FromStr for UpdateInvoiceRenderingOptionsAmountTaxDisplay { } } } -impl std::fmt::Display for UpdateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::fmt::Display for CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceRenderingOptionsAmountTaxDisplay { +impl std::fmt::Debug for CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceRenderingOptionsAmountTaxDisplay { +impl serde::Serialize for CreateInvoiceBuilderRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5501,32 +5438,32 @@ impl serde::Serialize for UpdateInvoiceRenderingOptionsAmountTaxDisplay { } /// Settings for the cost of shipping for this invoice. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceShippingCost<'a> { +pub struct CreateInvoiceBuilderShippingCost<'a> { /// The ID of the shipping rate to use for this order. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_rate: Option<&'a str>, /// Parameters to create a new ad-hoc shipping rate for this order. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate_data: Option>, + pub shipping_rate_data: Option>, } -impl<'a> UpdateInvoiceShippingCost<'a> { +impl<'a> CreateInvoiceBuilderShippingCost<'a> { pub fn new() -> Self { Self::default() } } /// Parameters to create a new ad-hoc shipping rate for this order. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateData<'a> { +pub struct CreateInvoiceBuilderShippingCostShippingRateData<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[serde(skip_serializing_if = "Option::is_none")] - pub delivery_estimate: Option, + pub delivery_estimate: Option, /// The name of the shipping rate, meant to be displayable to the customer. /// This will appear on CheckoutSessions. pub display_name: &'a str, /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amount: Option>, + pub fixed_amount: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -5536,7 +5473,7 @@ pub struct UpdateInvoiceShippingCostShippingRateData<'a> { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. /// The Shipping tax code is `txcd_92010001`. #[serde(skip_serializing_if = "Option::is_none")] @@ -5544,9 +5481,9 @@ pub struct UpdateInvoiceShippingCostShippingRateData<'a> { /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> UpdateInvoiceShippingCostShippingRateData<'a> { +impl<'a> CreateInvoiceBuilderShippingCostShippingRateData<'a> { pub fn new(display_name: &'a str) -> Self { Self { delivery_estimate: None, @@ -5562,30 +5499,30 @@ impl<'a> UpdateInvoiceShippingCostShippingRateData<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateDataDeliveryEstimate { +pub struct CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimate { /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, + pub maximum: Option, /// The lower bound of the estimated range. If empty, represents no lower bound. #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, + pub minimum: Option, } -impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimate { +impl CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimate { pub fn new() -> Self { Self::default() } } /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum { +pub struct CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximum { /// A unit of time. - pub unit: UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit, + pub unit: CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit, /// Must be greater than 0. pub value: i64, } -impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum { +impl CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximum { pub fn new( - unit: UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit, + unit: CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit, value: i64, ) -> Self { Self { unit, value } @@ -5593,16 +5530,16 @@ impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum { } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +pub enum CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { BusinessDay, Day, Hour, Month, Week, } -impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit { pub fn as_str(self) -> &'static str { - use UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; + use CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -5613,10 +5550,12 @@ impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { } } -impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::str::FromStr + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; + use CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -5627,18 +5566,24 @@ impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataDeliveryEsti } } } -impl std::fmt::Display for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::fmt::Display + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl std::fmt::Debug + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit { +impl serde::Serialize + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMaximumUnit +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5648,15 +5593,15 @@ impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataDeliveryEstim } /// The lower bound of the estimated range. If empty, represents no lower bound. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum { +pub struct CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimum { /// A unit of time. - pub unit: UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit, + pub unit: CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit, /// Must be greater than 0. pub value: i64, } -impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum { +impl CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimum { pub fn new( - unit: UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit, + unit: CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit, value: i64, ) -> Self { Self { unit, value } @@ -5664,16 +5609,16 @@ impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum { } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +pub enum CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { BusinessDay, Day, Hour, Month, Week, } -impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit { pub fn as_str(self) -> &'static str { - use UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; + use CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -5684,10 +5629,12 @@ impl UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { } } -impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::str::FromStr + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; + use CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -5698,18 +5645,24 @@ impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataDeliveryEsti } } } -impl std::fmt::Display for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::fmt::Display + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl std::fmt::Debug + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit { +impl serde::Serialize + for CreateInvoiceBuilderShippingCostShippingRateDataDeliveryEstimateMinimumUnit +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5719,7 +5672,7 @@ impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataDeliveryEstim } /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateDataFixedAmount<'a> { +pub struct CreateInvoiceBuilderShippingCostShippingRateDataFixedAmount<'a> { /// A non-negative integer in cents representing how much to charge. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -5731,11 +5684,11 @@ pub struct UpdateInvoiceShippingCostShippingRateDataFixedAmount<'a> { pub currency_options: Option< &'a std::collections::HashMap< stripe_types::Currency, - UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions, + CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions, >, >, } -impl<'a> UpdateInvoiceShippingCostShippingRateDataFixedAmount<'a> { +impl<'a> CreateInvoiceBuilderShippingCostShippingRateDataFixedAmount<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, currency, currency_options: None } } @@ -5743,189 +5696,586 @@ impl<'a> UpdateInvoiceShippingCostShippingRateDataFixedAmount<'a> { /// Shipping rates defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions { +pub struct CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions { /// A non-negative integer in cents representing how much to charge. pub amount: i64, /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: - Option, + pub tax_behavior: Option< + CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior, + >, +} +impl CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptions { + pub fn new(amount: i64) -> Self { + Self { amount, tax_behavior: None } + } +} +/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} +impl CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { + pub fn as_str(self) -> &'static str { + use CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + match self { + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", + } + } +} + +impl std::str::FromStr + for CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ + type Err = (); + fn from_str(s: &str) -> Result { + use CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + match s { + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), + _ => Err(()), + } + } +} +impl std::fmt::Display + for CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug + for CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize + for CreateInvoiceBuilderShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. +/// One of `inclusive`, `exclusive`, or `unspecified`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} +impl CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + pub fn as_str(self) -> &'static str { + use CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior::*; + match self { + Exclusive => "exclusive", + Inclusive => "inclusive", + Unspecified => "unspecified", + } + } +} + +impl std::str::FromStr for CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior::*; + match s { + "exclusive" => Ok(Exclusive), + "inclusive" => Ok(Inclusive), + "unspecified" => Ok(Unspecified), + _ => Err(()), + } + } +} +impl std::fmt::Display for CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreateInvoiceBuilderShippingCostShippingRateDataTaxBehavior { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateInvoiceBuilderShippingCostShippingRateDataType { + FixedAmount, +} +impl CreateInvoiceBuilderShippingCostShippingRateDataType { + pub fn as_str(self) -> &'static str { + use CreateInvoiceBuilderShippingCostShippingRateDataType::*; + match self { + FixedAmount => "fixed_amount", + } + } +} + +impl std::str::FromStr for CreateInvoiceBuilderShippingCostShippingRateDataType { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateInvoiceBuilderShippingCostShippingRateDataType::*; + match s { + "fixed_amount" => Ok(FixedAmount), + _ => Err(()), + } + } +} +impl std::fmt::Display for CreateInvoiceBuilderShippingCostShippingRateDataType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateInvoiceBuilderShippingCostShippingRateDataType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreateInvoiceBuilderShippingCostShippingRateDataType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// This endpoint creates a draft invoice for a given customer. +/// The invoice remains a draft until you [finalize](https://stripe.com/docs/api#finalize_invoice) the invoice, which allows you to [pay](https://stripe.com/docs/api#pay_invoice) or [send](https://stripe.com/docs/api#send_invoice) the invoice to your customers. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateInvoice<'a> { + inner: CreateInvoiceBuilder<'a>, +} +impl<'a> CreateInvoice<'a> { + pub fn new() -> Self { + Self { inner: CreateInvoiceBuilder::new() } + } + pub fn account_tax_ids(mut self, account_tax_ids: &'a [&'a str]) -> Self { + self.inner.account_tax_ids = Some(account_tax_ids); + self + } + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn auto_advance(mut self, auto_advance: bool) -> Self { + self.inner.auto_advance = Some(auto_advance); + self + } + + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn collection_method( + mut self, + collection_method: stripe_shared::InvoiceCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn custom_fields(mut self, custom_fields: &'a [CustomFieldParams<'a>]) -> Self { + self.inner.custom_fields = Some(custom_fields); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn days_until_due(mut self, days_until_due: u32) -> Self { + self.inner.days_until_due = Some(days_until_due); + self + } + + pub fn default_payment_method(mut self, default_payment_method: &'a str) -> Self { + self.inner.default_payment_method = Some(default_payment_method); + self + } + + pub fn default_source(mut self, default_source: &'a str) -> Self { + self.inner.default_source = Some(default_source); + self + } + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn due_date(mut self, due_date: stripe_types::Timestamp) -> Self { + self.inner.due_date = Some(due_date); + self + } + + pub fn effective_at(mut self, effective_at: stripe_types::Timestamp) -> Self { + self.inner.effective_at = Some(effective_at); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn footer(mut self, footer: &'a str) -> Self { + self.inner.footer = Some(footer); + self + } + + pub fn from_invoice(mut self, from_invoice: CreateInvoiceBuilderFromInvoice<'a>) -> Self { + self.inner.from_invoice = Some(from_invoice); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn payment_settings( + mut self, + payment_settings: CreateInvoiceBuilderPaymentSettings<'a>, + ) -> Self { + self.inner.payment_settings = Some(payment_settings); + self + } + + pub fn pending_invoice_items_behavior( + mut self, + pending_invoice_items_behavior: CreateInvoiceBuilderPendingInvoiceItemsBehavior, + ) -> Self { + self.inner.pending_invoice_items_behavior = Some(pending_invoice_items_behavior); + self + } + + pub fn rendering(mut self, rendering: CreateInvoiceBuilderRendering) -> Self { + self.inner.rendering = Some(rendering); + self + } + + pub fn rendering_options( + mut self, + rendering_options: CreateInvoiceBuilderRenderingOptions, + ) -> Self { + self.inner.rendering_options = Some(rendering_options); + self + } + + pub fn shipping_cost(mut self, shipping_cost: CreateInvoiceBuilderShippingCost<'a>) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } + + pub fn shipping_details( + mut self, + shipping_details: RecipientShippingWithOptionalFieldsAddress<'a>, + ) -> Self { + self.inner.shipping_details = Some(shipping_details); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } +} +impl CreateInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/invoices").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListInvoiceBuilder<'a> { + /// The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. + #[serde(skip_serializing_if = "Option::is_none")] + pub collection_method: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// Only return invoices for the customer specified by this customer ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub due_date: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. + /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Only return invoices for the subscription specified by this subscription ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription: Option<&'a str>, } -impl UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions { - pub fn new(amount: i64) -> Self { - Self { amount, tax_behavior: None } +impl<'a> ListInvoiceBuilder<'a> { + pub fn new() -> Self { + Self::default() } } -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, +/// You can list all invoices, or list the invoices for a specific customer. +/// The invoices are returned sorted by creation date, with the most recently created invoices appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListInvoice<'a> { + inner: ListInvoiceBuilder<'a>, } -impl UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } +impl<'a> ListInvoice<'a> { + pub fn new() -> Self { + Self { inner: ListInvoiceBuilder::new() } + } + pub fn collection_method( + mut self, + collection_method: stripe_shared::InvoiceCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self } -} -impl std::str::FromStr - for UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -impl std::fmt::Display - for UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self } -} -impl std::fmt::Debug - for UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn due_date(mut self, due_date: stripe_types::RangeQueryTs) -> Self { + self.inner.due_date = Some(due_date); + self } -} -impl serde::Serialize - for UpdateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdateInvoiceShippingCostShippingRateDataTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateInvoiceShippingCostShippingRateDataTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self } -} -impl std::fmt::Display for UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::InvoiceStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self } } +impl ListInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } -impl std::fmt::Debug for UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for ListInvoice<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/invoices").query(&self.inner) } } -/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceShippingCostShippingRateDataType { - FixedAmount, +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveInvoiceBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, } -impl UpdateInvoiceShippingCostShippingRateDataType { - pub fn as_str(self) -> &'static str { - use UpdateInvoiceShippingCostShippingRateDataType::*; - match self { - FixedAmount => "fixed_amount", - } +impl<'a> RetrieveInvoiceBuilder<'a> { + pub fn new() -> Self { + Self::default() } } - -impl std::str::FromStr for UpdateInvoiceShippingCostShippingRateDataType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateInvoiceShippingCostShippingRateDataType::*; - match s { - "fixed_amount" => Ok(FixedAmount), - _ => Err(()), - } +/// Retrieves the invoice with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveInvoice<'a> { + inner: RetrieveInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} +impl<'a> RetrieveInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: RetrieveInvoiceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl std::fmt::Display for UpdateInvoiceShippingCostShippingRateDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl RetrieveInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for UpdateInvoiceShippingCostShippingRateDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for RetrieveInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Get, format!("/invoices/{invoice}")).query(&self.inner) } } -impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +/// Permanently deletes a one-off invoice draft. +/// This cannot be undone. +/// Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice). +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteInvoice<'a> { + invoice: &'a stripe_shared::InvoiceId, +} +impl<'a> DeleteInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice } } } -impl<'a> UpdateInvoice<'a> { - /// Draft invoices are fully editable. - /// Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),. - /// monetary values, as well as `collection_method`, become uneditable. - /// - /// If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,. - /// sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass. - /// `auto_advance=false`. - pub fn send( +impl DeleteInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteInvoice<'_> { + type Output = stripe_shared::DeletedInvoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Delete, format!("/invoices/{invoice}")) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FinalizeInvoiceInvoice<'a> { +pub struct FinalizeInvoiceInvoiceBuilder<'a> { /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. /// If `false`, the invoice's state doesn't automatically advance without an explicit action. #[serde(skip_serializing_if = "Option::is_none")] @@ -5934,145 +6284,226 @@ pub struct FinalizeInvoiceInvoice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> FinalizeInvoiceInvoice<'a> { +impl<'a> FinalizeInvoiceInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Stripe automatically finalizes drafts before sending and attempting payment on invoices. +/// However, if you’d like to finalize a draft invoice manually, you can do so using this method. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FinalizeInvoiceInvoice<'a> { + inner: FinalizeInvoiceInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} impl<'a> FinalizeInvoiceInvoice<'a> { - /// Stripe automatically finalizes drafts before sending and attempting payment on invoices. - /// However, if you’d like to finalize a draft invoice manually, you can do so using this method. - pub fn send( + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: FinalizeInvoiceInvoiceBuilder::new() } + } + pub fn auto_advance(mut self, auto_advance: bool) -> Self { + self.inner.auto_advance = Some(auto_advance); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl FinalizeInvoiceInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}/finalize"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FinalizeInvoiceInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/finalize")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct MarkUncollectibleInvoice<'a> { +pub struct SendInvoiceInvoiceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> MarkUncollectibleInvoice<'a> { +impl<'a> SendInvoiceInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> MarkUncollectibleInvoice<'a> { - /// Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes. - pub fn send( +/// Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). +/// However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. +/// When sending invoices that have already been paid, there will be no reference to the payment in the email. +/// +/// Requests made in test-mode result in no emails being sent, despite sending an `invoice.sent` event. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SendInvoiceInvoice<'a> { + inner: SendInvoiceInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} +impl<'a> SendInvoiceInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: SendInvoiceInvoiceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl SendInvoiceInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form( - &format!("/invoices/{invoice}/mark_uncollectible"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SendInvoiceInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/send")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PayInvoice<'a> { +pub struct MarkUncollectibleInvoiceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. - /// This effectively forgives the difference between the amount available on the source and the amount due. - /// - /// - /// Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the right amount. - /// An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference. - /// Defaults to `false`. - #[serde(skip_serializing_if = "Option::is_none")] - pub forgive: Option, - /// ID of the mandate to be used for this invoice. - /// It must correspond to the payment method used to pay the invoice, including the payment_method param or the invoice's default_payment_method or default_source, if set. - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate: Option<&'a str>, - /// Indicates if a customer is on or off-session while an invoice payment is attempted. - /// Defaults to `true` (off-session). - #[serde(skip_serializing_if = "Option::is_none")] - pub off_session: Option, - /// Boolean representing whether an invoice is paid outside of Stripe. - /// This will result in no charge being made. - /// Defaults to `false`. - #[serde(skip_serializing_if = "Option::is_none")] - pub paid_out_of_band: Option, - /// A PaymentMethod to be charged. - /// The PaymentMethod must be the ID of a PaymentMethod belonging to the customer associated with the invoice being paid. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method: Option<&'a str>, - /// A payment source to be charged. - /// The source must be the ID of a source belonging to the customer associated with the invoice being paid. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option<&'a str>, } -impl<'a> PayInvoice<'a> { +impl<'a> MarkUncollectibleInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> PayInvoice<'a> { - /// Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). - /// However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so. - pub fn send( +/// Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct MarkUncollectibleInvoice<'a> { + inner: MarkUncollectibleInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} +impl<'a> MarkUncollectibleInvoice<'a> { + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: MarkUncollectibleInvoiceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl MarkUncollectibleInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}/pay"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for MarkUncollectibleInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/mark_uncollectible")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct SendInvoiceInvoice<'a> { +pub struct VoidInvoiceInvoiceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> SendInvoiceInvoice<'a> { +impl<'a> VoidInvoiceInvoiceBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> SendInvoiceInvoice<'a> { - /// Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). - /// However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. - /// When sending invoices that have already been paid, there will be no reference to the payment in the email. - /// - /// Requests made in test-mode result in no emails being sent, despite sending an `invoice.sent` event. - pub fn send( - &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}/send"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Mark a finalized invoice as void. +/// This cannot be undone. +/// Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. +#[derive(Clone, Debug, serde::Serialize)] pub struct VoidInvoiceInvoice<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: VoidInvoiceInvoiceBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, } impl<'a> VoidInvoiceInvoice<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: VoidInvoiceInvoiceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> VoidInvoiceInvoice<'a> { - /// Mark a finalized invoice as void. - /// This cannot be undone. - /// Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. - pub fn send( +impl VoidInvoiceInvoice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}/void"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for VoidInvoiceInvoice<'_> { + type Output = stripe_shared::Invoice; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/void")) + .form(&self.inner) + } +} + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParam { + /// Whether Stripe automatically computes tax on this invoice. + /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. + pub enabled: bool, +} +impl AutomaticTaxParam { + pub fn new(enabled: bool) -> Self { + Self { enabled } } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -6122,9 +6553,6 @@ pub struct DiscountsDataParam<'a> { /// ID of an existing discount on the object (or one of its ancestors) to reuse. #[serde(skip_serializing_if = "Option::is_none")] pub discount: Option<&'a str>, - /// ID of the promotion code to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub promotion_code: Option<&'a str>, } impl<'a> DiscountsDataParam<'a> { pub fn new() -> Self { diff --git a/generated/stripe_billing/src/invoice_item/requests.rs b/generated/stripe_billing/src/invoice_item/requests.rs index be135e7f6..8e6033242 100644 --- a/generated/stripe_billing/src/invoice_item/requests.rs +++ b/generated/stripe_billing/src/invoice_item/requests.rs @@ -1,23 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteInvoiceItem {} -impl DeleteInvoiceItem { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteInvoiceItem { - /// Deletes an invoice item, removing it from an invoice. - /// Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice. - pub fn send( - &self, - client: &stripe::Client, - invoiceitem: &stripe_shared::InvoiceItemId, - ) -> stripe::Response { - client.send_form(&format!("/invoiceitems/{invoiceitem}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListInvoiceItem<'a> { +pub struct ListInvoiceItemBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// The identifier of the customer whose invoice items to return. @@ -52,47 +38,86 @@ pub struct ListInvoiceItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListInvoiceItem<'a> { +impl<'a> ListInvoiceItemBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your invoice items. +/// Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListInvoiceItem<'a> { + inner: ListInvoiceItemBuilder<'a>, +} impl<'a> ListInvoiceItem<'a> { - /// Returns a list of your invoice items. - /// Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/invoiceitems", self) + pub fn new() -> Self { + Self { inner: ListInvoiceItemBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/invoiceitems", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveInvoiceItem<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveInvoiceItem<'a> { - pub fn new() -> Self { - Self::default() + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice(mut self, invoice: &'a str) -> Self { + self.inner.invoice = Some(invoice); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn pending(mut self, pending: bool) -> Self { + self.inner.pending = Some(pending); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveInvoiceItem<'a> { - /// Retrieves the invoice item with the given ID. - pub fn send( +impl ListInvoiceItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - invoiceitem: &stripe_shared::InvoiceItemId, - ) -> stripe::Response { - client.get_query(&format!("/invoiceitems/{invoiceitem}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListInvoiceItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/invoiceitems").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceItem<'a> { +pub struct CreateInvoiceItemBuilder<'a> { /// The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. /// Passing in a negative `amount` will reduce the `amount_due` on the invoice. #[serde(skip_serializing_if = "Option::is_none")] @@ -140,7 +165,7 @@ pub struct CreateInvoiceItem<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Non-negative integer. The quantity of units for the invoice item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -155,7 +180,7 @@ pub struct CreateInvoiceItem<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, @@ -173,7 +198,7 @@ pub struct CreateInvoiceItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateInvoiceItem<'a> { +impl<'a> CreateInvoiceItemBuilder<'a> { pub fn new(customer: &'a str) -> Self { Self { amount: None, @@ -200,7 +225,7 @@ impl<'a> CreateInvoiceItem<'a> { } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceItemPriceData<'a> { +pub struct CreateInvoiceItemBuilderPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -211,7 +236,7 @@ pub struct CreateInvoiceItemPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -220,7 +245,7 @@ pub struct CreateInvoiceItemPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateInvoiceItemPriceData<'a> { +impl<'a> CreateInvoiceItemBuilderPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -230,14 +255,14 @@ impl<'a> CreateInvoiceItemPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceItemPriceDataTaxBehavior { +pub enum CreateInvoiceItemBuilderPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateInvoiceItemPriceDataTaxBehavior { +impl CreateInvoiceItemBuilderPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceItemPriceDataTaxBehavior::*; + use CreateInvoiceItemBuilderPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -246,10 +271,10 @@ impl CreateInvoiceItemPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateInvoiceItemPriceDataTaxBehavior { +impl std::str::FromStr for CreateInvoiceItemBuilderPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceItemPriceDataTaxBehavior::*; + use CreateInvoiceItemBuilderPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -258,18 +283,18 @@ impl std::str::FromStr for CreateInvoiceItemPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateInvoiceItemPriceDataTaxBehavior { +impl std::fmt::Display for CreateInvoiceItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceItemPriceDataTaxBehavior { +impl std::fmt::Debug for CreateInvoiceItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceItemPriceDataTaxBehavior { +impl serde::Serialize for CreateInvoiceItemBuilderPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -282,14 +307,14 @@ impl serde::Serialize for CreateInvoiceItemPriceDataTaxBehavior { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceItemTaxBehavior { +pub enum CreateInvoiceItemBuilderTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateInvoiceItemTaxBehavior { +impl CreateInvoiceItemBuilderTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateInvoiceItemTaxBehavior::*; + use CreateInvoiceItemBuilderTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -298,10 +323,10 @@ impl CreateInvoiceItemTaxBehavior { } } -impl std::str::FromStr for CreateInvoiceItemTaxBehavior { +impl std::str::FromStr for CreateInvoiceItemBuilderTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateInvoiceItemTaxBehavior::*; + use CreateInvoiceItemBuilderTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -310,18 +335,18 @@ impl std::str::FromStr for CreateInvoiceItemTaxBehavior { } } } -impl std::fmt::Display for CreateInvoiceItemTaxBehavior { +impl std::fmt::Display for CreateInvoiceItemBuilderTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateInvoiceItemTaxBehavior { +impl std::fmt::Debug for CreateInvoiceItemBuilderTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateInvoiceItemTaxBehavior { +impl serde::Serialize for CreateInvoiceItemBuilderTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -329,15 +354,182 @@ impl serde::Serialize for CreateInvoiceItemTaxBehavior { serializer.serialize_str(self.as_str()) } } +/// Creates an item to be added to a draft invoice (up to 250 items per invoice). +/// If no invoice is specified, the item will be on the next invoice created for the customer specified. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateInvoiceItem<'a> { + inner: CreateInvoiceItemBuilder<'a>, +} impl<'a> CreateInvoiceItem<'a> { - /// Creates an item to be added to a draft invoice (up to 250 items per invoice). - /// If no invoice is specified, the item will be on the next invoice created for the customer specified. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/invoiceitems", self, http_types::Method::Post) + pub fn new(customer: &'a str) -> Self { + Self { inner: CreateInvoiceItemBuilder::new(customer) } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discountable(mut self, discountable: bool) -> Self { + self.inner.discountable = Some(discountable); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice(mut self, invoice: &'a str) -> Self { + self.inner.invoice = Some(invoice); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn period(mut self, period: Period) -> Self { + self.inner.period = Some(period); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn price_data(mut self, price_data: CreateInvoiceItemBuilderPriceData<'a>) -> Self { + self.inner.price_data = Some(price_data); + self + } + + pub fn quantity(mut self, quantity: u64) -> Self { + self.inner.quantity = Some(quantity); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self + } + + pub fn tax_behavior(mut self, tax_behavior: CreateInvoiceItemBuilderTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } + + pub fn tax_code(mut self, tax_code: &'a str) -> Self { + self.inner.tax_code = Some(tax_code); + self + } + + pub fn tax_rates(mut self, tax_rates: &'a [&'a str]) -> Self { + self.inner.tax_rates = Some(tax_rates); + self + } + + pub fn unit_amount(mut self, unit_amount: i64) -> Self { + self.inner.unit_amount = Some(unit_amount); + self + } + + pub fn unit_amount_decimal(mut self, unit_amount_decimal: &'a str) -> Self { + self.inner.unit_amount_decimal = Some(unit_amount_decimal); + self + } +} +impl CreateInvoiceItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateInvoiceItem<'_> { + type Output = stripe_shared::InvoiceItem; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/invoiceitems").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceItem<'a> { +pub struct RetrieveInvoiceItemBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveInvoiceItemBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the invoice item with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveInvoiceItem<'a> { + inner: RetrieveInvoiceItemBuilder<'a>, + invoiceitem: &'a stripe_shared::InvoiceItemId, +} +impl<'a> RetrieveInvoiceItem<'a> { + pub fn new(invoiceitem: &'a stripe_shared::InvoiceItemId) -> Self { + Self { invoiceitem, inner: RetrieveInvoiceItemBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveInvoiceItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveInvoiceItem<'_> { + type Output = stripe_shared::InvoiceItem; + + fn build(&self) -> RequestBuilder { + let invoiceitem = self.invoiceitem; + RequestBuilder::new(StripeMethod::Get, format!("/invoiceitems/{invoiceitem}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateInvoiceItemBuilder<'a> { /// The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. /// If you want to apply a credit to the customer's account, pass a negative amount. #[serde(skip_serializing_if = "Option::is_none")] @@ -376,7 +568,7 @@ pub struct UpdateInvoiceItem<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Non-negative integer. The quantity of units for the invoice item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -385,7 +577,7 @@ pub struct UpdateInvoiceItem<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, @@ -404,14 +596,14 @@ pub struct UpdateInvoiceItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateInvoiceItem<'a> { +impl<'a> UpdateInvoiceItemBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceItemPriceData<'a> { +pub struct UpdateInvoiceItemBuilderPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -422,7 +614,7 @@ pub struct UpdateInvoiceItemPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -431,7 +623,7 @@ pub struct UpdateInvoiceItemPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateInvoiceItemPriceData<'a> { +impl<'a> UpdateInvoiceItemBuilderPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -441,14 +633,14 @@ impl<'a> UpdateInvoiceItemPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceItemPriceDataTaxBehavior { +pub enum UpdateInvoiceItemBuilderPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateInvoiceItemPriceDataTaxBehavior { +impl UpdateInvoiceItemBuilderPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateInvoiceItemPriceDataTaxBehavior::*; + use UpdateInvoiceItemBuilderPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -457,10 +649,10 @@ impl UpdateInvoiceItemPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateInvoiceItemPriceDataTaxBehavior { +impl std::str::FromStr for UpdateInvoiceItemBuilderPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceItemPriceDataTaxBehavior::*; + use UpdateInvoiceItemBuilderPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -469,18 +661,18 @@ impl std::str::FromStr for UpdateInvoiceItemPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpdateInvoiceItemPriceDataTaxBehavior { +impl std::fmt::Display for UpdateInvoiceItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceItemPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateInvoiceItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceItemPriceDataTaxBehavior { +impl serde::Serialize for UpdateInvoiceItemBuilderPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -493,14 +685,14 @@ impl serde::Serialize for UpdateInvoiceItemPriceDataTaxBehavior { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceItemTaxBehavior { +pub enum UpdateInvoiceItemBuilderTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateInvoiceItemTaxBehavior { +impl UpdateInvoiceItemBuilderTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateInvoiceItemTaxBehavior::*; + use UpdateInvoiceItemBuilderTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -509,10 +701,10 @@ impl UpdateInvoiceItemTaxBehavior { } } -impl std::str::FromStr for UpdateInvoiceItemTaxBehavior { +impl std::str::FromStr for UpdateInvoiceItemBuilderTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceItemTaxBehavior::*; + use UpdateInvoiceItemBuilderTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -521,18 +713,18 @@ impl std::str::FromStr for UpdateInvoiceItemTaxBehavior { } } } -impl std::fmt::Display for UpdateInvoiceItemTaxBehavior { +impl std::fmt::Display for UpdateInvoiceItemBuilderTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceItemTaxBehavior { +impl std::fmt::Debug for UpdateInvoiceItemBuilderTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceItemTaxBehavior { +impl serde::Serialize for UpdateInvoiceItemBuilderTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -540,17 +732,153 @@ impl serde::Serialize for UpdateInvoiceItemTaxBehavior { serializer.serialize_str(self.as_str()) } } +/// Updates the amount or description of an invoice item on an upcoming invoice. +/// Updating an invoice item is only possible before the invoice it’s attached to is closed. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceItem<'a> { + inner: UpdateInvoiceItemBuilder<'a>, + invoiceitem: &'a stripe_shared::InvoiceItemId, +} impl<'a> UpdateInvoiceItem<'a> { - /// Updates the amount or description of an invoice item on an upcoming invoice. - /// Updating an invoice item is only possible before the invoice it’s attached to is closed. - pub fn send( + pub fn new(invoiceitem: &'a stripe_shared::InvoiceItemId) -> Self { + Self { invoiceitem, inner: UpdateInvoiceItemBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discountable(mut self, discountable: bool) -> Self { + self.inner.discountable = Some(discountable); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn period(mut self, period: Period) -> Self { + self.inner.period = Some(period); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn price_data(mut self, price_data: UpdateInvoiceItemBuilderPriceData<'a>) -> Self { + self.inner.price_data = Some(price_data); + self + } + + pub fn quantity(mut self, quantity: u64) -> Self { + self.inner.quantity = Some(quantity); + self + } + + pub fn tax_behavior(mut self, tax_behavior: UpdateInvoiceItemBuilderTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } + + pub fn tax_code(mut self, tax_code: &'a str) -> Self { + self.inner.tax_code = Some(tax_code); + self + } + + pub fn tax_rates(mut self, tax_rates: &'a [&'a str]) -> Self { + self.inner.tax_rates = Some(tax_rates); + self + } + + pub fn unit_amount(mut self, unit_amount: i64) -> Self { + self.inner.unit_amount = Some(unit_amount); + self + } + + pub fn unit_amount_decimal(mut self, unit_amount_decimal: &'a str) -> Self { + self.inner.unit_amount_decimal = Some(unit_amount_decimal); + self + } +} +impl UpdateInvoiceItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateInvoiceItem<'_> { + type Output = stripe_shared::InvoiceItem; + + fn build(&self) -> RequestBuilder { + let invoiceitem = self.invoiceitem; + RequestBuilder::new(StripeMethod::Post, format!("/invoiceitems/{invoiceitem}")) + .form(&self.inner) + } +} +/// Deletes an invoice item, removing it from an invoice. +/// Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteInvoiceItem<'a> { + invoiceitem: &'a stripe_shared::InvoiceItemId, +} +impl<'a> DeleteInvoiceItem<'a> { + pub fn new(invoiceitem: &'a stripe_shared::InvoiceItemId) -> Self { + Self { invoiceitem } + } +} +impl DeleteInvoiceItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - invoiceitem: &stripe_shared::InvoiceItemId, - ) -> stripe::Response { - client.send_form(&format!("/invoiceitems/{invoiceitem}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for DeleteInvoiceItem<'_> { + type Output = stripe_shared::DeletedInvoiceitem; + + fn build(&self) -> RequestBuilder { + let invoiceitem = self.invoiceitem; + RequestBuilder::new(StripeMethod::Delete, format!("/invoiceitems/{invoiceitem}")) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct DiscountsDataParam<'a> { /// ID of the coupon to create a new discount for. diff --git a/generated/stripe_billing/src/invoice_line_item/requests.rs b/generated/stripe_billing/src/invoice_line_item/requests.rs index 0ea7ef846..876749c65 100644 --- a/generated/stripe_billing/src/invoice_line_item/requests.rs +++ b/generated/stripe_billing/src/invoice_line_item/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListInvoiceInvoiceLineItem<'a> { +pub struct ListInvoiceInvoiceLineItemBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,30 +22,69 @@ pub struct ListInvoiceInvoiceLineItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListInvoiceInvoiceLineItem<'a> { +impl<'a> ListInvoiceInvoiceLineItemBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// When retrieving an invoice, you’ll get a **lines** property containing the total count of line items and the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListInvoiceInvoiceLineItem<'a> { + inner: ListInvoiceInvoiceLineItemBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, +} impl<'a> ListInvoiceInvoiceLineItem<'a> { - /// When retrieving an invoice, you’ll get a **lines** property containing the total count of line items and the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( + pub fn new(invoice: &'a stripe_shared::InvoiceId) -> Self { + Self { invoice, inner: ListInvoiceInvoiceLineItemBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListInvoiceInvoiceLineItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response> { - client.get_query(&format!("/invoices/{invoice}/lines"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/invoices/{invoice}/lines"), self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListInvoiceInvoiceLineItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + RequestBuilder::new(StripeMethod::Get, format!("/invoices/{invoice}/lines")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceLineItem<'a> { +pub struct UpdateInvoiceLineItemBuilder<'a> { /// The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. /// If you want to apply a credit to the customer's account, pass a negative amount. #[serde(skip_serializing_if = "Option::is_none")] @@ -59,7 +102,7 @@ pub struct UpdateInvoiceLineItem<'a> { /// Item discounts are applied before invoice discounts. /// Pass an empty string to remove previously-defined discounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpdateInvoiceLineItemDiscounts<'a>]>, + pub discounts: Option<&'a [UpdateInvoiceLineItemBuilderDiscounts<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -74,13 +117,13 @@ pub struct UpdateInvoiceLineItem<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, + pub period: Option, /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Non-negative integer. The quantity of units for the line item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -89,14 +132,14 @@ pub struct UpdateInvoiceLineItem<'a> { /// You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). /// Pass an empty string to remove previously defined tax amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_amounts: Option<&'a [UpdateInvoiceLineItemTaxAmounts<'a>]>, + pub tax_amounts: Option<&'a [UpdateInvoiceLineItemBuilderTaxAmounts<'a>]>, /// The tax rates which apply to the line item. /// When set, the `default_tax_rates` on the invoice do not apply to this line item. /// Pass an empty string to remove previously-defined tax rates. #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateInvoiceLineItem<'a> { +impl<'a> UpdateInvoiceLineItemBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -105,7 +148,7 @@ impl<'a> UpdateInvoiceLineItem<'a> { /// Item discounts are applied before invoice discounts. /// Pass an empty string to remove previously-defined discounts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceLineItemDiscounts<'a> { +pub struct UpdateInvoiceLineItemBuilderDiscounts<'a> { /// ID of the coupon to create a new discount for. #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, @@ -113,7 +156,7 @@ pub struct UpdateInvoiceLineItemDiscounts<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub discount: Option<&'a str>, } -impl<'a> UpdateInvoiceLineItemDiscounts<'a> { +impl<'a> UpdateInvoiceLineItemBuilderDiscounts<'a> { pub fn new() -> Self { Self::default() } @@ -123,20 +166,20 @@ impl<'a> UpdateInvoiceLineItemDiscounts<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceLineItemPeriod { +pub struct UpdateInvoiceLineItemBuilderPeriod { /// The end of the period, which must be greater than or equal to the start. This value is inclusive. pub end: stripe_types::Timestamp, /// The start of the period. This value is inclusive. pub start: stripe_types::Timestamp, } -impl UpdateInvoiceLineItemPeriod { +impl UpdateInvoiceLineItemBuilderPeriod { pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { Self { end, start } } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceLineItemPriceData<'a> { +pub struct UpdateInvoiceLineItemBuilderPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -146,13 +189,13 @@ pub struct UpdateInvoiceLineItemPriceData<'a> { pub product: Option<&'a str>, /// Data used to generate a new product object inline. One of `product` or `product_data` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub product_data: Option>, + pub product_data: Option>, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A non-negative integer in cents (or local equivalent) representing how much to charge. /// One of `unit_amount` or `unit_amount_decimal` is required. #[serde(skip_serializing_if = "Option::is_none")] @@ -162,7 +205,7 @@ pub struct UpdateInvoiceLineItemPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateInvoiceLineItemPriceData<'a> { +impl<'a> UpdateInvoiceLineItemBuilderPriceData<'a> { pub fn new(currency: stripe_types::Currency) -> Self { Self { currency, @@ -176,7 +219,7 @@ impl<'a> UpdateInvoiceLineItemPriceData<'a> { } /// Data used to generate a new product object inline. One of `product` or `product_data` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceLineItemPriceDataProductData<'a> { +pub struct UpdateInvoiceLineItemBuilderPriceDataProductData<'a> { /// The product's description, meant to be displayable to the customer. /// Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. #[serde(skip_serializing_if = "Option::is_none")] @@ -196,7 +239,7 @@ pub struct UpdateInvoiceLineItemPriceDataProductData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, } -impl<'a> UpdateInvoiceLineItemPriceDataProductData<'a> { +impl<'a> UpdateInvoiceLineItemBuilderPriceDataProductData<'a> { pub fn new(name: &'a str) -> Self { Self { description: None, images: None, metadata: None, name, tax_code: None } } @@ -206,14 +249,14 @@ impl<'a> UpdateInvoiceLineItemPriceDataProductData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceLineItemPriceDataTaxBehavior { +pub enum UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateInvoiceLineItemPriceDataTaxBehavior { +impl UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateInvoiceLineItemPriceDataTaxBehavior::*; + use UpdateInvoiceLineItemBuilderPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -222,10 +265,10 @@ impl UpdateInvoiceLineItemPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateInvoiceLineItemPriceDataTaxBehavior { +impl std::str::FromStr for UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceLineItemPriceDataTaxBehavior::*; + use UpdateInvoiceLineItemBuilderPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -234,18 +277,18 @@ impl std::str::FromStr for UpdateInvoiceLineItemPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpdateInvoiceLineItemPriceDataTaxBehavior { +impl std::fmt::Display for UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceLineItemPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceLineItemPriceDataTaxBehavior { +impl serde::Serialize for UpdateInvoiceLineItemBuilderPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -258,7 +301,7 @@ impl serde::Serialize for UpdateInvoiceLineItemPriceDataTaxBehavior { /// You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). /// Pass an empty string to remove previously defined tax amounts. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceLineItemTaxAmounts<'a> { +pub struct UpdateInvoiceLineItemBuilderTaxAmounts<'a> { /// The amount, in cents (or local equivalent), of the tax. pub amount: i64, /// Data to find or create a TaxRate object. @@ -266,14 +309,14 @@ pub struct UpdateInvoiceLineItemTaxAmounts<'a> { /// Stripe automatically creates or reuses a TaxRate object for each tax amount. /// If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. /// TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item’s `tax_rates`, and cannot be directly added to invoices, payments, or line items. - pub tax_rate_data: UpdateInvoiceLineItemTaxAmountsTaxRateData<'a>, + pub tax_rate_data: UpdateInvoiceLineItemBuilderTaxAmountsTaxRateData<'a>, /// The amount on which tax is calculated, in cents (or local equivalent). pub taxable_amount: i64, } -impl<'a> UpdateInvoiceLineItemTaxAmounts<'a> { +impl<'a> UpdateInvoiceLineItemBuilderTaxAmounts<'a> { pub fn new( amount: i64, - tax_rate_data: UpdateInvoiceLineItemTaxAmountsTaxRateData<'a>, + tax_rate_data: UpdateInvoiceLineItemBuilderTaxAmountsTaxRateData<'a>, taxable_amount: i64, ) -> Self { Self { amount, tax_rate_data, taxable_amount } @@ -285,7 +328,7 @@ impl<'a> UpdateInvoiceLineItemTaxAmounts<'a> { /// If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. /// TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item’s `tax_rates`, and cannot be directly added to invoices, payments, or line items. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceLineItemTaxAmountsTaxRateData<'a> { +pub struct UpdateInvoiceLineItemBuilderTaxAmountsTaxRateData<'a> { /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] pub country: Option<&'a str>, @@ -313,9 +356,9 @@ pub struct UpdateInvoiceLineItemTaxAmountsTaxRateData<'a> { pub state: Option<&'a str>, /// The high-level tax type, such as `vat` or `sales_tax`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_type: Option, + pub tax_type: Option, } -impl<'a> UpdateInvoiceLineItemTaxAmountsTaxRateData<'a> { +impl<'a> UpdateInvoiceLineItemBuilderTaxAmountsTaxRateData<'a> { pub fn new(display_name: &'a str, inclusive: bool, percentage: f64) -> Self { Self { country: None, @@ -332,7 +375,7 @@ impl<'a> UpdateInvoiceLineItemTaxAmountsTaxRateData<'a> { /// The high-level tax type, such as `vat` or `sales_tax`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +pub enum UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { AmusementTax, CommunicationsTax, Gst, @@ -349,9 +392,9 @@ pub enum UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +impl UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { pub fn as_str(self) -> &'static str { - use UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType::*; + use UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType::*; match self { AmusementTax => "amusement_tax", CommunicationsTax => "communications_tax", @@ -371,10 +414,10 @@ impl UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { } } -impl std::str::FromStr for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +impl std::str::FromStr for UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType::*; + use UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType::*; match s { "amusement_tax" => Ok(AmusementTax), "communications_tax" => Ok(CommunicationsTax), @@ -393,18 +436,18 @@ impl std::str::FromStr for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { } } } -impl std::fmt::Display for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +impl std::fmt::Display for UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +impl std::fmt::Debug for UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { +impl serde::Serialize for UpdateInvoiceLineItemBuilderTaxAmountsTaxRateDataTaxType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -412,23 +455,108 @@ impl serde::Serialize for UpdateInvoiceLineItemTaxAmountsTaxRateDataTaxType { serializer.serialize_str(self.as_str()) } } +/// Updates an invoice’s line item. +/// Some fields, such as `tax_amounts`, only live on the invoice line item,. +/// so they can only be updated through this endpoint. +/// Other fields, such as `amount`, live on both the invoice. +/// item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. +/// Updating an invoice’s line item is only possible before the invoice is finalized. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateInvoiceLineItem<'a> { + inner: UpdateInvoiceLineItemBuilder<'a>, + invoice: &'a stripe_shared::InvoiceId, + line_item_id: &'a str, +} impl<'a> UpdateInvoiceLineItem<'a> { - /// Updates an invoice’s line item. - /// Some fields, such as `tax_amounts`, only live on the invoice line item,. - /// so they can only be updated through this endpoint. - /// Other fields, such as `amount`, live on both the invoice. - /// item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. - /// Updating an invoice’s line item is only possible before the invoice is finalized. - pub fn send( + pub fn new(invoice: &'a stripe_shared::InvoiceId, line_item_id: &'a str) -> Self { + Self { invoice, line_item_id, inner: UpdateInvoiceLineItemBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discountable(mut self, discountable: bool) -> Self { + self.inner.discountable = Some(discountable); + self + } + + pub fn discounts(mut self, discounts: &'a [UpdateInvoiceLineItemBuilderDiscounts<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn period(mut self, period: UpdateInvoiceLineItemBuilderPeriod) -> Self { + self.inner.period = Some(period); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn price_data(mut self, price_data: UpdateInvoiceLineItemBuilderPriceData<'a>) -> Self { + self.inner.price_data = Some(price_data); + self + } + + pub fn quantity(mut self, quantity: u64) -> Self { + self.inner.quantity = Some(quantity); + self + } + + pub fn tax_amounts( + mut self, + tax_amounts: &'a [UpdateInvoiceLineItemBuilderTaxAmounts<'a>], + ) -> Self { + self.inner.tax_amounts = Some(tax_amounts); + self + } + + pub fn tax_rates(mut self, tax_rates: &'a [&'a str]) -> Self { + self.inner.tax_rates = Some(tax_rates); + self + } +} +impl UpdateInvoiceLineItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - line_item_id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/invoices/{invoice}/lines/{line_item_id}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateInvoiceLineItem<'_> { + type Output = stripe_shared::InvoiceLineItem; + + fn build(&self) -> RequestBuilder { + let invoice = self.invoice; + let line_item_id = self.line_item_id; + RequestBuilder::new(StripeMethod::Post, format!("/invoices/{invoice}/lines/{line_item_id}")) + .form(&self.inner) } } diff --git a/generated/stripe_billing/src/mod.rs b/generated/stripe_billing/src/mod.rs index 354f802ff..3e249c009 100644 --- a/generated/stripe_billing/src/mod.rs +++ b/generated/stripe_billing/src/mod.rs @@ -165,12 +165,10 @@ pub use stripe_shared::subscription_schedule_phase_configuration::*; pub use stripe_shared::subscription_schedules_resource_default_settings::*; pub use stripe_shared::subscription_schedules_resource_default_settings_automatic_tax::*; pub use stripe_shared::subscription_transfer_data::*; -pub use stripe_shared::subscriptions_resource_billing_cycle_anchor_config::*; pub use stripe_shared::subscriptions_resource_pause_collection::*; pub use stripe_shared::subscriptions_resource_payment_method_options::*; pub use stripe_shared::subscriptions_resource_payment_settings::*; pub use stripe_shared::subscriptions_resource_pending_update::*; -pub use stripe_shared::tax_i_ds_owner::*; pub mod tax_id; pub use stripe_shared::tax_id::*; pub use stripe_shared::tax_id_verification::*; diff --git a/generated/stripe_billing/src/plan/requests.rs b/generated/stripe_billing/src/plan/requests.rs index c2394c9db..d3618e83d 100644 --- a/generated/stripe_billing/src/plan/requests.rs +++ b/generated/stripe_billing/src/plan/requests.rs @@ -1,22 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeletePlan {} -impl DeletePlan { - pub fn new() -> Self { - Self::default() - } -} -impl DeletePlan { - /// Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. - pub fn send( - &self, - client: &stripe::Client, - plan: &stripe_shared::PlanId, - ) -> stripe::Response { - client.send_form(&format!("/plans/{plan}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPlan<'a> { +pub struct ListPlanBuilder<'a> { /// Only return plans that are active or inactive (e.g., pass `false` to list all inactive plans). #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -45,46 +32,80 @@ pub struct ListPlan<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListPlan<'a> { +impl<'a> ListPlanBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your plans. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPlan<'a> { + inner: ListPlanBuilder<'a>, +} impl<'a> ListPlan<'a> { - /// Returns a list of your plans. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/plans", self) + pub fn new() -> Self { + Self { inner: ListPlanBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/plans", self) + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePlan<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePlan<'a> { - pub fn new() -> Self { - Self::default() + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn product(mut self, product: &'a str) -> Self { + self.inner.product = Some(product); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrievePlan<'a> { - /// Retrieves the plan with the given ID. - pub fn send( +impl ListPlan<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - plan: &stripe_shared::PlanId, - ) -> stripe::Response { - client.get_query(&format!("/plans/{plan}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPlan<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/plans").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePlan<'a> { +pub struct CreatePlanBuilder<'a> { /// Whether the plan is currently available for new subscriptions. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -122,7 +143,7 @@ pub struct CreatePlan<'a> { pub interval: stripe_shared::PlanInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. @@ -135,12 +156,12 @@ pub struct CreatePlan<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub nickname: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] - pub product: Option>, + pub product: Option>, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers: Option<&'a [CreatePlanTiers<'a>]>, + pub tiers: Option<&'a [CreatePlanBuilderTiers<'a>]>, /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. #[serde(skip_serializing_if = "Option::is_none")] @@ -148,7 +169,7 @@ pub struct CreatePlan<'a> { /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[serde(skip_serializing_if = "Option::is_none")] - pub transform_usage: Option, + pub transform_usage: Option, /// Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). #[serde(skip_serializing_if = "Option::is_none")] pub trial_period_days: Option, @@ -160,7 +181,7 @@ pub struct CreatePlan<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub usage_type: Option, } -impl<'a> CreatePlan<'a> { +impl<'a> CreatePlanBuilder<'a> { pub fn new(currency: stripe_types::Currency, interval: stripe_shared::PlanInterval) -> Self { Self { active: None, @@ -186,12 +207,12 @@ impl<'a> CreatePlan<'a> { } #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePlanProduct<'a> { - InlineProductParams(CreatePlanInlineProductParams<'a>), +pub enum CreatePlanBuilderProduct<'a> { + InlineProductParams(CreatePlanBuilderInlineProductParams<'a>), Id(&'a str), } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePlanInlineProductParams<'a> { +pub struct CreatePlanBuilderInlineProductParams<'a> { /// Whether the product is currently available for purchase. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -224,7 +245,7 @@ pub struct CreatePlanInlineProductParams<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_label: Option<&'a str>, } -impl<'a> CreatePlanInlineProductParams<'a> { +impl<'a> CreatePlanBuilderInlineProductParams<'a> { pub fn new(name: &'a str) -> Self { Self { active: None, @@ -241,7 +262,7 @@ impl<'a> CreatePlanInlineProductParams<'a> { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePlanTiers<'a> { +pub struct CreatePlanBuilderTiers<'a> { /// The flat billing amount for an entire tier, regardless of the number of units in the tier. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, @@ -259,10 +280,10 @@ pub struct CreatePlanTiers<'a> { /// Specifies the upper bound of this tier. /// The lower bound of a tier is the upper bound of the previous tier adding one. /// Use `inf` to define a fallback tier. - pub up_to: CreatePlanTiersUpTo, + pub up_to: CreatePlanBuilderTiersUpTo, } -impl<'a> CreatePlanTiers<'a> { - pub fn new(up_to: CreatePlanTiersUpTo) -> Self { +impl<'a> CreatePlanBuilderTiers<'a> { + pub fn new(up_to: CreatePlanBuilderTiersUpTo) -> Self { Self { flat_amount: None, flat_amount_decimal: None, @@ -277,33 +298,33 @@ impl<'a> CreatePlanTiers<'a> { /// Use `inf` to define a fallback tier. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePlanTiersUpTo { +pub enum CreatePlanBuilderTiersUpTo { Inf, I64(i64), } /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePlanTransformUsage { +pub struct CreatePlanBuilderTransformUsage { /// Divide usage by this number. pub divide_by: i64, /// After division, either round the result `up` or `down`. - pub round: CreatePlanTransformUsageRound, + pub round: CreatePlanBuilderTransformUsageRound, } -impl CreatePlanTransformUsage { - pub fn new(divide_by: i64, round: CreatePlanTransformUsageRound) -> Self { +impl CreatePlanBuilderTransformUsage { + pub fn new(divide_by: i64, round: CreatePlanBuilderTransformUsageRound) -> Self { Self { divide_by, round } } } /// After division, either round the result `up` or `down`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanTransformUsageRound { +pub enum CreatePlanBuilderTransformUsageRound { Down, Up, } -impl CreatePlanTransformUsageRound { +impl CreatePlanBuilderTransformUsageRound { pub fn as_str(self) -> &'static str { - use CreatePlanTransformUsageRound::*; + use CreatePlanBuilderTransformUsageRound::*; match self { Down => "down", Up => "up", @@ -311,10 +332,10 @@ impl CreatePlanTransformUsageRound { } } -impl std::str::FromStr for CreatePlanTransformUsageRound { +impl std::str::FromStr for CreatePlanBuilderTransformUsageRound { type Err = (); fn from_str(s: &str) -> Result { - use CreatePlanTransformUsageRound::*; + use CreatePlanBuilderTransformUsageRound::*; match s { "down" => Ok(Down), "up" => Ok(Up), @@ -322,18 +343,18 @@ impl std::str::FromStr for CreatePlanTransformUsageRound { } } } -impl std::fmt::Display for CreatePlanTransformUsageRound { +impl std::fmt::Display for CreatePlanBuilderTransformUsageRound { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePlanTransformUsageRound { +impl std::fmt::Debug for CreatePlanBuilderTransformUsageRound { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePlanTransformUsageRound { +impl serde::Serialize for CreatePlanBuilderTransformUsageRound { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -341,15 +362,171 @@ impl serde::Serialize for CreatePlanTransformUsageRound { serializer.serialize_str(self.as_str()) } } +/// You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). +/// It replaces the Plans API and is backwards compatible to simplify your migration. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePlan<'a> { + inner: CreatePlanBuilder<'a>, +} impl<'a> CreatePlan<'a> { - /// You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). - /// It replaces the Plans API and is backwards compatible to simplify your migration. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/plans", self, http_types::Method::Post) + pub fn new(currency: stripe_types::Currency, interval: stripe_shared::PlanInterval) -> Self { + Self { inner: CreatePlanBuilder::new(currency, interval) } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn aggregate_usage(mut self, aggregate_usage: stripe_shared::PlanAggregateUsage) -> Self { + self.inner.aggregate_usage = Some(aggregate_usage); + self + } + + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn amount_decimal(mut self, amount_decimal: &'a str) -> Self { + self.inner.amount_decimal = Some(amount_decimal); + self + } + + pub fn billing_scheme(mut self, billing_scheme: stripe_shared::PlanBillingScheme) -> Self { + self.inner.billing_scheme = Some(billing_scheme); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn id(mut self, id: &'a str) -> Self { + self.inner.id = Some(id); + self + } + + pub fn interval_count(mut self, interval_count: u64) -> Self { + self.inner.interval_count = Some(interval_count); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nickname(mut self, nickname: &'a str) -> Self { + self.inner.nickname = Some(nickname); + self + } + + pub fn product(mut self, product: CreatePlanBuilderProduct<'a>) -> Self { + self.inner.product = Some(product); + self + } + + pub fn tiers(mut self, tiers: &'a [CreatePlanBuilderTiers<'a>]) -> Self { + self.inner.tiers = Some(tiers); + self + } + + pub fn tiers_mode(mut self, tiers_mode: stripe_shared::PlanTiersMode) -> Self { + self.inner.tiers_mode = Some(tiers_mode); + self + } + + pub fn transform_usage(mut self, transform_usage: CreatePlanBuilderTransformUsage) -> Self { + self.inner.transform_usage = Some(transform_usage); + self + } + + pub fn trial_period_days(mut self, trial_period_days: u32) -> Self { + self.inner.trial_period_days = Some(trial_period_days); + self + } + + pub fn usage_type(mut self, usage_type: stripe_shared::PlanUsageType) -> Self { + self.inner.usage_type = Some(usage_type); + self + } +} +impl CreatePlan<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePlan<'_> { + type Output = stripe_shared::Plan; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/plans").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePlan<'a> { +pub struct RetrievePlanBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePlanBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the plan with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePlan<'a> { + inner: RetrievePlanBuilder<'a>, + plan: &'a stripe_shared::PlanId, +} +impl<'a> RetrievePlan<'a> { + pub fn new(plan: &'a stripe_shared::PlanId) -> Self { + Self { plan, inner: RetrievePlanBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePlan<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePlan<'_> { + type Output = stripe_shared::Plan; + + fn build(&self) -> RequestBuilder { + let plan = self.plan; + RequestBuilder::new(StripeMethod::Get, format!("/plans/{plan}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePlanBuilder<'a> { /// Whether the plan is currently available for new subscriptions. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -373,20 +550,108 @@ pub struct UpdatePlan<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub trial_period_days: Option, } -impl<'a> UpdatePlan<'a> { +impl<'a> UpdatePlanBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified plan by setting the values of the parameters passed. +/// Any parameters not provided are left unchanged. +/// By design, you cannot change a plan’s ID, amount, currency, or billing cycle. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePlan<'a> { + inner: UpdatePlanBuilder<'a>, + plan: &'a stripe_shared::PlanId, +} impl<'a> UpdatePlan<'a> { - /// Updates the specified plan by setting the values of the parameters passed. - /// Any parameters not provided are left unchanged. - /// By design, you cannot change a plan’s ID, amount, currency, or billing cycle. - pub fn send( + pub fn new(plan: &'a stripe_shared::PlanId) -> Self { + Self { plan, inner: UpdatePlanBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nickname(mut self, nickname: &'a str) -> Self { + self.inner.nickname = Some(nickname); + self + } + + pub fn product(mut self, product: &'a str) -> Self { + self.inner.product = Some(product); + self + } + + pub fn trial_period_days(mut self, trial_period_days: u32) -> Self { + self.inner.trial_period_days = Some(trial_period_days); + self + } +} +impl UpdatePlan<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - plan: &stripe_shared::PlanId, - ) -> stripe::Response { - client.send_form(&format!("/plans/{plan}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePlan<'_> { + type Output = stripe_shared::Plan; + + fn build(&self) -> RequestBuilder { + let plan = self.plan; + RequestBuilder::new(StripeMethod::Post, format!("/plans/{plan}")).form(&self.inner) + } +} +/// Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeletePlan<'a> { + plan: &'a stripe_shared::PlanId, +} +impl<'a> DeletePlan<'a> { + pub fn new(plan: &'a stripe_shared::PlanId) -> Self { + Self { plan } + } +} +impl DeletePlan<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeletePlan<'_> { + type Output = stripe_shared::DeletedPlan; + + fn build(&self) -> RequestBuilder { + let plan = self.plan; + RequestBuilder::new(StripeMethod::Delete, format!("/plans/{plan}")) } } diff --git a/generated/stripe_billing/src/quote/requests.rs b/generated/stripe_billing/src/quote/requests.rs index 909de6f16..52969967c 100644 --- a/generated/stripe_billing/src/quote/requests.rs +++ b/generated/stripe_billing/src/quote/requests.rs @@ -1,160 +1,59 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListQuote<'a> { - /// The ID of the customer whose quotes will be retrieved. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveQuoteBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// The status of the quote. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Provides a list of quotes that are associated with the specified test clock. - /// The response will not include quotes with test clocks if this and the customer parameter is not set. - #[serde(skip_serializing_if = "Option::is_none")] - pub test_clock: Option<&'a str>, } -impl<'a> ListQuote<'a> { +impl<'a> RetrieveQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListQuote<'a> { - /// Returns a list of your quotes. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/quotes", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/quotes", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves the quote with the given ID. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrieveQuote<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveQuote<'a> { - pub fn new() -> Self { - Self::default() - } + inner: RetrieveQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, } impl<'a> RetrieveQuote<'a> { - /// Retrieves the quote with the given ID. - pub fn send( - &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response { - client.get_query(&format!("/quotes/{quote}"), self) + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: RetrieveQuoteBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListComputedUpfrontLineItemsQuote<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListComputedUpfrontLineItemsQuote<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> ListComputedUpfrontLineItemsQuote<'a> { - /// When retrieving a quote, there is an includable **computed.upfront.line_items** property containing the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of upfront line items. - pub fn send( +impl RetrieveQuote<'_> { + pub async fn send( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response> { - client.get_query(&format!("/quotes/{quote}/computed_upfront_line_items"), self) - } - pub fn paginate( - self, - quote: &stripe_shared::QuoteId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/quotes/{quote}/computed_upfront_line_items"), - self, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListLineItemsQuote<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListLineItemsQuote<'a> { - pub fn new() -> Self { - Self::default() + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl<'a> ListLineItemsQuote<'a> { - /// When retrieving a quote, there is an includable **line_items** property containing the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( + + pub fn send_blocking( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response> { - client.get_query(&format!("/quotes/{quote}/line_items"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - quote: &stripe_shared::QuoteId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/quotes/{quote}/line_items"), self) +} + +impl StripeRequest for RetrieveQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Get, format!("/quotes/{quote}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuote<'a> { +pub struct CreateQuoteBuilder<'a> { /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. /// There cannot be any line items with recurring prices when using this field. #[serde(skip_serializing_if = "Option::is_none")] @@ -166,7 +65,7 @@ pub struct CreateQuote<'a> { pub application_fee_percent: Option, /// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -204,18 +103,18 @@ pub struct CreateQuote<'a> { /// The new quote will be created in `status=draft`. /// When using this parameter, you cannot specify any other parameters except for `expires_at`. #[serde(skip_serializing_if = "Option::is_none")] - pub from_quote: Option>, + pub from_quote: Option>, /// A header that will be displayed on the quote PDF. /// If no value is passed, the default header configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. #[serde(skip_serializing_if = "Option::is_none")] pub header: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[serde(skip_serializing_if = "Option::is_none")] - pub line_items: Option<&'a [CreateQuoteLineItems<'a>]>, + pub line_items: Option<&'a [CreateQuoteBuilderLineItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -229,7 +128,7 @@ pub struct CreateQuote<'a> { /// There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. /// A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_data: Option>, + pub subscription_data: Option>, /// ID of the test clock to attach to the quote. #[serde(skip_serializing_if = "Option::is_none")] pub test_clock: Option<&'a str>, @@ -237,196 +136,38 @@ pub struct CreateQuote<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, } -impl<'a> CreateQuote<'a> { +impl<'a> CreateQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteAutomaticTax<'a> { - /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> CreateQuoteAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateQuoteAutomaticTaxLiabilityType, -} -impl<'a> CreateQuoteAutomaticTaxLiability<'a> { - pub fn new(type_: CreateQuoteAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateQuoteAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateQuoteAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateQuoteAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateQuoteAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateQuoteAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateQuoteAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateQuoteAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateQuoteAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Clone an existing quote. /// The new quote will be created in `status=draft`. /// When using this parameter, you cannot specify any other parameters except for `expires_at`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteFromQuote<'a> { +pub struct CreateQuoteBuilderFromQuote<'a> { /// Whether this quote is a revision of the previous quote. #[serde(skip_serializing_if = "Option::is_none")] pub is_revision: Option, /// The `id` of the quote that will be cloned. pub quote: &'a str, } -impl<'a> CreateQuoteFromQuote<'a> { +impl<'a> CreateQuoteBuilderFromQuote<'a> { pub fn new(quote: &'a str) -> Self { Self { is_revision: None, quote } } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuoteInvoiceSettings<'a> { - /// Number of days within which a customer must pay the invoice generated by this quote. - /// This value will be `null` for quotes where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> CreateQuoteInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateQuoteInvoiceSettingsIssuerType, -} -impl<'a> CreateQuoteInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreateQuoteInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateQuoteInvoiceSettingsIssuerType { - Account, - Self_, -} -impl CreateQuoteInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreateQuoteInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateQuoteInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateQuoteInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateQuoteInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateQuoteInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateQuoteInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuoteLineItems<'a> { +pub struct CreateQuoteBuilderLineItems<'a> { /// The ID of the price object. One of `price` or `price_data` is required. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// The quantity of the line item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -435,7 +176,7 @@ pub struct CreateQuoteLineItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateQuoteLineItems<'a> { +impl<'a> CreateQuoteBuilderLineItems<'a> { pub fn new() -> Self { Self::default() } @@ -443,7 +184,7 @@ impl<'a> CreateQuoteLineItems<'a> { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteLineItemsPriceData<'a> { +pub struct CreateQuoteBuilderLineItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -451,13 +192,13 @@ pub struct CreateQuoteLineItemsPriceData<'a> { pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -466,7 +207,7 @@ pub struct CreateQuoteLineItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateQuoteLineItemsPriceData<'a> { +impl<'a> CreateQuoteBuilderLineItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, @@ -480,31 +221,31 @@ impl<'a> CreateQuoteLineItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteLineItemsPriceDataRecurring { +pub struct CreateQuoteBuilderLineItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateQuoteLineItemsPriceDataRecurringInterval, + pub interval: CreateQuoteBuilderLineItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateQuoteLineItemsPriceDataRecurring { - pub fn new(interval: CreateQuoteLineItemsPriceDataRecurringInterval) -> Self { +impl CreateQuoteBuilderLineItemsPriceDataRecurring { + pub fn new(interval: CreateQuoteBuilderLineItemsPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateQuoteLineItemsPriceDataRecurringInterval { +pub enum CreateQuoteBuilderLineItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateQuoteLineItemsPriceDataRecurringInterval { +impl CreateQuoteBuilderLineItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateQuoteLineItemsPriceDataRecurringInterval::*; + use CreateQuoteBuilderLineItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -514,10 +255,10 @@ impl CreateQuoteLineItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateQuoteLineItemsPriceDataRecurringInterval { +impl std::str::FromStr for CreateQuoteBuilderLineItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateQuoteLineItemsPriceDataRecurringInterval::*; + use CreateQuoteBuilderLineItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -527,18 +268,18 @@ impl std::str::FromStr for CreateQuoteLineItemsPriceDataRecurringInterval { } } } -impl std::fmt::Display for CreateQuoteLineItemsPriceDataRecurringInterval { +impl std::fmt::Display for CreateQuoteBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateQuoteLineItemsPriceDataRecurringInterval { +impl std::fmt::Debug for CreateQuoteBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateQuoteLineItemsPriceDataRecurringInterval { +impl serde::Serialize for CreateQuoteBuilderLineItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -551,14 +292,14 @@ impl serde::Serialize for CreateQuoteLineItemsPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateQuoteLineItemsPriceDataTaxBehavior { +pub enum CreateQuoteBuilderLineItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateQuoteLineItemsPriceDataTaxBehavior { +impl CreateQuoteBuilderLineItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateQuoteLineItemsPriceDataTaxBehavior::*; + use CreateQuoteBuilderLineItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -567,10 +308,10 @@ impl CreateQuoteLineItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateQuoteLineItemsPriceDataTaxBehavior { +impl std::str::FromStr for CreateQuoteBuilderLineItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateQuoteLineItemsPriceDataTaxBehavior::*; + use CreateQuoteBuilderLineItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -579,18 +320,18 @@ impl std::str::FromStr for CreateQuoteLineItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateQuoteLineItemsPriceDataTaxBehavior { +impl std::fmt::Display for CreateQuoteBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateQuoteLineItemsPriceDataTaxBehavior { +impl std::fmt::Debug for CreateQuoteBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateQuoteLineItemsPriceDataTaxBehavior { +impl serde::Serialize for CreateQuoteBuilderLineItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -602,7 +343,7 @@ impl serde::Serialize for CreateQuoteLineItemsPriceDataTaxBehavior { /// There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. /// A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuoteSubscriptionData<'a> { +pub struct CreateQuoteBuilderSubscriptionData<'a> { /// The subscription's description, meant to be displayable to the customer. /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. #[serde(skip_serializing_if = "Option::is_none")] @@ -612,7 +353,7 @@ pub struct CreateQuoteSubscriptionData<'a> { /// The special value `current_period_end` can be provided to update a subscription at the end of its current period. /// The `effective_date` is ignored if it is in the past when the quote is accepted. #[serde(skip_serializing_if = "Option::is_none")] - pub effective_date: Option, + pub effective_date: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. /// If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. /// If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. @@ -624,7 +365,7 @@ pub struct CreateQuoteSubscriptionData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub trial_period_days: Option, } -impl<'a> CreateQuoteSubscriptionData<'a> { +impl<'a> CreateQuoteBuilderSubscriptionData<'a> { pub fn new() -> Self { Self::default() } @@ -635,19 +376,151 @@ impl<'a> CreateQuoteSubscriptionData<'a> { /// The `effective_date` is ignored if it is in the past when the quote is accepted. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateQuoteSubscriptionDataEffectiveDate { +pub enum CreateQuoteBuilderSubscriptionDataEffectiveDate { CurrentPeriodEnd, Timestamp(stripe_types::Timestamp), } +/// A quote models prices and services for a customer. +/// Default options for `header`, `description`, `footer`, and `expires_at` can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateQuote<'a> { + inner: CreateQuoteBuilder<'a>, +} impl<'a> CreateQuote<'a> { - /// A quote models prices and services for a customer. - /// Default options for `header`, `description`, `footer`, and `expires_at` can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote). - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/quotes", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateQuoteBuilder::new() } + } + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn application_fee_percent(mut self, application_fee_percent: f64) -> Self { + self.inner.application_fee_percent = Some(application_fee_percent); + self + } + + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn collection_method( + mut self, + collection_method: stripe_shared::QuoteCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn footer(mut self, footer: &'a str) -> Self { + self.inner.footer = Some(footer); + self + } + + pub fn from_quote(mut self, from_quote: CreateQuoteBuilderFromQuote<'a>) -> Self { + self.inner.from_quote = Some(from_quote); + self + } + + pub fn header(mut self, header: &'a str) -> Self { + self.inner.header = Some(header); + self + } + + pub fn invoice_settings(mut self, invoice_settings: QuoteParam) -> Self { + self.inner.invoice_settings = Some(invoice_settings); + self + } + + pub fn line_items(mut self, line_items: &'a [CreateQuoteBuilderLineItems<'a>]) -> Self { + self.inner.line_items = Some(line_items); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn subscription_data( + mut self, + subscription_data: CreateQuoteBuilderSubscriptionData<'a>, + ) -> Self { + self.inner.subscription_data = Some(subscription_data); + self + } + + pub fn test_clock(mut self, test_clock: &'a str) -> Self { + self.inner.test_clock = Some(test_clock); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } +} +impl CreateQuote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/quotes").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuote<'a> { +pub struct UpdateQuoteBuilder<'a> { /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. /// There cannot be any line items with recurring prices when using this field. #[serde(skip_serializing_if = "Option::is_none")] @@ -659,7 +532,7 @@ pub struct UpdateQuote<'a> { pub application_fee_percent: Option, /// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -695,11 +568,11 @@ pub struct UpdateQuote<'a> { pub header: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[serde(skip_serializing_if = "Option::is_none")] - pub line_items: Option<&'a [UpdateQuoteLineItems<'a>]>, + pub line_items: Option<&'a [UpdateQuoteBuilderLineItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -713,179 +586,21 @@ pub struct UpdateQuote<'a> { /// There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. /// A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_data: Option>, + pub subscription_data: Option>, /// The data with which to automatically create a Transfer for each of the invoices. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, } -impl<'a> UpdateQuote<'a> { +impl<'a> UpdateQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteAutomaticTax<'a> { - /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpdateQuoteAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateQuoteAutomaticTaxLiabilityType, -} -impl<'a> UpdateQuoteAutomaticTaxLiability<'a> { - pub fn new(type_: UpdateQuoteAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateQuoteAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdateQuoteAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdateQuoteAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateQuoteAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateQuoteAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateQuoteAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateQuoteAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateQuoteAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuoteInvoiceSettings<'a> { - /// Number of days within which a customer must pay the invoice generated by this quote. - /// This value will be `null` for quotes where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> UpdateQuoteInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateQuoteInvoiceSettingsIssuerType, -} -impl<'a> UpdateQuoteInvoiceSettingsIssuer<'a> { - pub fn new(type_: UpdateQuoteInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateQuoteInvoiceSettingsIssuerType { - Account, - Self_, -} -impl UpdateQuoteInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use UpdateQuoteInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateQuoteInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateQuoteInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateQuoteInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateQuoteInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateQuoteInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// A list of line items the customer is being quoted for. -/// Each line item includes information about the product, the quantity, and the resulting cost. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuoteLineItems<'a> { - /// The ID of an existing line item on the quote. +/// A list of line items the customer is being quoted for. +/// Each line item includes information about the product, the quantity, and the resulting cost. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateQuoteBuilderLineItems<'a> { + /// The ID of an existing line item on the quote. #[serde(skip_serializing_if = "Option::is_none")] pub id: Option<&'a str>, /// The ID of the price object. One of `price` or `price_data` is required. @@ -894,7 +609,7 @@ pub struct UpdateQuoteLineItems<'a> { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// The quantity of the line item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -903,7 +618,7 @@ pub struct UpdateQuoteLineItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateQuoteLineItems<'a> { +impl<'a> UpdateQuoteBuilderLineItems<'a> { pub fn new() -> Self { Self::default() } @@ -911,7 +626,7 @@ impl<'a> UpdateQuoteLineItems<'a> { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteLineItemsPriceData<'a> { +pub struct UpdateQuoteBuilderLineItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -919,13 +634,13 @@ pub struct UpdateQuoteLineItemsPriceData<'a> { pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -934,7 +649,7 @@ pub struct UpdateQuoteLineItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateQuoteLineItemsPriceData<'a> { +impl<'a> UpdateQuoteBuilderLineItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, @@ -948,31 +663,31 @@ impl<'a> UpdateQuoteLineItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteLineItemsPriceDataRecurring { +pub struct UpdateQuoteBuilderLineItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpdateQuoteLineItemsPriceDataRecurringInterval, + pub interval: UpdateQuoteBuilderLineItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpdateQuoteLineItemsPriceDataRecurring { - pub fn new(interval: UpdateQuoteLineItemsPriceDataRecurringInterval) -> Self { +impl UpdateQuoteBuilderLineItemsPriceDataRecurring { + pub fn new(interval: UpdateQuoteBuilderLineItemsPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateQuoteLineItemsPriceDataRecurringInterval { +pub enum UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl UpdateQuoteLineItemsPriceDataRecurringInterval { +impl UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use UpdateQuoteLineItemsPriceDataRecurringInterval::*; + use UpdateQuoteBuilderLineItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -982,10 +697,10 @@ impl UpdateQuoteLineItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for UpdateQuoteLineItemsPriceDataRecurringInterval { +impl std::str::FromStr for UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateQuoteLineItemsPriceDataRecurringInterval::*; + use UpdateQuoteBuilderLineItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -995,18 +710,18 @@ impl std::str::FromStr for UpdateQuoteLineItemsPriceDataRecurringInterval { } } } -impl std::fmt::Display for UpdateQuoteLineItemsPriceDataRecurringInterval { +impl std::fmt::Display for UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateQuoteLineItemsPriceDataRecurringInterval { +impl std::fmt::Debug for UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateQuoteLineItemsPriceDataRecurringInterval { +impl serde::Serialize for UpdateQuoteBuilderLineItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1019,14 +734,14 @@ impl serde::Serialize for UpdateQuoteLineItemsPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateQuoteLineItemsPriceDataTaxBehavior { +pub enum UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateQuoteLineItemsPriceDataTaxBehavior { +impl UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateQuoteLineItemsPriceDataTaxBehavior::*; + use UpdateQuoteBuilderLineItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1035,10 +750,10 @@ impl UpdateQuoteLineItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateQuoteLineItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateQuoteLineItemsPriceDataTaxBehavior::*; + use UpdateQuoteBuilderLineItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1047,18 +762,18 @@ impl std::str::FromStr for UpdateQuoteLineItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpdateQuoteLineItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateQuoteLineItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateQuoteLineItemsPriceDataTaxBehavior { +impl serde::Serialize for UpdateQuoteBuilderLineItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1070,7 +785,7 @@ impl serde::Serialize for UpdateQuoteLineItemsPriceDataTaxBehavior { /// There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. /// A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuoteSubscriptionData<'a> { +pub struct UpdateQuoteBuilderSubscriptionData<'a> { /// The subscription's description, meant to be displayable to the customer. /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. #[serde(skip_serializing_if = "Option::is_none")] @@ -1080,7 +795,7 @@ pub struct UpdateQuoteSubscriptionData<'a> { /// The special value `current_period_end` can be provided to update a subscription at the end of its current period. /// The `effective_date` is ignored if it is in the past when the quote is accepted. #[serde(skip_serializing_if = "Option::is_none")] - pub effective_date: Option, + pub effective_date: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. /// If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. /// If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. @@ -1092,7 +807,7 @@ pub struct UpdateQuoteSubscriptionData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub trial_period_days: Option, } -impl<'a> UpdateQuoteSubscriptionData<'a> { +impl<'a> UpdateQuoteBuilderSubscriptionData<'a> { pub fn new() -> Self { Self::default() } @@ -1103,85 +818,576 @@ impl<'a> UpdateQuoteSubscriptionData<'a> { /// The `effective_date` is ignored if it is in the past when the quote is accepted. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateQuoteSubscriptionDataEffectiveDate { +pub enum UpdateQuoteBuilderSubscriptionDataEffectiveDate { CurrentPeriodEnd, Timestamp(stripe_types::Timestamp), } +/// A quote models prices and services for a customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateQuote<'a> { + inner: UpdateQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} impl<'a> UpdateQuote<'a> { - /// A quote models prices and services for a customer. - pub fn send( + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: UpdateQuoteBuilder::new() } + } + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn application_fee_percent(mut self, application_fee_percent: f64) -> Self { + self.inner.application_fee_percent = Some(application_fee_percent); + self + } + + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParam) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn collection_method( + mut self, + collection_method: stripe_shared::QuoteCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn discounts(mut self, discounts: &'a [DiscountsDataParam<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn footer(mut self, footer: &'a str) -> Self { + self.inner.footer = Some(footer); + self + } + + pub fn header(mut self, header: &'a str) -> Self { + self.inner.header = Some(header); + self + } + + pub fn invoice_settings(mut self, invoice_settings: QuoteParam) -> Self { + self.inner.invoice_settings = Some(invoice_settings); + self + } + + pub fn line_items(mut self, line_items: &'a [UpdateQuoteBuilderLineItems<'a>]) -> Self { + self.inner.line_items = Some(line_items); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn subscription_data( + mut self, + subscription_data: UpdateQuoteBuilderSubscriptionData<'a>, + ) -> Self { + self.inner.subscription_data = Some(subscription_data); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } +} +impl UpdateQuote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Post, format!("/quotes/{quote}")).form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelQuoteBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelQuoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Cancels the quote. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelQuote<'a> { + inner: CancelQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} +impl<'a> CancelQuote<'a> { + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: CancelQuoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelQuote<'_> { + pub async fn send( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response { - client.send_form(&format!("/quotes/{quote}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Post, format!("/quotes/{quote}/cancel")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct AcceptQuote<'a> { +pub struct FinalizeQuoteQuoteBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// A future timestamp on which the quote will be canceled if in `open` or `draft` status. + /// Measured in seconds since the Unix epoch. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_at: Option, } -impl<'a> AcceptQuote<'a> { +impl<'a> FinalizeQuoteQuoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Finalizes the quote. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FinalizeQuoteQuote<'a> { + inner: FinalizeQuoteQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} +impl<'a> FinalizeQuoteQuote<'a> { + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: FinalizeQuoteQuoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } +} +impl FinalizeQuoteQuote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FinalizeQuoteQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Post, format!("/quotes/{quote}/finalize")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct AcceptQuoteBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> AcceptQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Accepts the specified quote. +#[derive(Clone, Debug, serde::Serialize)] +pub struct AcceptQuote<'a> { + inner: AcceptQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} impl<'a> AcceptQuote<'a> { - /// Accepts the specified quote. - pub fn send( + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: AcceptQuoteBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl AcceptQuote<'_> { + pub async fn send( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response { - client.send_form(&format!("/quotes/{quote}/accept"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for AcceptQuote<'_> { + type Output = stripe_shared::Quote; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Post, format!("/quotes/{quote}/accept")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelQuote<'a> { +pub struct ListQuoteBuilder<'a> { + /// The ID of the customer whose quotes will be retrieved. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// The status of the quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Provides a list of quotes that are associated with the specified test clock. + /// The response will not include quotes with test clocks if this and the customer parameter is not set. + #[serde(skip_serializing_if = "Option::is_none")] + pub test_clock: Option<&'a str>, } -impl<'a> CancelQuote<'a> { +impl<'a> ListQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CancelQuote<'a> { - /// Cancels the quote. - pub fn send( +/// Returns a list of your quotes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListQuote<'a> { + inner: ListQuoteBuilder<'a>, +} +impl<'a> ListQuote<'a> { + pub fn new() -> Self { + Self { inner: ListQuoteBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::QuoteStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn test_clock(mut self, test_clock: &'a str) -> Self { + self.inner.test_clock = Some(test_clock); + self + } +} +impl ListQuote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response { - client.send_form(&format!("/quotes/{quote}/cancel"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListQuote<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/quotes").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FinalizeQuoteQuote<'a> { +pub struct ListLineItemsQuoteBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A future timestamp on which the quote will be canceled if in `open` or `draft` status. - /// Measured in seconds since the Unix epoch. + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. #[serde(skip_serializing_if = "Option::is_none")] - pub expires_at: Option, + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, } -impl<'a> FinalizeQuoteQuote<'a> { +impl<'a> ListLineItemsQuoteBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> FinalizeQuoteQuote<'a> { - /// Finalizes the quote. - pub fn send( +/// When retrieving a quote, there is an includable **line_items** property containing the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListLineItemsQuote<'a> { + inner: ListLineItemsQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} +impl<'a> ListLineItemsQuote<'a> { + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: ListLineItemsQuoteBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListLineItemsQuote<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListLineItemsQuote<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new(StripeMethod::Get, format!("/quotes/{quote}/line_items")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListComputedUpfrontLineItemsQuoteBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListComputedUpfrontLineItemsQuoteBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// When retrieving a quote, there is an includable **computed.upfront.line_items** property containing the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of upfront line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListComputedUpfrontLineItemsQuote<'a> { + inner: ListComputedUpfrontLineItemsQuoteBuilder<'a>, + quote: &'a stripe_shared::QuoteId, +} +impl<'a> ListComputedUpfrontLineItemsQuote<'a> { + pub fn new(quote: &'a stripe_shared::QuoteId) -> Self { + Self { quote, inner: ListComputedUpfrontLineItemsQuoteBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListComputedUpfrontLineItemsQuote<'_> { + pub async fn send( &self, - client: &stripe::Client, - quote: &stripe_shared::QuoteId, - ) -> stripe::Response { - client.send_form(&format!("/quotes/{quote}/finalize"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListComputedUpfrontLineItemsQuote<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let quote = self.quote; + RequestBuilder::new( + StripeMethod::Get, + format!("/quotes/{quote}/computed_upfront_line_items"), + ) + .query(&self.inner) + } +} + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParam { + /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. + pub enabled: bool, +} +impl AutomaticTaxParam { + pub fn new(enabled: bool) -> Self { + Self { enabled } } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -1198,6 +1404,18 @@ impl<'a> DiscountsDataParam<'a> { Self::default() } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct QuoteParam { + /// Number of days within which a customer must pay the invoice generated by this quote. + /// This value will be `null` for quotes where `collection_method=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} +impl QuoteParam { + pub fn new() -> Self { + Self::default() + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct TransferDataSpecs<'a> { /// The amount that will be transferred automatically when the invoice is paid. diff --git a/generated/stripe_billing/src/subscription/requests.rs b/generated/stripe_billing/src/subscription/requests.rs index 42f686a8a..14e2c958f 100644 --- a/generated/stripe_billing/src/subscription/requests.rs +++ b/generated/stripe_billing/src/subscription/requests.rs @@ -1,152 +1,87 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelSubscription<'a> { - /// Details about why this subscription was cancelled - #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_details: Option>, +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct SearchSubscriptionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_now: Option, - /// Will generate a proration invoice item that credits remaining unused time until the subscription period end. + pub limit: Option, + /// A cursor for pagination across multiple pages of results. + /// Don't include this parameter on the first call. + /// Use the next_page value returned in a previous response to request subsequent results. #[serde(skip_serializing_if = "Option::is_none")] - pub prorate: Option, + pub page: Option<&'a str>, + /// The search query string. + /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for subscriptions](https://stripe.com/docs/search#query-fields-for-subscriptions). + pub query: &'a str, } -impl<'a> CancelSubscription<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> SearchSubscriptionBuilder<'a> { + pub fn new(query: &'a str) -> Self { + Self { expand: None, limit: None, page: None, query } } } -/// Details about why this subscription was cancelled -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelSubscriptionCancellationDetails<'a> { - /// Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user. - #[serde(skip_serializing_if = "Option::is_none")] - pub comment: Option<&'a str>, - /// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. - #[serde(skip_serializing_if = "Option::is_none")] - pub feedback: Option, +/// Search for subscriptions you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchSubscription<'a> { + inner: SearchSubscriptionBuilder<'a>, } -impl<'a> CancelSubscriptionCancellationDetails<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> SearchSubscription<'a> { + pub fn new(query: &'a str) -> Self { + Self { inner: SearchSubscriptionBuilder::new(query) } } -} -/// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CancelSubscriptionCancellationDetailsFeedback { - CustomerService, - LowQuality, - MissingFeatures, - Other, - SwitchedService, - TooComplex, - TooExpensive, - Unused, -} -impl CancelSubscriptionCancellationDetailsFeedback { - pub fn as_str(self) -> &'static str { - use CancelSubscriptionCancellationDetailsFeedback::*; - match self { - CustomerService => "customer_service", - LowQuality => "low_quality", - MissingFeatures => "missing_features", - Other => "other", - SwitchedService => "switched_service", - TooComplex => "too_complex", - TooExpensive => "too_expensive", - Unused => "unused", - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl std::str::FromStr for CancelSubscriptionCancellationDetailsFeedback { - type Err = (); - fn from_str(s: &str) -> Result { - use CancelSubscriptionCancellationDetailsFeedback::*; - match s { - "customer_service" => Ok(CustomerService), - "low_quality" => Ok(LowQuality), - "missing_features" => Ok(MissingFeatures), - "other" => Ok(Other), - "switched_service" => Ok(SwitchedService), - "too_complex" => Ok(TooComplex), - "too_expensive" => Ok(TooExpensive), - "unused" => Ok(Unused), - _ => Err(()), - } - } -} -impl std::fmt::Display for CancelSubscriptionCancellationDetailsFeedback { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self } -} -impl std::fmt::Debug for CancelSubscriptionCancellationDetailsFeedback { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CancelSubscriptionCancellationDetailsFeedback { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self } } -impl<'a> CancelSubscription<'a> { - /// Cancels a customer’s subscription immediately. - /// The customer will not be charged again for the subscription. - /// - /// Note, however, that any pending invoice items that you’ve created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). - /// If you’ve set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. - /// But if the subscription is set to cancel immediately, pending prorations will be removed. - /// - /// By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. - /// This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. - /// However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. - /// Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. - pub fn send( +impl SearchSubscription<'_> { + pub async fn send( &self, - client: &stripe::Client, - subscription_exposed_id: &stripe_shared::SubscriptionId, - ) -> stripe::Response { - client.send_form( - &format!("/subscriptions/{subscription_exposed_id}"), - self, - http_types::Method::Delete, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteDiscountSubscription {} -impl DeleteDiscountSubscription { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl DeleteDiscountSubscription { - /// Removes the currently applied discount on a subscription. - pub fn send( - &self, - client: &stripe::Client, - subscription_exposed_id: &stripe_shared::SubscriptionId, - ) -> stripe::Response { - client.send_form( - &format!("/subscriptions/{subscription_exposed_id}/discount"), - self, - http_types::Method::Delete, - ) + +impl StripeRequest for SearchSubscription<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/subscriptions/search").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListSubscription<'a> { +pub struct ListSubscriptionBuilder<'a> { /// Filter subscriptions by their automatic tax settings. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// The collection method of the subscriptions to retrieve. /// Either `charge_automatically` or `send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] @@ -189,24 +124,24 @@ pub struct ListSubscription<'a> { /// Passing in a value of `all` will return subscriptions of all statuses. /// If no value is supplied, all subscriptions that have not been canceled are returned. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Filter for subscriptions that are associated with the specified test clock. /// The response will not include subscriptions with test clocks if this and the customer parameter is not set. #[serde(skip_serializing_if = "Option::is_none")] pub test_clock: Option<&'a str>, } -impl<'a> ListSubscription<'a> { +impl<'a> ListSubscriptionBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Filter subscriptions by their automatic tax settings. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListSubscriptionAutomaticTax { +pub struct ListSubscriptionBuilderAutomaticTax { /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. pub enabled: bool, } -impl ListSubscriptionAutomaticTax { +impl ListSubscriptionBuilderAutomaticTax { pub fn new(enabled: bool) -> Self { Self { enabled } } @@ -217,7 +152,7 @@ impl ListSubscriptionAutomaticTax { /// Passing in a value of `all` will return subscriptions of all statuses. /// If no value is supplied, all subscriptions that have not been canceled are returned. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListSubscriptionStatus { +pub enum ListSubscriptionBuilderStatus { Active, All, Canceled, @@ -229,9 +164,9 @@ pub enum ListSubscriptionStatus { Trialing, Unpaid, } -impl ListSubscriptionStatus { +impl ListSubscriptionBuilderStatus { pub fn as_str(self) -> &'static str { - use ListSubscriptionStatus::*; + use ListSubscriptionBuilderStatus::*; match self { Active => "active", All => "all", @@ -247,10 +182,10 @@ impl ListSubscriptionStatus { } } -impl std::str::FromStr for ListSubscriptionStatus { +impl std::str::FromStr for ListSubscriptionBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use ListSubscriptionStatus::*; + use ListSubscriptionBuilderStatus::*; match s { "active" => Ok(Active), "all" => Ok(All), @@ -266,18 +201,18 @@ impl std::str::FromStr for ListSubscriptionStatus { } } } -impl std::fmt::Display for ListSubscriptionStatus { +impl std::fmt::Display for ListSubscriptionBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListSubscriptionStatus { +impl std::fmt::Debug for ListSubscriptionBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListSubscriptionStatus { +impl serde::Serialize for ListSubscriptionBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -285,90 +220,121 @@ impl serde::Serialize for ListSubscriptionStatus { serializer.serialize_str(self.as_str()) } } +/// By default, returns a list of subscriptions that have not been canceled. +/// In order to list canceled subscriptions, specify `status=canceled`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSubscription<'a> { + inner: ListSubscriptionBuilder<'a>, +} impl<'a> ListSubscription<'a> { - /// By default, returns a list of subscriptions that have not been canceled. - /// In order to list canceled subscriptions, specify `status=canceled`. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/subscriptions", self) + pub fn new() -> Self { + Self { inner: ListSubscriptionBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/subscriptions", self) + pub fn automatic_tax(mut self, automatic_tax: ListSubscriptionBuilderAutomaticTax) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveSubscription<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveSubscription<'a> { - pub fn new() -> Self { - Self::default() + + pub fn collection_method( + mut self, + collection_method: stripe_shared::SubscriptionCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self } -} -impl<'a> RetrieveSubscription<'a> { - /// Retrieves the subscription with the given ID. - pub fn send( - &self, - client: &stripe::Client, - subscription_exposed_id: &stripe_shared::SubscriptionId, - ) -> stripe::Response { - client.get_query(&format!("/subscriptions/{subscription_exposed_id}"), self) + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchSubscription<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for pagination across multiple pages of results. - /// Don't include this parameter on the first call. - /// Use the next_page value returned in a previous response to request subsequent results. - #[serde(skip_serializing_if = "Option::is_none")] - pub page: Option<&'a str>, - /// The search query string. - /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for subscriptions](https://stripe.com/docs/search#query-fields-for-subscriptions). - pub query: &'a str, -} -impl<'a> SearchSubscription<'a> { - pub fn new(query: &'a str) -> Self { - Self { expand: None, limit: None, page: None, query } + + pub fn current_period_end(mut self, current_period_end: stripe_types::RangeQueryTs) -> Self { + self.inner.current_period_end = Some(current_period_end); + self + } + + pub fn current_period_start( + mut self, + current_period_start: stripe_types::RangeQueryTs, + ) -> Self { + self.inner.current_period_start = Some(current_period_start); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn plan(mut self, plan: &'a str) -> Self { + self.inner.plan = Some(plan); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: ListSubscriptionBuilderStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn test_clock(mut self, test_clock: &'a str) -> Self { + self.inner.test_clock = Some(test_clock); + self } } -impl<'a> SearchSubscription<'a> { - /// Search for subscriptions you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( +impl ListSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/subscriptions/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/subscriptions/search", self) +} + +impl StripeRequest for ListSubscription<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/subscriptions").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscription<'a> { +pub struct CreateSubscriptionBuilder<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. /// You may pass up to 20 items. #[serde(skip_serializing_if = "Option::is_none")] - pub add_invoice_items: Option<&'a [CreateSubscriptionAddInvoiceItems<'a>]>, + pub add_invoice_items: Option<&'a [CreateSubscriptionBuilderAddInvoiceItems<'a>]>, /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// The request must be made by a platform account on a connected account in order to set an application fee percentage. @@ -378,21 +344,17 @@ pub struct CreateSubscription<'a> { /// Automatic tax settings for this subscription. /// We recommend you only include this parameter when the existing value is being changed. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// For new subscriptions, a past timestamp to backdate the subscription's start date to. /// If set, the first invoice will contain a proration for the timespan between the start date and the current time. /// Can be combined with trials and the billing cycle anchor. #[serde(skip_serializing_if = "Option::is_none")] pub backdate_start_date: Option, - /// A future timestamp in UTC format to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). - /// The anchor is the reference point that aligns future billing cycle dates. - /// It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. + /// A future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). + /// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. + /// The timestamp is in UTC format. #[serde(skip_serializing_if = "Option::is_none")] pub billing_cycle_anchor: Option, - /// Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. - /// When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor_config: Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -448,12 +410,9 @@ pub struct CreateSubscription<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// All invoices will be billed using the specified settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, /// A list of up to 20 subscription items, each with an attached price. #[serde(skip_serializing_if = "Option::is_none")] - pub items: Option<&'a [CreateSubscriptionItems<'a>]>, + pub items: Option<&'a [CreateSubscriptionBuilderItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -489,14 +448,14 @@ pub struct CreateSubscription<'a> { /// /// Subscriptions with `collection_method=send_invoice` are automatically activated regardless of the first invoice status. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_behavior: Option, + pub payment_behavior: Option, /// Payment settings to pass to invoices created by the subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_settings: Option>, + pub payment_settings: Option>, /// Specifies an interval for how often to bill for any pending invoice items. /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. #[serde(skip_serializing_if = "Option::is_none")] - pub pending_invoice_item_interval: Option, + pub pending_invoice_item_interval: Option, /// The API ID of a promotion code to apply to this subscription. /// A promotion code applied to a subscription will only affect invoices created for that particular subscription. #[serde(skip_serializing_if = "Option::is_none")] @@ -504,7 +463,7 @@ pub struct CreateSubscription<'a> { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) resulting from the `billing_cycle_anchor`. /// If no value is passed, the default is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, @@ -514,7 +473,7 @@ pub struct CreateSubscription<'a> { /// Can be at most two years from `billing_cycle_anchor`. /// See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_end: Option, + pub trial_end: Option, /// Indicates if a plan's `trial_period_days` should be applied to the subscription. /// Setting `trial_end` per subscription is preferred, and this defaults to `false`. /// Setting this flag to `true` together with `trial_end` is not allowed. @@ -528,9 +487,9 @@ pub struct CreateSubscription<'a> { pub trial_period_days: Option, /// Settings related to subscription trials. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_settings: Option, + pub trial_settings: Option, } -impl<'a> CreateSubscription<'a> { +impl<'a> CreateSubscriptionBuilder<'a> { pub fn new(customer: &'a str) -> Self { Self { add_invoice_items: None, @@ -538,7 +497,6 @@ impl<'a> CreateSubscription<'a> { automatic_tax: None, backdate_start_date: None, billing_cycle_anchor: None, - billing_cycle_anchor_config: None, billing_thresholds: None, cancel_at: None, cancel_at_period_end: None, @@ -552,7 +510,6 @@ impl<'a> CreateSubscription<'a> { default_tax_rates: None, description: None, expand: None, - invoice_settings: None, items: None, metadata: None, off_session: None, @@ -573,13 +530,13 @@ impl<'a> CreateSubscription<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. /// You may pass up to 20 items. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionAddInvoiceItems<'a> { +pub struct CreateSubscriptionBuilderAddInvoiceItems<'a> { /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. Defaults to 1. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -587,14 +544,14 @@ pub struct CreateSubscriptionAddInvoiceItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateSubscriptionAddInvoiceItems<'a> { +impl<'a> CreateSubscriptionBuilderAddInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionAddInvoiceItemsPriceData<'a> { +pub struct CreateSubscriptionBuilderAddInvoiceItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -605,7 +562,7 @@ pub struct CreateSubscriptionAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -614,7 +571,7 @@ pub struct CreateSubscriptionAddInvoiceItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateSubscriptionAddInvoiceItemsPriceData<'a> { +impl<'a> CreateSubscriptionBuilderAddInvoiceItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -624,14 +581,14 @@ impl<'a> CreateSubscriptionAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +pub enum CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior::*; + use CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -640,10 +597,10 @@ impl CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr for CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior::*; + use CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -652,18 +609,18 @@ impl std::str::FromStr for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior } } } -impl std::fmt::Display for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Display for CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Debug for CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl serde::Serialize for CreateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -674,238 +631,67 @@ impl serde::Serialize for CreateSubscriptionAddInvoiceItemsPriceDataTaxBehavior /// Automatic tax settings for this subscription. /// We recommend you only include this parameter when the existing value is being changed. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionAutomaticTax<'a> { +pub struct CreateSubscriptionBuilderAutomaticTax { /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, } -impl<'a> CreateSubscriptionAutomaticTax<'a> { +impl CreateSubscriptionBuilderAutomaticTax { pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } + Self { enabled } } } -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. +/// A list of up to 20 subscription items, each with an attached price. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateSubscriptionBuilderItems<'a> { + /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. + /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionAutomaticTaxLiabilityType, -} -impl<'a> CreateSubscriptionAutomaticTaxLiability<'a> { - pub fn new(type_: CreateSubscriptionAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateSubscriptionAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. -/// When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionBillingCycleAnchorConfig { - /// The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31. - pub day_of_month: i64, - /// The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23. + pub billing_thresholds: Option, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub hour: Option, - /// The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59. + pub metadata: Option<&'a std::collections::HashMap>, + /// Plan ID for this item, as a string. #[serde(skip_serializing_if = "Option::is_none")] - pub minute: Option, - /// The month to start full cycle billing periods. Ranges from 1 to 12. + pub plan: Option<&'a str>, + /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] - pub month: Option, - /// The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59. + pub price: Option<&'a str>, + /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub second: Option, -} -impl CreateSubscriptionBillingCycleAnchorConfig { - pub fn new(day_of_month: i64) -> Self { - Self { day_of_month, hour: None, minute: None, month: None, second: None } - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionInvoiceSettings<'a> { - /// The account tax IDs associated with the subscription. - /// Will be set on invoices generated by the subscription. + pub price_data: Option>, + /// Quantity for this item. #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. + pub quantity: Option, + /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. + /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. + /// When updating, pass an empty string to remove previously-defined tax rates. #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, + pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateSubscriptionInvoiceSettings<'a> { +impl<'a> CreateSubscriptionBuilderItems<'a> { pub fn new() -> Self { Self::default() } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. +/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. +pub struct CreateSubscriptionBuilderItemsPriceData<'a> { + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// The ID of the product that this price will belong to. + pub product: &'a str, + /// The recurring components of a price such as `interval` and `interval_count`. + pub recurring: CreateSubscriptionBuilderItemsPriceDataRecurring, + /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionInvoiceSettingsIssuerType, -} -impl<'a> CreateSubscriptionInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreateSubscriptionInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionInvoiceSettingsIssuerType { - Account, - Self_, -} -impl CreateSubscriptionInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// A list of up to 20 subscription items, each with an attached price. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionItems<'a> { - /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. - /// When updating, pass an empty string to remove previously-defined thresholds. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// Plan ID for this item, as a string. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option<&'a str>, - /// The ID of the price object. - #[serde(skip_serializing_if = "Option::is_none")] - pub price: Option<&'a str>, - /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. - #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, - /// Quantity for this item. - #[serde(skip_serializing_if = "Option::is_none")] - pub quantity: Option, - /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. - /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. - /// When updating, pass an empty string to remove previously-defined tax rates. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_rates: Option<&'a [&'a str]>, -} -impl<'a> CreateSubscriptionItems<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemsPriceData<'a> { - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// The ID of the product that this price will belong to. - pub product: &'a str, - /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: CreateSubscriptionItemsPriceDataRecurring, - /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. - /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. - /// One of `inclusive`, `exclusive`, or `unspecified`. - /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -914,11 +700,11 @@ pub struct CreateSubscriptionItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateSubscriptionItemsPriceData<'a> { +impl<'a> CreateSubscriptionBuilderItemsPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: CreateSubscriptionItemsPriceDataRecurring, + recurring: CreateSubscriptionBuilderItemsPriceDataRecurring, ) -> Self { Self { currency, @@ -932,31 +718,31 @@ impl<'a> CreateSubscriptionItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemsPriceDataRecurring { +pub struct CreateSubscriptionBuilderItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateSubscriptionItemsPriceDataRecurringInterval, + pub interval: CreateSubscriptionBuilderItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateSubscriptionItemsPriceDataRecurring { - pub fn new(interval: CreateSubscriptionItemsPriceDataRecurringInterval) -> Self { +impl CreateSubscriptionBuilderItemsPriceDataRecurring { + pub fn new(interval: CreateSubscriptionBuilderItemsPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemsPriceDataRecurringInterval { +pub enum CreateSubscriptionBuilderItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateSubscriptionItemsPriceDataRecurringInterval { +impl CreateSubscriptionBuilderItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemsPriceDataRecurringInterval::*; + use CreateSubscriptionBuilderItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -966,10 +752,10 @@ impl CreateSubscriptionItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateSubscriptionItemsPriceDataRecurringInterval { +impl std::str::FromStr for CreateSubscriptionBuilderItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemsPriceDataRecurringInterval::*; + use CreateSubscriptionBuilderItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -979,18 +765,18 @@ impl std::str::FromStr for CreateSubscriptionItemsPriceDataRecurringInterval { } } } -impl std::fmt::Display for CreateSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Display for CreateSubscriptionBuilderItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Debug for CreateSubscriptionBuilderItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemsPriceDataRecurringInterval { +impl serde::Serialize for CreateSubscriptionBuilderItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1003,14 +789,14 @@ impl serde::Serialize for CreateSubscriptionItemsPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemsPriceDataTaxBehavior { +pub enum CreateSubscriptionBuilderItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateSubscriptionItemsPriceDataTaxBehavior { +impl CreateSubscriptionBuilderItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemsPriceDataTaxBehavior::*; + use CreateSubscriptionBuilderItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1019,10 +805,10 @@ impl CreateSubscriptionItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateSubscriptionItemsPriceDataTaxBehavior { +impl std::str::FromStr for CreateSubscriptionBuilderItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemsPriceDataTaxBehavior::*; + use CreateSubscriptionBuilderItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1031,18 +817,18 @@ impl std::str::FromStr for CreateSubscriptionItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Display for CreateSubscriptionBuilderItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Debug for CreateSubscriptionBuilderItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemsPriceDataTaxBehavior { +impl serde::Serialize for CreateSubscriptionBuilderItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1073,15 +859,15 @@ impl serde::Serialize for CreateSubscriptionItemsPriceDataTaxBehavior { /// /// Subscriptions with `collection_method=send_invoice` are automatically activated regardless of the first invoice status. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentBehavior { +pub enum CreateSubscriptionBuilderPaymentBehavior { AllowIncomplete, DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } -impl CreateSubscriptionPaymentBehavior { +impl CreateSubscriptionBuilderPaymentBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentBehavior::*; + use CreateSubscriptionBuilderPaymentBehavior::*; match self { AllowIncomplete => "allow_incomplete", DefaultIncomplete => "default_incomplete", @@ -1091,10 +877,10 @@ impl CreateSubscriptionPaymentBehavior { } } -impl std::str::FromStr for CreateSubscriptionPaymentBehavior { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentBehavior::*; + use CreateSubscriptionBuilderPaymentBehavior::*; match s { "allow_incomplete" => Ok(AllowIncomplete), "default_incomplete" => Ok(DefaultIncomplete), @@ -1104,18 +890,18 @@ impl std::str::FromStr for CreateSubscriptionPaymentBehavior { } } } -impl std::fmt::Display for CreateSubscriptionPaymentBehavior { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentBehavior { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentBehavior { +impl serde::Serialize for CreateSubscriptionBuilderPaymentBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1125,38 +911,40 @@ impl serde::Serialize for CreateSubscriptionPaymentBehavior { } /// Payment settings to pass to invoices created by the subscription. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettings<'a> { +pub struct CreateSubscriptionBuilderPaymentSettings<'a> { /// Payment-method-specific configuration to provide to invoices created by the subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: + Option>, /// The list of payment method types (e.g. /// card) to provide to the invoice’s PaymentIntent. /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [CreateSubscriptionPaymentSettingsPaymentMethodTypes]>, + pub payment_method_types: + Option<&'a [CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes]>, /// Either `off`, or `on_subscription`. /// With `on_subscription` Stripe updates `subscription.default_payment_method` when a subscription payment succeeds. #[serde(skip_serializing_if = "Option::is_none")] pub save_default_payment_method: - Option, + Option, } -impl<'a> CreateSubscriptionPaymentSettings<'a> { +impl<'a> CreateSubscriptionBuilderPaymentSettings<'a> { pub fn new() -> Self { Self::default() } } /// Payment-method-specific configuration to provide to invoices created by the subscription. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptions<'a> { /// This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, + pub acss_debit: Option, /// This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub customer_balance: Option>, @@ -1166,109 +954,100 @@ pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option>, + Option>, } -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { +impl<'a> CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebit { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option, + Option, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, + pub verification_method: Option< + CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod, + >, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebit { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { /// Transaction type of the mandate. - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: Option< - CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub transaction_type: Option, + } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { pub fn new() -> Self { Self::default() } } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { - Business => "business", - Personal => "personal", +Business => "business", +Personal => "personal", + } } } -impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { - "business" => Ok(Business), - "personal" => Ok(Personal), - _ => Err(()), + "business" => Ok(Business), +"personal" => Ok(Personal), +_ => Err(()) + } } } -impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -1278,11 +1057,11 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationM } impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -1292,7 +1071,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1300,14 +1079,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -1318,28 +1097,29 @@ impl serde::Serialize } /// This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: - Option, + pub preferred_language: Option< + CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage, + >, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -1350,11 +1130,11 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLan } impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -1365,7 +1145,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1373,14 +1153,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn serialize(&self, serializer: S) -> Result where @@ -1391,31 +1171,31 @@ impl serde::Serialize } /// This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCard<'a> { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCard<'a> { /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option>, + Option>, /// Selected network to process this Subscription on. /// Depends on the available networks of the card attached to the Subscription. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, + Option, } -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsCard<'a> { +impl<'a> CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -1423,13 +1203,14 @@ pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptio /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_type: - Option, + pub amount_type: Option< + CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType, + >, /// A description of the mandate or subscription that is meant to be displayed to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, } -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { pub fn new() -> Self { Self::default() } @@ -1438,13 +1219,13 @@ impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -1453,11 +1234,11 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmou } impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -1466,7 +1247,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1474,14 +1255,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn serialize(&self, serializer: S) -> Result where @@ -1494,7 +1275,7 @@ impl serde::Serialize /// Depends on the available networks of the card attached to the Subscription. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -1507,9 +1288,9 @@ pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -1526,10 +1307,10 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -1546,18 +1327,18 @@ impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodOptions } } } -impl std::fmt::Display for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1569,38 +1350,35 @@ impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodOptionsC /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1608,14 +1386,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where @@ -1626,38 +1404,37 @@ impl serde::Serialize } /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: Option< - CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub financial_connections: Option>, /// Verification method for the intent - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: Option< - CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub verification_method: Option, + } -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +pub struct CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, +pub permissions: Option<&'a [CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, +pub prefetch: Option<&'a [CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, } impl<'a> - CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> + CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections< + 'a, + > { pub fn new() -> Self { Self::default() @@ -1667,16 +1444,16 @@ impl<'a> /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { Balances, Ownership, PaymentMethod, Transactions, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -1687,10 +1464,10 @@ Transactions => "transactions", } } -impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -1701,79 +1478,76 @@ _ => Err(()) } } } -impl std::fmt::Display for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl - CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { - Balances => "balances", - Transactions => "transactions", +Balances => "balances", + } } } -impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), -"transactions" => Ok(Transactions), _ => Err(()) } } } -impl std::fmt::Display for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ Automatic, Instant, Microdeposits, } -impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -1783,11 +1557,11 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificat } impl std::str::FromStr - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -1797,7 +1571,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1805,14 +1579,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -1826,7 +1600,7 @@ impl serde::Serialize /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSubscriptionPaymentSettingsPaymentMethodTypes { +pub enum CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { AchCreditTransfer, AchDebit, AcssDebit, @@ -1837,14 +1611,12 @@ pub enum CreateSubscriptionPaymentSettingsPaymentMethodTypes { Card, Cashapp, CustomerBalance, - Eps, Fpx, Giropay, Grabpay, Ideal, Konbini, Link, - P24, Paynow, Paypal, Promptpay, @@ -1856,9 +1628,9 @@ pub enum CreateSubscriptionPaymentSettingsPaymentMethodTypes { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSubscriptionPaymentSettingsPaymentMethodTypes { +impl CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsPaymentMethodTypes::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes::*; match self { AchCreditTransfer => "ach_credit_transfer", AchDebit => "ach_debit", @@ -1870,14 +1642,12 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodTypes { Card => "card", Cashapp => "cashapp", CustomerBalance => "customer_balance", - Eps => "eps", Fpx => "fpx", Giropay => "giropay", Grabpay => "grabpay", Ideal => "ideal", Konbini => "konbini", Link => "link", - P24 => "p24", Paynow => "paynow", Paypal => "paypal", Promptpay => "promptpay", @@ -1891,10 +1661,10 @@ impl CreateSubscriptionPaymentSettingsPaymentMethodTypes { } } -impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsPaymentMethodTypes::*; + use CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes::*; match s { "ach_credit_transfer" => Ok(AchCreditTransfer), "ach_debit" => Ok(AchDebit), @@ -1906,14 +1676,12 @@ impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodTypes { "card" => Ok(Card), "cashapp" => Ok(Cashapp), "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), "fpx" => Ok(Fpx), "giropay" => Ok(Giropay), "grabpay" => Ok(Grabpay), "ideal" => Ok(Ideal), "konbini" => Ok(Konbini), "link" => Ok(Link), - "p24" => Ok(P24), "paynow" => Ok(Paynow), "paypal" => Ok(Paypal), "promptpay" => Ok(Promptpay), @@ -1926,18 +1694,18 @@ impl std::str::FromStr for CreateSubscriptionPaymentSettingsPaymentMethodTypes { } } } -impl std::fmt::Display for CreateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodTypes { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1948,13 +1716,13 @@ impl serde::Serialize for CreateSubscriptionPaymentSettingsPaymentMethodTypes { /// Either `off`, or `on_subscription`. /// With `on_subscription` Stripe updates `subscription.default_payment_method` when a subscription payment succeeds. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +pub enum CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { Off, OnSubscription, } -impl CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod::*; + use CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod::*; match self { Off => "off", OnSubscription => "on_subscription", @@ -1962,10 +1730,10 @@ impl CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { } } -impl std::str::FromStr for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::str::FromStr for CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod::*; + use CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod::*; match s { "off" => Ok(Off), "on_subscription" => Ok(OnSubscription), @@ -1973,18 +1741,18 @@ impl std::str::FromStr for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMe } } } -impl std::fmt::Display for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::fmt::Display for CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::fmt::Debug for CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl serde::Serialize for CreateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1995,31 +1763,31 @@ impl serde::Serialize for CreateSubscriptionPaymentSettingsSaveDefaultPaymentMet /// Specifies an interval for how often to bill for any pending invoice items. /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionPendingInvoiceItemInterval { +pub struct CreateSubscriptionBuilderPendingInvoiceItemInterval { /// Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateSubscriptionPendingInvoiceItemIntervalInterval, + pub interval: CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval, /// The number of intervals between invoices. /// For example, `interval=month` and `interval_count=3` bills every 3 months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateSubscriptionPendingInvoiceItemInterval { - pub fn new(interval: CreateSubscriptionPendingInvoiceItemIntervalInterval) -> Self { +impl CreateSubscriptionBuilderPendingInvoiceItemInterval { + pub fn new(interval: CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionPendingInvoiceItemIntervalInterval { +pub enum CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { Day, Month, Week, Year, } -impl CreateSubscriptionPendingInvoiceItemIntervalInterval { +impl CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { pub fn as_str(self) -> &'static str { - use CreateSubscriptionPendingInvoiceItemIntervalInterval::*; + use CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval::*; match self { Day => "day", Month => "month", @@ -2029,10 +1797,10 @@ impl CreateSubscriptionPendingInvoiceItemIntervalInterval { } } -impl std::str::FromStr for CreateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::str::FromStr for CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionPendingInvoiceItemIntervalInterval::*; + use CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -2042,18 +1810,18 @@ impl std::str::FromStr for CreateSubscriptionPendingInvoiceItemIntervalInterval } } } -impl std::fmt::Display for CreateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::fmt::Display for CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::fmt::Debug for CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionPendingInvoiceItemIntervalInterval { +impl serde::Serialize for CreateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2064,14 +1832,14 @@ impl serde::Serialize for CreateSubscriptionPendingInvoiceItemIntervalInterval { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) resulting from the `billing_cycle_anchor`. /// If no value is passed, the default is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionProrationBehavior { +pub enum CreateSubscriptionBuilderProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl CreateSubscriptionProrationBehavior { +impl CreateSubscriptionBuilderProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionProrationBehavior::*; + use CreateSubscriptionBuilderProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -2080,10 +1848,10 @@ impl CreateSubscriptionProrationBehavior { } } -impl std::str::FromStr for CreateSubscriptionProrationBehavior { +impl std::str::FromStr for CreateSubscriptionBuilderProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionProrationBehavior::*; + use CreateSubscriptionBuilderProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -2092,18 +1860,18 @@ impl std::str::FromStr for CreateSubscriptionProrationBehavior { } } } -impl std::fmt::Display for CreateSubscriptionProrationBehavior { +impl std::fmt::Display for CreateSubscriptionBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionProrationBehavior { +impl std::fmt::Debug for CreateSubscriptionBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionProrationBehavior { +impl serde::Serialize for CreateSubscriptionBuilderProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2118,44 +1886,45 @@ impl serde::Serialize for CreateSubscriptionProrationBehavior { /// See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateSubscriptionTrialEnd { +pub enum CreateSubscriptionBuilderTrialEnd { Now, Timestamp(stripe_types::Timestamp), } /// Settings related to subscription trials. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionTrialSettings { +pub struct CreateSubscriptionBuilderTrialSettings { /// Defines how the subscription should behave when the user's free trial ends. - pub end_behavior: CreateSubscriptionTrialSettingsEndBehavior, + pub end_behavior: CreateSubscriptionBuilderTrialSettingsEndBehavior, } -impl CreateSubscriptionTrialSettings { - pub fn new(end_behavior: CreateSubscriptionTrialSettingsEndBehavior) -> Self { +impl CreateSubscriptionBuilderTrialSettings { + pub fn new(end_behavior: CreateSubscriptionBuilderTrialSettingsEndBehavior) -> Self { Self { end_behavior } } } /// Defines how the subscription should behave when the user's free trial ends. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionTrialSettingsEndBehavior { +pub struct CreateSubscriptionBuilderTrialSettingsEndBehavior { /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. - pub missing_payment_method: CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, + pub missing_payment_method: + CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod, } -impl CreateSubscriptionTrialSettingsEndBehavior { +impl CreateSubscriptionBuilderTrialSettingsEndBehavior { pub fn new( - missing_payment_method: CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, + missing_payment_method: CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod, ) -> Self { Self { missing_payment_method } } } /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +pub enum CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { Cancel, CreateInvoice, Pause, } -impl CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod::*; + use CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod::*; match self { Cancel => "cancel", CreateInvoice => "create_invoice", @@ -2164,10 +1933,10 @@ impl CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { } } -impl std::str::FromStr for CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::str::FromStr for CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod::*; + use CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod::*; match s { "cancel" => Ok(Cancel), "create_invoice" => Ok(CreateInvoice), @@ -2176,18 +1945,18 @@ impl std::str::FromStr for CreateSubscriptionTrialSettingsEndBehaviorMissingPaym } } } -impl std::fmt::Display for CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::fmt::Display for CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::fmt::Debug for CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl serde::Serialize for CreateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2195,188 +1964,249 @@ impl serde::Serialize for CreateSubscriptionTrialSettingsEndBehaviorMissingPayme serializer.serialize_str(self.as_str()) } } +/// Creates a new subscription on an existing customer. +/// Each customer can have up to 500 active or scheduled subscriptions. +/// +/// When you create a subscription with `collection_method=charge_automatically`, the first invoice is finalized as part of the request. +/// The `payment_behavior` parameter determines the exact behavior of the initial payment. +/// +/// To start subscriptions where the first invoice always begins in a `draft` status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead. +/// Schedules provide the flexibility to model more complex billing configurations that change over time. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSubscription<'a> { + inner: CreateSubscriptionBuilder<'a>, +} impl<'a> CreateSubscription<'a> { - /// Creates a new subscription on an existing customer. - /// Each customer can have up to 500 active or scheduled subscriptions. - /// - /// When you create a subscription with `collection_method=charge_automatically`, the first invoice is finalized as part of the request. - /// The `payment_behavior` parameter determines the exact behavior of the initial payment. - /// - /// To start subscriptions where the first invoice always begins in a `draft` status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead. - /// Schedules provide the flexibility to model more complex billing configurations that change over time. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/subscriptions", self, http_types::Method::Post) + pub fn new(customer: &'a str) -> Self { + Self { inner: CreateSubscriptionBuilder::new(customer) } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ResumeSubscription<'a> { - /// Either `now` or `unchanged`. - /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). - /// Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. - /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. - /// The default value is `create_prorations`. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, - /// If set, the proration will be calculated as though the subscription was resumed at the given time. - /// This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_date: Option, -} -impl<'a> ResumeSubscription<'a> { - pub fn new() -> Self { - Self::default() + pub fn add_invoice_items( + mut self, + add_invoice_items: &'a [CreateSubscriptionBuilderAddInvoiceItems<'a>], + ) -> Self { + self.inner.add_invoice_items = Some(add_invoice_items); + self } -} -/// Either `now` or `unchanged`. -/// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). -/// Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. -/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ResumeSubscriptionBillingCycleAnchor { - Now, - Unchanged, -} -impl ResumeSubscriptionBillingCycleAnchor { - pub fn as_str(self) -> &'static str { - use ResumeSubscriptionBillingCycleAnchor::*; - match self { - Now => "now", - Unchanged => "unchanged", - } + + pub fn application_fee_percent(mut self, application_fee_percent: f64) -> Self { + self.inner.application_fee_percent = Some(application_fee_percent); + self } -} -impl std::str::FromStr for ResumeSubscriptionBillingCycleAnchor { - type Err = (); - fn from_str(s: &str) -> Result { - use ResumeSubscriptionBillingCycleAnchor::*; - match s { - "now" => Ok(Now), - "unchanged" => Ok(Unchanged), - _ => Err(()), - } + pub fn automatic_tax(mut self, automatic_tax: CreateSubscriptionBuilderAutomaticTax) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self } -} -impl std::fmt::Display for ResumeSubscriptionBillingCycleAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn backdate_start_date(mut self, backdate_start_date: stripe_types::Timestamp) -> Self { + self.inner.backdate_start_date = Some(backdate_start_date); + self } -} -impl std::fmt::Debug for ResumeSubscriptionBillingCycleAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn billing_cycle_anchor(mut self, billing_cycle_anchor: stripe_types::Timestamp) -> Self { + self.inner.billing_cycle_anchor = Some(billing_cycle_anchor); + self } -} -impl serde::Serialize for ResumeSubscriptionBillingCycleAnchor { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn billing_thresholds(mut self, billing_thresholds: BillingThresholdsParam) -> Self { + self.inner.billing_thresholds = Some(billing_thresholds); + self } -} -/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. -/// The default value is `create_prorations`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ResumeSubscriptionProrationBehavior { - AlwaysInvoice, - CreateProrations, - None, -} -impl ResumeSubscriptionProrationBehavior { - pub fn as_str(self) -> &'static str { - use ResumeSubscriptionProrationBehavior::*; - match self { - AlwaysInvoice => "always_invoice", - CreateProrations => "create_prorations", - None => "none", - } + + pub fn cancel_at(mut self, cancel_at: stripe_types::Timestamp) -> Self { + self.inner.cancel_at = Some(cancel_at); + self } -} -impl std::str::FromStr for ResumeSubscriptionProrationBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use ResumeSubscriptionProrationBehavior::*; - match s { - "always_invoice" => Ok(AlwaysInvoice), - "create_prorations" => Ok(CreateProrations), - "none" => Ok(None), - _ => Err(()), - } + pub fn cancel_at_period_end(mut self, cancel_at_period_end: bool) -> Self { + self.inner.cancel_at_period_end = Some(cancel_at_period_end); + self } -} -impl std::fmt::Display for ResumeSubscriptionProrationBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn collection_method( + mut self, + collection_method: stripe_shared::SubscriptionCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self } -} -impl std::fmt::Debug for ResumeSubscriptionProrationBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self } -} -impl serde::Serialize for ResumeSubscriptionProrationBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self } -} -impl<'a> ResumeSubscription<'a> { - /// Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. - /// If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. - /// If payment succeeds the subscription will become `active`, and if payment fails the subscription will be `past_due`. - /// The resumption invoice will void automatically if not paid by the expiration date. - pub fn send( - &self, - client: &stripe::Client, - subscription: &stripe_shared::SubscriptionId, - ) -> stripe::Response { - client.send_form( - &format!("/subscriptions/{subscription}/resume"), - self, - http_types::Method::Post, - ) + + pub fn days_until_due(mut self, days_until_due: u32) -> Self { + self.inner.days_until_due = Some(days_until_due); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscription<'a> { - /// A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. - /// You may pass up to 20 items. - #[serde(skip_serializing_if = "Option::is_none")] - pub add_invoice_items: Option<&'a [UpdateSubscriptionAddInvoiceItems<'a>]>, - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. - /// The request must be made by a platform account on a connected account in order to set an application fee percentage. - /// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). - #[serde(skip_serializing_if = "Option::is_none")] - pub application_fee_percent: Option, - /// Automatic tax settings for this subscription. - /// We recommend you only include this parameter when the existing value is being changed. - #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, - /// Either `now` or `unchanged`. - /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). - /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, - /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. - /// Pass an empty string to remove previously-defined thresholds. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, - /// A timestamp at which the subscription should cancel. - /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. - /// If set during a future period, this will always cause a proration for that period. + + pub fn default_payment_method(mut self, default_payment_method: &'a str) -> Self { + self.inner.default_payment_method = Some(default_payment_method); + self + } + + pub fn default_source(mut self, default_source: &'a str) -> Self { + self.inner.default_source = Some(default_source); + self + } + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn items(mut self, items: &'a [CreateSubscriptionBuilderItems<'a>]) -> Self { + self.inner.items = Some(items); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn off_session(mut self, off_session: bool) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn payment_behavior( + mut self, + payment_behavior: CreateSubscriptionBuilderPaymentBehavior, + ) -> Self { + self.inner.payment_behavior = Some(payment_behavior); + self + } + + pub fn payment_settings( + mut self, + payment_settings: CreateSubscriptionBuilderPaymentSettings<'a>, + ) -> Self { + self.inner.payment_settings = Some(payment_settings); + self + } + + pub fn pending_invoice_item_interval( + mut self, + pending_invoice_item_interval: CreateSubscriptionBuilderPendingInvoiceItemInterval, + ) -> Self { + self.inner.pending_invoice_item_interval = Some(pending_invoice_item_interval); + self + } + + pub fn promotion_code(mut self, promotion_code: &'a str) -> Self { + self.inner.promotion_code = Some(promotion_code); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: CreateSubscriptionBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn trial_end(mut self, trial_end: CreateSubscriptionBuilderTrialEnd) -> Self { + self.inner.trial_end = Some(trial_end); + self + } + + pub fn trial_from_plan(mut self, trial_from_plan: bool) -> Self { + self.inner.trial_from_plan = Some(trial_from_plan); + self + } + + pub fn trial_period_days(mut self, trial_period_days: u32) -> Self { + self.inner.trial_period_days = Some(trial_period_days); + self + } + + pub fn trial_settings( + mut self, + trial_settings: CreateSubscriptionBuilderTrialSettings, + ) -> Self { + self.inner.trial_settings = Some(trial_settings); + self + } +} +impl CreateSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateSubscription<'_> { + type Output = stripe_shared::Subscription; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/subscriptions").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateSubscriptionBuilder<'a> { + /// A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. + /// You may pass up to 20 items. + #[serde(skip_serializing_if = "Option::is_none")] + pub add_invoice_items: Option<&'a [UpdateSubscriptionBuilderAddInvoiceItems<'a>]>, + /// A non-negative decimal between 0 and 100, with at most two decimal places. + /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. + /// The request must be made by a platform account on a connected account in order to set an application fee percentage. + /// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + #[serde(skip_serializing_if = "Option::is_none")] + pub application_fee_percent: Option, + /// Automatic tax settings for this subscription. + /// We recommend you only include this parameter when the existing value is being changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Either `now` or `unchanged`. + /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). + /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_cycle_anchor: Option, + /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. + /// Pass an empty string to remove previously-defined thresholds. + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_thresholds: Option, + /// A timestamp at which the subscription should cancel. + /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. + /// If set during a future period, this will always cause a proration for that period. #[serde(skip_serializing_if = "Option::is_none")] pub cancel_at: Option, /// Boolean indicating whether this subscription should cancel at the end of the current period. @@ -2384,7 +2214,7 @@ pub struct UpdateSubscription<'a> { pub cancel_at_period_end: Option, /// Details about why this subscription was cancelled #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_details: Option>, + pub cancellation_details: Option>, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -2423,12 +2253,9 @@ pub struct UpdateSubscription<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// All invoices will be billed using the specified settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, /// A list of up to 20 subscription items, each with an attached price. #[serde(skip_serializing_if = "Option::is_none")] - pub items: Option<&'a [UpdateSubscriptionItems<'a>]>, + pub items: Option<&'a [UpdateSubscriptionBuilderItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -2443,7 +2270,7 @@ pub struct UpdateSubscription<'a> { pub on_behalf_of: Option<&'a str>, /// If specified, payment collection for this subscription will be paused. #[serde(skip_serializing_if = "Option::is_none")] - pub pause_collection: Option, + pub pause_collection: Option, /// Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. /// This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. /// For example, SCA regulation may require 3DS authentication to complete payment. @@ -2462,14 +2289,14 @@ pub struct UpdateSubscription<'a> { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_behavior: Option, + pub payment_behavior: Option, /// Payment settings to pass to invoices created by the subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_settings: Option>, + pub payment_settings: Option>, /// Specifies an interval for how often to bill for any pending invoice items. /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. #[serde(skip_serializing_if = "Option::is_none")] - pub pending_invoice_item_interval: Option, + pub pending_invoice_item_interval: Option, /// The promotion code to apply to this subscription. /// A promotion code applied to a subscription will only affect invoices created for that particular subscription. #[serde(skip_serializing_if = "Option::is_none")] @@ -2477,7 +2304,7 @@ pub struct UpdateSubscription<'a> { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// If set, the proration will be calculated as though the subscription was updated at the given time. /// This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. /// It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. @@ -2493,7 +2320,7 @@ pub struct UpdateSubscription<'a> { /// The special value `now` can be provided to end the customer's trial immediately. /// Can be at most two years from `billing_cycle_anchor`. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_end: Option, + pub trial_end: Option, /// Indicates if a plan's `trial_period_days` should be applied to the subscription. /// Setting `trial_end` per subscription is preferred, and this defaults to `false`. /// Setting this flag to `true` together with `trial_end` is not allowed. @@ -2502,9 +2329,9 @@ pub struct UpdateSubscription<'a> { pub trial_from_plan: Option, /// Settings related to subscription trials. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_settings: Option, + pub trial_settings: Option, } -impl<'a> UpdateSubscription<'a> { +impl<'a> UpdateSubscriptionBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -2512,13 +2339,13 @@ impl<'a> UpdateSubscription<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. /// You may pass up to 20 items. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionAddInvoiceItems<'a> { +pub struct UpdateSubscriptionBuilderAddInvoiceItems<'a> { /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. Defaults to 1. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -2526,14 +2353,14 @@ pub struct UpdateSubscriptionAddInvoiceItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateSubscriptionAddInvoiceItems<'a> { +impl<'a> UpdateSubscriptionBuilderAddInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionAddInvoiceItemsPriceData<'a> { +pub struct UpdateSubscriptionBuilderAddInvoiceItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -2544,7 +2371,7 @@ pub struct UpdateSubscriptionAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -2553,7 +2380,7 @@ pub struct UpdateSubscriptionAddInvoiceItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateSubscriptionAddInvoiceItemsPriceData<'a> { +impl<'a> UpdateSubscriptionBuilderAddInvoiceItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -2563,14 +2390,14 @@ impl<'a> UpdateSubscriptionAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +pub enum UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -2579,10 +2406,10 @@ impl UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -2591,18 +2418,18 @@ impl std::str::FromStr for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior } } } -impl std::fmt::Display for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior { +impl serde::Serialize for UpdateSubscriptionBuilderAddInvoiceItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2613,94 +2440,26 @@ impl serde::Serialize for UpdateSubscriptionAddInvoiceItemsPriceDataTaxBehavior /// Automatic tax settings for this subscription. /// We recommend you only include this parameter when the existing value is being changed. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionAutomaticTax<'a> { +pub struct UpdateSubscriptionBuilderAutomaticTax { /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, } -impl<'a> UpdateSubscriptionAutomaticTax<'a> { +impl UpdateSubscriptionBuilderAutomaticTax { pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionAutomaticTaxLiabilityType, -} -impl<'a> UpdateSubscriptionAutomaticTaxLiability<'a> { - pub fn new(type_: UpdateSubscriptionAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdateSubscriptionAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + Self { enabled } } } /// Either `now` or `unchanged`. /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionBillingCycleAnchor { +pub enum UpdateSubscriptionBuilderBillingCycleAnchor { Now, Unchanged, } -impl UpdateSubscriptionBillingCycleAnchor { +impl UpdateSubscriptionBuilderBillingCycleAnchor { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionBillingCycleAnchor::*; + use UpdateSubscriptionBuilderBillingCycleAnchor::*; match self { Now => "now", Unchanged => "unchanged", @@ -2708,10 +2467,10 @@ impl UpdateSubscriptionBillingCycleAnchor { } } -impl std::str::FromStr for UpdateSubscriptionBillingCycleAnchor { +impl std::str::FromStr for UpdateSubscriptionBuilderBillingCycleAnchor { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionBillingCycleAnchor::*; + use UpdateSubscriptionBuilderBillingCycleAnchor::*; match s { "now" => Ok(Now), "unchanged" => Ok(Unchanged), @@ -2719,18 +2478,18 @@ impl std::str::FromStr for UpdateSubscriptionBillingCycleAnchor { } } } -impl std::fmt::Display for UpdateSubscriptionBillingCycleAnchor { +impl std::fmt::Display for UpdateSubscriptionBuilderBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionBillingCycleAnchor { +impl std::fmt::Debug for UpdateSubscriptionBuilderBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionBillingCycleAnchor { +impl serde::Serialize for UpdateSubscriptionBuilderBillingCycleAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2740,22 +2499,22 @@ impl serde::Serialize for UpdateSubscriptionBillingCycleAnchor { } /// Details about why this subscription was cancelled #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionCancellationDetails<'a> { +pub struct UpdateSubscriptionBuilderCancellationDetails<'a> { /// Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user. #[serde(skip_serializing_if = "Option::is_none")] pub comment: Option<&'a str>, /// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. #[serde(skip_serializing_if = "Option::is_none")] - pub feedback: Option, + pub feedback: Option, } -impl<'a> UpdateSubscriptionCancellationDetails<'a> { +impl<'a> UpdateSubscriptionBuilderCancellationDetails<'a> { pub fn new() -> Self { Self::default() } } /// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionCancellationDetailsFeedback { +pub enum UpdateSubscriptionBuilderCancellationDetailsFeedback { CustomerService, LowQuality, MissingFeatures, @@ -2765,9 +2524,9 @@ pub enum UpdateSubscriptionCancellationDetailsFeedback { TooExpensive, Unused, } -impl UpdateSubscriptionCancellationDetailsFeedback { +impl UpdateSubscriptionBuilderCancellationDetailsFeedback { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionCancellationDetailsFeedback::*; + use UpdateSubscriptionBuilderCancellationDetailsFeedback::*; match self { CustomerService => "customer_service", LowQuality => "low_quality", @@ -2781,10 +2540,10 @@ impl UpdateSubscriptionCancellationDetailsFeedback { } } -impl std::str::FromStr for UpdateSubscriptionCancellationDetailsFeedback { +impl std::str::FromStr for UpdateSubscriptionBuilderCancellationDetailsFeedback { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionCancellationDetailsFeedback::*; + use UpdateSubscriptionBuilderCancellationDetailsFeedback::*; match s { "customer_service" => Ok(CustomerService), "low_quality" => Ok(LowQuality), @@ -2798,97 +2557,18 @@ impl std::str::FromStr for UpdateSubscriptionCancellationDetailsFeedback { } } } -impl std::fmt::Display for UpdateSubscriptionCancellationDetailsFeedback { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionCancellationDetailsFeedback { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionCancellationDetailsFeedback { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionInvoiceSettings<'a> { - /// The account tax IDs associated with the subscription. - /// Will be set on invoices generated by the subscription. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> UpdateSubscriptionInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionInvoiceSettingsIssuerType, -} -impl<'a> UpdateSubscriptionInvoiceSettingsIssuer<'a> { - pub fn new(type_: UpdateSubscriptionInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionInvoiceSettingsIssuerType { - Account, - Self_, -} -impl UpdateSubscriptionInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionInvoiceSettingsIssuerType { +impl std::fmt::Display for UpdateSubscriptionBuilderCancellationDetailsFeedback { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionInvoiceSettingsIssuerType { +impl std::fmt::Debug for UpdateSubscriptionBuilderCancellationDetailsFeedback { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionInvoiceSettingsIssuerType { +impl serde::Serialize for UpdateSubscriptionBuilderCancellationDetailsFeedback { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2898,7 +2578,7 @@ impl serde::Serialize for UpdateSubscriptionInvoiceSettingsIssuerType { } /// A list of up to 20 subscription items, each with an attached price. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionItems<'a> { +pub struct UpdateSubscriptionBuilderItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -2928,7 +2608,7 @@ pub struct UpdateSubscriptionItems<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -2938,27 +2618,27 @@ pub struct UpdateSubscriptionItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateSubscriptionItems<'a> { +impl<'a> UpdateSubscriptionBuilderItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemsPriceData<'a> { +pub struct UpdateSubscriptionBuilderItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: UpdateSubscriptionItemsPriceDataRecurring, + pub recurring: UpdateSubscriptionBuilderItemsPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -2967,11 +2647,11 @@ pub struct UpdateSubscriptionItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateSubscriptionItemsPriceData<'a> { +impl<'a> UpdateSubscriptionBuilderItemsPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: UpdateSubscriptionItemsPriceDataRecurring, + recurring: UpdateSubscriptionBuilderItemsPriceDataRecurring, ) -> Self { Self { currency, @@ -2985,31 +2665,31 @@ impl<'a> UpdateSubscriptionItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemsPriceDataRecurring { +pub struct UpdateSubscriptionBuilderItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpdateSubscriptionItemsPriceDataRecurringInterval, + pub interval: UpdateSubscriptionBuilderItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpdateSubscriptionItemsPriceDataRecurring { - pub fn new(interval: UpdateSubscriptionItemsPriceDataRecurringInterval) -> Self { +impl UpdateSubscriptionBuilderItemsPriceDataRecurring { + pub fn new(interval: UpdateSubscriptionBuilderItemsPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemsPriceDataRecurringInterval { +pub enum UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl UpdateSubscriptionItemsPriceDataRecurringInterval { +impl UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemsPriceDataRecurringInterval::*; + use UpdateSubscriptionBuilderItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -3019,10 +2699,10 @@ impl UpdateSubscriptionItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for UpdateSubscriptionItemsPriceDataRecurringInterval { +impl std::str::FromStr for UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemsPriceDataRecurringInterval::*; + use UpdateSubscriptionBuilderItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -3032,18 +2712,18 @@ impl std::str::FromStr for UpdateSubscriptionItemsPriceDataRecurringInterval { } } } -impl std::fmt::Display for UpdateSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Display for UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemsPriceDataRecurringInterval { +impl std::fmt::Debug for UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemsPriceDataRecurringInterval { +impl serde::Serialize for UpdateSubscriptionBuilderItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3056,14 +2736,14 @@ impl serde::Serialize for UpdateSubscriptionItemsPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemsPriceDataTaxBehavior { +pub enum UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateSubscriptionItemsPriceDataTaxBehavior { +impl UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionBuilderItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -3072,10 +2752,10 @@ impl UpdateSubscriptionItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateSubscriptionItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionBuilderItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -3084,18 +2764,18 @@ impl std::str::FromStr for UpdateSubscriptionItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemsPriceDataTaxBehavior { +impl serde::Serialize for UpdateSubscriptionBuilderItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3105,30 +2785,30 @@ impl serde::Serialize for UpdateSubscriptionItemsPriceDataTaxBehavior { } /// If specified, payment collection for this subscription will be paused. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionPauseCollection { +pub struct UpdateSubscriptionBuilderPauseCollection { /// The payment collection behavior for this subscription while paused. /// One of `keep_as_draft`, `mark_uncollectible`, or `void`. - pub behavior: UpdateSubscriptionPauseCollectionBehavior, + pub behavior: UpdateSubscriptionBuilderPauseCollectionBehavior, /// The time after which the subscription will resume collecting payments. #[serde(skip_serializing_if = "Option::is_none")] pub resumes_at: Option, } -impl UpdateSubscriptionPauseCollection { - pub fn new(behavior: UpdateSubscriptionPauseCollectionBehavior) -> Self { +impl UpdateSubscriptionBuilderPauseCollection { + pub fn new(behavior: UpdateSubscriptionBuilderPauseCollectionBehavior) -> Self { Self { behavior, resumes_at: None } } } /// The payment collection behavior for this subscription while paused. /// One of `keep_as_draft`, `mark_uncollectible`, or `void`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPauseCollectionBehavior { +pub enum UpdateSubscriptionBuilderPauseCollectionBehavior { KeepAsDraft, MarkUncollectible, Void, } -impl UpdateSubscriptionPauseCollectionBehavior { +impl UpdateSubscriptionBuilderPauseCollectionBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPauseCollectionBehavior::*; + use UpdateSubscriptionBuilderPauseCollectionBehavior::*; match self { KeepAsDraft => "keep_as_draft", MarkUncollectible => "mark_uncollectible", @@ -3137,10 +2817,10 @@ impl UpdateSubscriptionPauseCollectionBehavior { } } -impl std::str::FromStr for UpdateSubscriptionPauseCollectionBehavior { +impl std::str::FromStr for UpdateSubscriptionBuilderPauseCollectionBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPauseCollectionBehavior::*; + use UpdateSubscriptionBuilderPauseCollectionBehavior::*; match s { "keep_as_draft" => Ok(KeepAsDraft), "mark_uncollectible" => Ok(MarkUncollectible), @@ -3149,18 +2829,18 @@ impl std::str::FromStr for UpdateSubscriptionPauseCollectionBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionPauseCollectionBehavior { +impl std::fmt::Display for UpdateSubscriptionBuilderPauseCollectionBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPauseCollectionBehavior { +impl std::fmt::Debug for UpdateSubscriptionBuilderPauseCollectionBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPauseCollectionBehavior { +impl serde::Serialize for UpdateSubscriptionBuilderPauseCollectionBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3186,15 +2866,15 @@ impl serde::Serialize for UpdateSubscriptionPauseCollectionBehavior { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentBehavior { +pub enum UpdateSubscriptionBuilderPaymentBehavior { AllowIncomplete, DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } -impl UpdateSubscriptionPaymentBehavior { +impl UpdateSubscriptionBuilderPaymentBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentBehavior::*; + use UpdateSubscriptionBuilderPaymentBehavior::*; match self { AllowIncomplete => "allow_incomplete", DefaultIncomplete => "default_incomplete", @@ -3204,10 +2884,10 @@ impl UpdateSubscriptionPaymentBehavior { } } -impl std::str::FromStr for UpdateSubscriptionPaymentBehavior { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentBehavior::*; + use UpdateSubscriptionBuilderPaymentBehavior::*; match s { "allow_incomplete" => Ok(AllowIncomplete), "default_incomplete" => Ok(DefaultIncomplete), @@ -3217,18 +2897,18 @@ impl std::str::FromStr for UpdateSubscriptionPaymentBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionPaymentBehavior { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentBehavior { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentBehavior { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3238,38 +2918,40 @@ impl serde::Serialize for UpdateSubscriptionPaymentBehavior { } /// Payment settings to pass to invoices created by the subscription. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettings<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettings<'a> { /// Payment-method-specific configuration to provide to invoices created by the subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: + Option>, /// The list of payment method types (e.g. /// card) to provide to the invoice’s PaymentIntent. /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [UpdateSubscriptionPaymentSettingsPaymentMethodTypes]>, + pub payment_method_types: + Option<&'a [UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes]>, /// Either `off`, or `on_subscription`. /// With `on_subscription` Stripe updates `subscription.default_payment_method` when a subscription payment succeeds. #[serde(skip_serializing_if = "Option::is_none")] pub save_default_payment_method: - Option, + Option, } -impl<'a> UpdateSubscriptionPaymentSettings<'a> { +impl<'a> UpdateSubscriptionBuilderPaymentSettings<'a> { pub fn new() -> Self { Self::default() } } /// Payment-method-specific configuration to provide to invoices created by the subscription. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptions<'a> { /// This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, + pub acss_debit: Option, /// This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub customer_balance: Option>, @@ -3279,109 +2961,100 @@ pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option>, + Option>, } -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { +impl<'a> UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// This sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebit { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option, + Option, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, + pub verification_method: Option< + UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod, + >, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebit { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebit { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { /// Transaction type of the mandate. - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: Option< - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub transaction_type: Option, + } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions { pub fn new() -> Self { Self::default() } } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { - Business => "business", - Personal => "personal", +Business => "business", +Personal => "personal", + } } } -impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { - "business" => Ok(Business), - "personal" => Ok(Personal), - _ => Err(()), + "business" => Ok(Business), +"personal" => Ok(Personal), +_ => Err(()) + } } } -impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -3391,11 +3064,11 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationM } impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -3405,7 +3078,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3413,14 +3086,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -3431,28 +3104,29 @@ impl serde::Serialize } /// This sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: - Option, + pub preferred_language: Option< + UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage, + >, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -3463,11 +3137,11 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLan } impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -3478,7 +3152,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3486,14 +3160,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { fn serialize(&self, serializer: S) -> Result where @@ -3504,31 +3178,31 @@ impl serde::Serialize } /// This sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCard<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCard<'a> { /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option>, + Option>, /// Selected network to process this Subscription on. /// Depends on the available networks of the card attached to the Subscription. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, + Option, } -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCard<'a> { +impl<'a> UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -3536,13 +3210,14 @@ pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptio /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_type: - Option, + pub amount_type: Option< + UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType, + >, /// A description of the mandate or subscription that is meant to be displayed to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, } -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptions<'a> { pub fn new() -> Self { Self::default() } @@ -3551,13 +3226,13 @@ impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptions /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -3566,11 +3241,11 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmou } impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -3579,7 +3254,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3587,14 +3262,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardMandateOptionsAmountType { fn serialize(&self, serializer: S) -> Result where @@ -3607,7 +3282,7 @@ impl serde::Serialize /// Depends on the available networks of the card attached to the Subscription. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -3620,9 +3295,9 @@ pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -3639,10 +3314,10 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -3659,18 +3334,18 @@ impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodOptions } } } -impl std::fmt::Display for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardNetwork { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3682,38 +3357,35 @@ impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsC /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3721,14 +3393,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where @@ -3739,38 +3411,37 @@ impl serde::Serialize } /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: Option< - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub financial_connections: Option>, /// Verification method for the intent - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: Option< - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub verification_method: Option, + } -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +pub struct UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, +pub permissions: Option<&'a [UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, +pub prefetch: Option<&'a [UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, } impl<'a> - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> + UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections< + 'a, + > { pub fn new() -> Self { Self::default() @@ -3780,16 +3451,16 @@ impl<'a> /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { Balances, Ownership, PaymentMethod, Transactions, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -3800,10 +3471,10 @@ Transactions => "transactions", } } -impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -3814,79 +3485,76 @@ _ => Err(()) } } } -impl std::fmt::Display for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { - Balances => "balances", - Transactions => "transactions", +Balances => "balances", + } } } -impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), -"transactions" => Ok(Transactions), _ => Err(()) } } } -impl std::fmt::Display for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod +{ Automatic, Instant, Microdeposits, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -3896,11 +3564,11 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificat } impl std::str::FromStr - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -3910,7 +3578,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3918,14 +3586,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod + for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod { fn serialize(&self, serializer: S) -> Result where @@ -3939,7 +3607,7 @@ impl serde::Serialize /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +pub enum UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { AchCreditTransfer, AchDebit, AcssDebit, @@ -3950,14 +3618,12 @@ pub enum UpdateSubscriptionPaymentSettingsPaymentMethodTypes { Card, Cashapp, CustomerBalance, - Eps, Fpx, Giropay, Grabpay, Ideal, Konbini, Link, - P24, Paynow, Paypal, Promptpay, @@ -3969,9 +3635,9 @@ pub enum UpdateSubscriptionPaymentSettingsPaymentMethodTypes { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +impl UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsPaymentMethodTypes::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes::*; match self { AchCreditTransfer => "ach_credit_transfer", AchDebit => "ach_debit", @@ -3983,14 +3649,12 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodTypes { Card => "card", Cashapp => "cashapp", CustomerBalance => "customer_balance", - Eps => "eps", Fpx => "fpx", Giropay => "giropay", Grabpay => "grabpay", Ideal => "ideal", Konbini => "konbini", Link => "link", - P24 => "p24", Paynow => "paynow", Paypal => "paypal", Promptpay => "promptpay", @@ -4004,10 +3668,10 @@ impl UpdateSubscriptionPaymentSettingsPaymentMethodTypes { } } -impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsPaymentMethodTypes::*; + use UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes::*; match s { "ach_credit_transfer" => Ok(AchCreditTransfer), "ach_debit" => Ok(AchDebit), @@ -4019,14 +3683,12 @@ impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { "card" => Ok(Card), "cashapp" => Ok(Cashapp), "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), "fpx" => Ok(Fpx), "giropay" => Ok(Giropay), "grabpay" => Ok(Grabpay), "ideal" => Ok(Ideal), "konbini" => Ok(Konbini), "link" => Ok(Link), - "p24" => Ok(P24), "paynow" => Ok(Paynow), "paypal" => Ok(Paypal), "promptpay" => Ok(Promptpay), @@ -4039,18 +3701,18 @@ impl std::str::FromStr for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { } } } -impl std::fmt::Display for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsPaymentMethodTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4061,13 +3723,13 @@ impl serde::Serialize for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { /// Either `off`, or `on_subscription`. /// With `on_subscription` Stripe updates `subscription.default_payment_method` when a subscription payment succeeds. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +pub enum UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { Off, OnSubscription, } -impl UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod::*; match self { Off => "off", OnSubscription => "on_subscription", @@ -4075,10 +3737,10 @@ impl UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { } } -impl std::str::FromStr for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::str::FromStr for UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod::*; + use UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod::*; match s { "off" => Ok(Off), "on_subscription" => Ok(OnSubscription), @@ -4086,18 +3748,18 @@ impl std::str::FromStr for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMe } } } -impl std::fmt::Display for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::fmt::Display for UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl std::fmt::Debug for UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMethod { +impl serde::Serialize for UpdateSubscriptionBuilderPaymentSettingsSaveDefaultPaymentMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4108,31 +3770,31 @@ impl serde::Serialize for UpdateSubscriptionPaymentSettingsSaveDefaultPaymentMet /// Specifies an interval for how often to bill for any pending invoice items. /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionPendingInvoiceItemInterval { +pub struct UpdateSubscriptionBuilderPendingInvoiceItemInterval { /// Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpdateSubscriptionPendingInvoiceItemIntervalInterval, + pub interval: UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval, /// The number of intervals between invoices. /// For example, `interval=month` and `interval_count=3` bills every 3 months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpdateSubscriptionPendingInvoiceItemInterval { - pub fn new(interval: UpdateSubscriptionPendingInvoiceItemIntervalInterval) -> Self { +impl UpdateSubscriptionBuilderPendingInvoiceItemInterval { + pub fn new(interval: UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionPendingInvoiceItemIntervalInterval { +pub enum UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { Day, Month, Week, Year, } -impl UpdateSubscriptionPendingInvoiceItemIntervalInterval { +impl UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionPendingInvoiceItemIntervalInterval::*; + use UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval::*; match self { Day => "day", Month => "month", @@ -4142,10 +3804,10 @@ impl UpdateSubscriptionPendingInvoiceItemIntervalInterval { } } -impl std::str::FromStr for UpdateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::str::FromStr for UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionPendingInvoiceItemIntervalInterval::*; + use UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -4155,18 +3817,18 @@ impl std::str::FromStr for UpdateSubscriptionPendingInvoiceItemIntervalInterval } } } -impl std::fmt::Display for UpdateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::fmt::Display for UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionPendingInvoiceItemIntervalInterval { +impl std::fmt::Debug for UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionPendingInvoiceItemIntervalInterval { +impl serde::Serialize for UpdateSubscriptionBuilderPendingInvoiceItemIntervalInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4177,14 +3839,14 @@ impl serde::Serialize for UpdateSubscriptionPendingInvoiceItemIntervalInterval { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionProrationBehavior { +pub enum UpdateSubscriptionBuilderProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateSubscriptionProrationBehavior { +impl UpdateSubscriptionBuilderProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionProrationBehavior::*; + use UpdateSubscriptionBuilderProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -4193,10 +3855,10 @@ impl UpdateSubscriptionProrationBehavior { } } -impl std::str::FromStr for UpdateSubscriptionProrationBehavior { +impl std::str::FromStr for UpdateSubscriptionBuilderProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionProrationBehavior::*; + use UpdateSubscriptionBuilderProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -4205,18 +3867,18 @@ impl std::str::FromStr for UpdateSubscriptionProrationBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionProrationBehavior { +impl std::fmt::Display for UpdateSubscriptionBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionProrationBehavior { +impl std::fmt::Debug for UpdateSubscriptionBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionProrationBehavior { +impl serde::Serialize for UpdateSubscriptionBuilderProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4231,44 +3893,45 @@ impl serde::Serialize for UpdateSubscriptionProrationBehavior { /// Can be at most two years from `billing_cycle_anchor`. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateSubscriptionTrialEnd { +pub enum UpdateSubscriptionBuilderTrialEnd { Now, Timestamp(stripe_types::Timestamp), } /// Settings related to subscription trials. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionTrialSettings { +pub struct UpdateSubscriptionBuilderTrialSettings { /// Defines how the subscription should behave when the user's free trial ends. - pub end_behavior: UpdateSubscriptionTrialSettingsEndBehavior, + pub end_behavior: UpdateSubscriptionBuilderTrialSettingsEndBehavior, } -impl UpdateSubscriptionTrialSettings { - pub fn new(end_behavior: UpdateSubscriptionTrialSettingsEndBehavior) -> Self { +impl UpdateSubscriptionBuilderTrialSettings { + pub fn new(end_behavior: UpdateSubscriptionBuilderTrialSettingsEndBehavior) -> Self { Self { end_behavior } } } /// Defines how the subscription should behave when the user's free trial ends. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionTrialSettingsEndBehavior { +pub struct UpdateSubscriptionBuilderTrialSettingsEndBehavior { /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. - pub missing_payment_method: UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, + pub missing_payment_method: + UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod, } -impl UpdateSubscriptionTrialSettingsEndBehavior { +impl UpdateSubscriptionBuilderTrialSettingsEndBehavior { pub fn new( - missing_payment_method: UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, + missing_payment_method: UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod, ) -> Self { Self { missing_payment_method } } } /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +pub enum UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { Cancel, CreateInvoice, Pause, } -impl UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod::*; + use UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod::*; match self { Cancel => "cancel", CreateInvoice => "create_invoice", @@ -4277,10 +3940,10 @@ impl UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { } } -impl std::str::FromStr for UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::str::FromStr for UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod::*; + use UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod::*; match s { "cancel" => Ok(Cancel), "create_invoice" => Ok(CreateInvoice), @@ -4289,18 +3952,18 @@ impl std::str::FromStr for UpdateSubscriptionTrialSettingsEndBehaviorMissingPaym } } } -impl std::fmt::Display for UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::fmt::Display for UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl std::fmt::Debug for UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod { +impl serde::Serialize for UpdateSubscriptionBuilderTrialSettingsEndBehaviorMissingPaymentMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4308,50 +3971,703 @@ impl serde::Serialize for UpdateSubscriptionTrialSettingsEndBehaviorMissingPayme serializer.serialize_str(self.as_str()) } } +/// Updates an existing subscription to match the specified parameters. +/// When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. +/// To preview how the proration is calculated, use the [upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) endpoint. +/// +/// By default, we prorate subscription changes. +/// For example, if a customer signs up on May 1 for a $100 price, they’ll be billed $100 immediately. +/// If on May 15 they switch to a $200 price, then on June 1 they’ll be billed $250 ($200 for a renewal of her subscription, plus a $50 prorating adjustment for half of the previous month’s $100 difference). +/// Similarly, a downgrade generates a credit that is applied to the next invoice. +/// We also prorate when you make quantity changes. +/// +/// Switching prices does not normally change the billing date or generate an immediate charge unless: +/// +///
    +///
  • The billing interval is changed (for example, from monthly to yearly).
  • +///
  • The subscription moves from free to paid, or paid to free.
  • +///
  • A trial starts or ends.
  • +///
+/// +/// In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. +/// +/// If you want to charge for an upgrade immediately, pass `proration_behavior` as `always_invoice` to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. +/// If you pass `create_prorations`, the prorations are created but not automatically invoiced. +/// If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create). +/// +/// If you don’t want to prorate, set the `proration_behavior` option to `none`. +/// With this option, the customer is billed $100 on May 1 and $200 on June 1. +/// Similarly, if you set `proration_behavior` to `none` when switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. +/// We still reset the billing date and bill immediately for the new subscription. +/// +/// Updating the quantity on a subscription many times in an hour may result in [rate limiting](https://stripe.com/docs/rate-limits). +/// If you need to bill for a frequently changing quantity, consider integrating [usage-based billing](https://stripe.com/docs/billing/subscriptions/usage-based) instead. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateSubscription<'a> { + inner: UpdateSubscriptionBuilder<'a>, + subscription_exposed_id: &'a stripe_shared::SubscriptionId, +} impl<'a> UpdateSubscription<'a> { - /// Updates an existing subscription to match the specified parameters. - /// When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. - /// To preview how the proration is calculated, use the [upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) endpoint. - /// - /// By default, we prorate subscription changes. - /// For example, if a customer signs up on May 1 for a $100 price, they’ll be billed $100 immediately. - /// If on May 15 they switch to a $200 price, then on June 1 they’ll be billed $250 ($200 for a renewal of her subscription, plus a $50 prorating adjustment for half of the previous month’s $100 difference). - /// Similarly, a downgrade generates a credit that is applied to the next invoice. - /// We also prorate when you make quantity changes. - /// - /// Switching prices does not normally change the billing date or generate an immediate charge unless: - /// - ///
    - ///
  • The billing interval is changed (for example, from monthly to yearly).
  • - ///
  • The subscription moves from free to paid, or paid to free.
  • - ///
  • A trial starts or ends.
  • - ///
- /// - /// In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. - /// - /// If you want to charge for an upgrade immediately, pass `proration_behavior` as `always_invoice` to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. - /// If you pass `create_prorations`, the prorations are created but not automatically invoiced. - /// If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create). - /// - /// If you don’t want to prorate, set the `proration_behavior` option to `none`. - /// With this option, the customer is billed $100 on May 1 and $200 on June 1. - /// Similarly, if you set `proration_behavior` to `none` when switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. - /// We still reset the billing date and bill immediately for the new subscription. - /// - /// Updating the quantity on a subscription many times in an hour may result in [rate limiting](https://stripe.com/docs/rate-limits). - /// If you need to bill for a frequently changing quantity, consider integrating [usage-based billing](https://stripe.com/docs/billing/subscriptions/usage-based) instead. - pub fn send( - &self, - client: &stripe::Client, - subscription_exposed_id: &stripe_shared::SubscriptionId, - ) -> stripe::Response { - client.send_form( - &format!("/subscriptions/{subscription_exposed_id}"), - self, - http_types::Method::Post, - ) + pub fn new(subscription_exposed_id: &'a stripe_shared::SubscriptionId) -> Self { + Self { subscription_exposed_id, inner: UpdateSubscriptionBuilder::new() } } -} + pub fn add_invoice_items( + mut self, + add_invoice_items: &'a [UpdateSubscriptionBuilderAddInvoiceItems<'a>], + ) -> Self { + self.inner.add_invoice_items = Some(add_invoice_items); + self + } + + pub fn application_fee_percent(mut self, application_fee_percent: f64) -> Self { + self.inner.application_fee_percent = Some(application_fee_percent); + self + } + + pub fn automatic_tax(mut self, automatic_tax: UpdateSubscriptionBuilderAutomaticTax) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn billing_cycle_anchor( + mut self, + billing_cycle_anchor: UpdateSubscriptionBuilderBillingCycleAnchor, + ) -> Self { + self.inner.billing_cycle_anchor = Some(billing_cycle_anchor); + self + } + + pub fn billing_thresholds(mut self, billing_thresholds: BillingThresholdsParam) -> Self { + self.inner.billing_thresholds = Some(billing_thresholds); + self + } + + pub fn cancel_at(mut self, cancel_at: stripe_types::Timestamp) -> Self { + self.inner.cancel_at = Some(cancel_at); + self + } + + pub fn cancel_at_period_end(mut self, cancel_at_period_end: bool) -> Self { + self.inner.cancel_at_period_end = Some(cancel_at_period_end); + self + } + + pub fn cancellation_details( + mut self, + cancellation_details: UpdateSubscriptionBuilderCancellationDetails<'a>, + ) -> Self { + self.inner.cancellation_details = Some(cancellation_details); + self + } + + pub fn collection_method( + mut self, + collection_method: stripe_shared::SubscriptionCollectionMethod, + ) -> Self { + self.inner.collection_method = Some(collection_method); + self + } + + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self + } + + pub fn days_until_due(mut self, days_until_due: u32) -> Self { + self.inner.days_until_due = Some(days_until_due); + self + } + + pub fn default_payment_method(mut self, default_payment_method: &'a str) -> Self { + self.inner.default_payment_method = Some(default_payment_method); + self + } + + pub fn default_source(mut self, default_source: &'a str) -> Self { + self.inner.default_source = Some(default_source); + self + } + + pub fn default_tax_rates(mut self, default_tax_rates: &'a [&'a str]) -> Self { + self.inner.default_tax_rates = Some(default_tax_rates); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn items(mut self, items: &'a [UpdateSubscriptionBuilderItems<'a>]) -> Self { + self.inner.items = Some(items); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn off_session(mut self, off_session: bool) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn pause_collection( + mut self, + pause_collection: UpdateSubscriptionBuilderPauseCollection, + ) -> Self { + self.inner.pause_collection = Some(pause_collection); + self + } + + pub fn payment_behavior( + mut self, + payment_behavior: UpdateSubscriptionBuilderPaymentBehavior, + ) -> Self { + self.inner.payment_behavior = Some(payment_behavior); + self + } + + pub fn payment_settings( + mut self, + payment_settings: UpdateSubscriptionBuilderPaymentSettings<'a>, + ) -> Self { + self.inner.payment_settings = Some(payment_settings); + self + } + + pub fn pending_invoice_item_interval( + mut self, + pending_invoice_item_interval: UpdateSubscriptionBuilderPendingInvoiceItemInterval, + ) -> Self { + self.inner.pending_invoice_item_interval = Some(pending_invoice_item_interval); + self + } + + pub fn promotion_code(mut self, promotion_code: &'a str) -> Self { + self.inner.promotion_code = Some(promotion_code); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: UpdateSubscriptionBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn proration_date(mut self, proration_date: stripe_types::Timestamp) -> Self { + self.inner.proration_date = Some(proration_date); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataSpecs<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn trial_end(mut self, trial_end: UpdateSubscriptionBuilderTrialEnd) -> Self { + self.inner.trial_end = Some(trial_end); + self + } + + pub fn trial_from_plan(mut self, trial_from_plan: bool) -> Self { + self.inner.trial_from_plan = Some(trial_from_plan); + self + } + + pub fn trial_settings( + mut self, + trial_settings: UpdateSubscriptionBuilderTrialSettings, + ) -> Self { + self.inner.trial_settings = Some(trial_settings); + self + } +} +impl UpdateSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateSubscription<'_> { + type Output = stripe_shared::Subscription; + + fn build(&self) -> RequestBuilder { + let subscription_exposed_id = self.subscription_exposed_id; + RequestBuilder::new(StripeMethod::Post, format!("/subscriptions/{subscription_exposed_id}")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveSubscriptionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveSubscriptionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the subscription with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveSubscription<'a> { + inner: RetrieveSubscriptionBuilder<'a>, + subscription_exposed_id: &'a stripe_shared::SubscriptionId, +} +impl<'a> RetrieveSubscription<'a> { + pub fn new(subscription_exposed_id: &'a stripe_shared::SubscriptionId) -> Self { + Self { subscription_exposed_id, inner: RetrieveSubscriptionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveSubscription<'_> { + type Output = stripe_shared::Subscription; + + fn build(&self) -> RequestBuilder { + let subscription_exposed_id = self.subscription_exposed_id; + RequestBuilder::new(StripeMethod::Get, format!("/subscriptions/{subscription_exposed_id}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelSubscriptionBuilder<'a> { + /// Details about why this subscription was cancelled + #[serde(skip_serializing_if = "Option::is_none")] + pub cancellation_details: Option>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_now: Option, + /// Will generate a proration invoice item that credits remaining unused time until the subscription period end. + #[serde(skip_serializing_if = "Option::is_none")] + pub prorate: Option, +} +impl<'a> CancelSubscriptionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Details about why this subscription was cancelled +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelSubscriptionBuilderCancellationDetails<'a> { + /// Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user. + #[serde(skip_serializing_if = "Option::is_none")] + pub comment: Option<&'a str>, + /// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. + #[serde(skip_serializing_if = "Option::is_none")] + pub feedback: Option, +} +impl<'a> CancelSubscriptionBuilderCancellationDetails<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// The customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CancelSubscriptionBuilderCancellationDetailsFeedback { + CustomerService, + LowQuality, + MissingFeatures, + Other, + SwitchedService, + TooComplex, + TooExpensive, + Unused, +} +impl CancelSubscriptionBuilderCancellationDetailsFeedback { + pub fn as_str(self) -> &'static str { + use CancelSubscriptionBuilderCancellationDetailsFeedback::*; + match self { + CustomerService => "customer_service", + LowQuality => "low_quality", + MissingFeatures => "missing_features", + Other => "other", + SwitchedService => "switched_service", + TooComplex => "too_complex", + TooExpensive => "too_expensive", + Unused => "unused", + } + } +} + +impl std::str::FromStr for CancelSubscriptionBuilderCancellationDetailsFeedback { + type Err = (); + fn from_str(s: &str) -> Result { + use CancelSubscriptionBuilderCancellationDetailsFeedback::*; + match s { + "customer_service" => Ok(CustomerService), + "low_quality" => Ok(LowQuality), + "missing_features" => Ok(MissingFeatures), + "other" => Ok(Other), + "switched_service" => Ok(SwitchedService), + "too_complex" => Ok(TooComplex), + "too_expensive" => Ok(TooExpensive), + "unused" => Ok(Unused), + _ => Err(()), + } + } +} +impl std::fmt::Display for CancelSubscriptionBuilderCancellationDetailsFeedback { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CancelSubscriptionBuilderCancellationDetailsFeedback { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CancelSubscriptionBuilderCancellationDetailsFeedback { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Cancels a customer’s subscription immediately. +/// The customer will not be charged again for the subscription. +/// +/// Note, however, that any pending invoice items that you’ve created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). +/// If you’ve set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. +/// But if the subscription is set to cancel immediately, pending prorations will be removed. +/// +/// By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. +/// This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. +/// However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. +/// Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelSubscription<'a> { + inner: CancelSubscriptionBuilder<'a>, + subscription_exposed_id: &'a stripe_shared::SubscriptionId, +} +impl<'a> CancelSubscription<'a> { + pub fn new(subscription_exposed_id: &'a stripe_shared::SubscriptionId) -> Self { + Self { subscription_exposed_id, inner: CancelSubscriptionBuilder::new() } + } + pub fn cancellation_details( + mut self, + cancellation_details: CancelSubscriptionBuilderCancellationDetails<'a>, + ) -> Self { + self.inner.cancellation_details = Some(cancellation_details); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_now(mut self, invoice_now: bool) -> Self { + self.inner.invoice_now = Some(invoice_now); + self + } + + pub fn prorate(mut self, prorate: bool) -> Self { + self.inner.prorate = Some(prorate); + self + } +} +impl CancelSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelSubscription<'_> { + type Output = stripe_shared::Subscription; + + fn build(&self) -> RequestBuilder { + let subscription_exposed_id = self.subscription_exposed_id; + RequestBuilder::new( + StripeMethod::Delete, + format!("/subscriptions/{subscription_exposed_id}"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ResumeSubscriptionBuilder<'a> { + /// Either `now` or `unchanged`. + /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). + /// Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. + /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_cycle_anchor: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. + /// The default value is `create_prorations`. + #[serde(skip_serializing_if = "Option::is_none")] + pub proration_behavior: Option, + /// If set, the proration will be calculated as though the subscription was resumed at the given time. + /// This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. + #[serde(skip_serializing_if = "Option::is_none")] + pub proration_date: Option, +} +impl<'a> ResumeSubscriptionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Either `now` or `unchanged`. +/// Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). +/// Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. +/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum ResumeSubscriptionBuilderBillingCycleAnchor { + Now, + Unchanged, +} +impl ResumeSubscriptionBuilderBillingCycleAnchor { + pub fn as_str(self) -> &'static str { + use ResumeSubscriptionBuilderBillingCycleAnchor::*; + match self { + Now => "now", + Unchanged => "unchanged", + } + } +} + +impl std::str::FromStr for ResumeSubscriptionBuilderBillingCycleAnchor { + type Err = (); + fn from_str(s: &str) -> Result { + use ResumeSubscriptionBuilderBillingCycleAnchor::*; + match s { + "now" => Ok(Now), + "unchanged" => Ok(Unchanged), + _ => Err(()), + } + } +} +impl std::fmt::Display for ResumeSubscriptionBuilderBillingCycleAnchor { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for ResumeSubscriptionBuilderBillingCycleAnchor { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for ResumeSubscriptionBuilderBillingCycleAnchor { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. +/// The default value is `create_prorations`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum ResumeSubscriptionBuilderProrationBehavior { + AlwaysInvoice, + CreateProrations, + None, +} +impl ResumeSubscriptionBuilderProrationBehavior { + pub fn as_str(self) -> &'static str { + use ResumeSubscriptionBuilderProrationBehavior::*; + match self { + AlwaysInvoice => "always_invoice", + CreateProrations => "create_prorations", + None => "none", + } + } +} + +impl std::str::FromStr for ResumeSubscriptionBuilderProrationBehavior { + type Err = (); + fn from_str(s: &str) -> Result { + use ResumeSubscriptionBuilderProrationBehavior::*; + match s { + "always_invoice" => Ok(AlwaysInvoice), + "create_prorations" => Ok(CreateProrations), + "none" => Ok(None), + _ => Err(()), + } + } +} +impl std::fmt::Display for ResumeSubscriptionBuilderProrationBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for ResumeSubscriptionBuilderProrationBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for ResumeSubscriptionBuilderProrationBehavior { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. +/// If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. +/// If payment succeeds the subscription will become `active`, and if payment fails the subscription will be `past_due`. +/// The resumption invoice will void automatically if not paid by the expiration date. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ResumeSubscription<'a> { + inner: ResumeSubscriptionBuilder<'a>, + subscription: &'a stripe_shared::SubscriptionId, +} +impl<'a> ResumeSubscription<'a> { + pub fn new(subscription: &'a stripe_shared::SubscriptionId) -> Self { + Self { subscription, inner: ResumeSubscriptionBuilder::new() } + } + pub fn billing_cycle_anchor( + mut self, + billing_cycle_anchor: ResumeSubscriptionBuilderBillingCycleAnchor, + ) -> Self { + self.inner.billing_cycle_anchor = Some(billing_cycle_anchor); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: ResumeSubscriptionBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn proration_date(mut self, proration_date: stripe_types::Timestamp) -> Self { + self.inner.proration_date = Some(proration_date); + self + } +} +impl ResumeSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ResumeSubscription<'_> { + type Output = stripe_shared::Subscription; + + fn build(&self) -> RequestBuilder { + let subscription = self.subscription; + RequestBuilder::new(StripeMethod::Post, format!("/subscriptions/{subscription}/resume")) + .form(&self.inner) + } +} +/// Removes the currently applied discount on a subscription. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteDiscountSubscription<'a> { + subscription_exposed_id: &'a stripe_shared::SubscriptionId, +} +impl<'a> DeleteDiscountSubscription<'a> { + pub fn new(subscription_exposed_id: &'a stripe_shared::SubscriptionId) -> Self { + Self { subscription_exposed_id } + } +} +impl DeleteDiscountSubscription<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteDiscountSubscription<'_> { + type Output = stripe_shared::DeletedDiscount; + + fn build(&self) -> RequestBuilder { + let subscription_exposed_id = self.subscription_exposed_id; + RequestBuilder::new( + StripeMethod::Delete, + format!("/subscriptions/{subscription_exposed_id}/discount"), + ) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct BillingThresholdsParam { /// Monetary threshold that triggers the subscription to advance to a new billing period diff --git a/generated/stripe_billing/src/subscription_item/requests.rs b/generated/stripe_billing/src/subscription_item/requests.rs index e56045b5e..4e805a05f 100644 --- a/generated/stripe_billing/src/subscription_item/requests.rs +++ b/generated/stripe_billing/src/subscription_item/requests.rs @@ -1,86 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteSubscriptionItem { - /// Delete all usage for the given subscription item. - /// Allowed only when the current plan's `usage_type` is `metered`. - #[serde(skip_serializing_if = "Option::is_none")] - pub clear_usage: Option, - /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. - /// The default value is `create_prorations`. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, - /// If set, the proration will be calculated as though the subscription was updated at the given time. - /// This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. - #[serde(skip_serializing_if = "Option::is_none")] - pub proration_date: Option, -} -impl DeleteSubscriptionItem { - pub fn new() -> Self { - Self::default() - } -} -/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. -/// The default value is `create_prorations`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum DeleteSubscriptionItemProrationBehavior { - AlwaysInvoice, - CreateProrations, - None, -} -impl DeleteSubscriptionItemProrationBehavior { - pub fn as_str(self) -> &'static str { - use DeleteSubscriptionItemProrationBehavior::*; - match self { - AlwaysInvoice => "always_invoice", - CreateProrations => "create_prorations", - None => "none", - } - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; -impl std::str::FromStr for DeleteSubscriptionItemProrationBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use DeleteSubscriptionItemProrationBehavior::*; - match s { - "always_invoice" => Ok(AlwaysInvoice), - "create_prorations" => Ok(CreateProrations), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for DeleteSubscriptionItemProrationBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for DeleteSubscriptionItemProrationBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for DeleteSubscriptionItemProrationBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl DeleteSubscriptionItem { - /// Deletes an item from the subscription. - /// Removing a subscription item from a subscription will not cancel the subscription. - pub fn send( - &self, - client: &stripe::Client, - item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response { - client.send_form(&format!("/subscription_items/{item}"), self, http_types::Method::Delete) - } -} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListSubscriptionItem<'a> { +pub struct ListSubscriptionItemBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -101,100 +24,116 @@ pub struct ListSubscriptionItem<'a> { /// The ID of the subscription whose items will be retrieved. pub subscription: &'a str, } -impl<'a> ListSubscriptionItem<'a> { +impl<'a> ListSubscriptionItemBuilder<'a> { pub fn new(subscription: &'a str) -> Self { Self { ending_before: None, expand: None, limit: None, starting_after: None, subscription } } } +/// Returns a list of your subscription items for a given subscription. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSubscriptionItem<'a> { + inner: ListSubscriptionItemBuilder<'a>, +} impl<'a> ListSubscriptionItem<'a> { - /// Returns a list of your subscription items for a given subscription. - pub fn send( + pub fn new(subscription: &'a str) -> Self { + Self { inner: ListSubscriptionItemBuilder::new(subscription) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListSubscriptionItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/subscription_items", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/subscription_items", self) +} + +impl StripeRequest for ListSubscriptionItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/subscription_items").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveSubscriptionItem<'a> { +pub struct RetrieveSubscriptionItemBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveSubscriptionItem<'a> { +impl<'a> RetrieveSubscriptionItemBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the subscription item with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveSubscriptionItem<'a> { + inner: RetrieveSubscriptionItemBuilder<'a>, + item: &'a stripe_shared::SubscriptionItemId, +} impl<'a> RetrieveSubscriptionItem<'a> { - /// Retrieves the subscription item with the given ID. - pub fn send( - &self, - client: &stripe::Client, - item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response { - client.get_query(&format!("/subscription_items/{item}"), self) + pub fn new(item: &'a stripe_shared::SubscriptionItemId) -> Self { + Self { item, inner: RetrieveSubscriptionItemBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UsageRecordSummariesSubscriptionItem<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> UsageRecordSummariesSubscriptionItem<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> UsageRecordSummariesSubscriptionItem<'a> { - /// For the specified subscription item, returns a list of summary objects. - /// Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). - /// - /// The list is sorted in reverse-chronological order (newest first). - /// The first list item represents the most current usage period that hasn’t ended yet. - /// Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends. - pub fn send( +impl RetrieveSubscriptionItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - subscription_item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response> { - client.get_query( - &format!("/subscription_items/{subscription_item}/usage_record_summaries"), - self, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - subscription_item: &stripe_shared::SubscriptionItemId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/subscription_items/{subscription_item}/usage_record_summaries"), - self, - ) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveSubscriptionItem<'_> { + type Output = stripe_shared::SubscriptionItem; + + fn build(&self) -> RequestBuilder { + let item = self.item; + RequestBuilder::new(StripeMethod::Get, format!("/subscription_items/{item}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItem<'a> { +pub struct CreateSubscriptionItemBuilder<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -226,7 +165,7 @@ pub struct CreateSubscriptionItem<'a> { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_behavior: Option, + pub payment_behavior: Option, /// The identifier of the plan to add to the subscription. #[serde(skip_serializing_if = "Option::is_none")] pub plan: Option<&'a str>, @@ -235,11 +174,11 @@ pub struct CreateSubscriptionItem<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// If set, the proration will be calculated as though the subscription was updated at the given time. /// This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. #[serde(skip_serializing_if = "Option::is_none")] @@ -255,7 +194,7 @@ pub struct CreateSubscriptionItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateSubscriptionItem<'a> { +impl<'a> CreateSubscriptionItemBuilder<'a> { pub fn new(subscription: &'a str) -> Self { Self { billing_thresholds: None, @@ -291,15 +230,15 @@ impl<'a> CreateSubscriptionItem<'a> { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemPaymentBehavior { +pub enum CreateSubscriptionItemBuilderPaymentBehavior { AllowIncomplete, DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } -impl CreateSubscriptionItemPaymentBehavior { +impl CreateSubscriptionItemBuilderPaymentBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemPaymentBehavior::*; + use CreateSubscriptionItemBuilderPaymentBehavior::*; match self { AllowIncomplete => "allow_incomplete", DefaultIncomplete => "default_incomplete", @@ -309,10 +248,10 @@ impl CreateSubscriptionItemPaymentBehavior { } } -impl std::str::FromStr for CreateSubscriptionItemPaymentBehavior { +impl std::str::FromStr for CreateSubscriptionItemBuilderPaymentBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemPaymentBehavior::*; + use CreateSubscriptionItemBuilderPaymentBehavior::*; match s { "allow_incomplete" => Ok(AllowIncomplete), "default_incomplete" => Ok(DefaultIncomplete), @@ -322,18 +261,18 @@ impl std::str::FromStr for CreateSubscriptionItemPaymentBehavior { } } } -impl std::fmt::Display for CreateSubscriptionItemPaymentBehavior { +impl std::fmt::Display for CreateSubscriptionItemBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemPaymentBehavior { +impl std::fmt::Debug for CreateSubscriptionItemBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemPaymentBehavior { +impl serde::Serialize for CreateSubscriptionItemBuilderPaymentBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -343,20 +282,20 @@ impl serde::Serialize for CreateSubscriptionItemPaymentBehavior { } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemPriceData<'a> { +pub struct CreateSubscriptionItemBuilderPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: CreateSubscriptionItemPriceDataRecurring, + pub recurring: CreateSubscriptionItemBuilderPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -365,11 +304,11 @@ pub struct CreateSubscriptionItemPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateSubscriptionItemPriceData<'a> { +impl<'a> CreateSubscriptionItemBuilderPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: CreateSubscriptionItemPriceDataRecurring, + recurring: CreateSubscriptionItemBuilderPriceDataRecurring, ) -> Self { Self { currency, @@ -383,31 +322,31 @@ impl<'a> CreateSubscriptionItemPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemPriceDataRecurring { +pub struct CreateSubscriptionItemBuilderPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateSubscriptionItemPriceDataRecurringInterval, + pub interval: CreateSubscriptionItemBuilderPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateSubscriptionItemPriceDataRecurring { - pub fn new(interval: CreateSubscriptionItemPriceDataRecurringInterval) -> Self { +impl CreateSubscriptionItemBuilderPriceDataRecurring { + pub fn new(interval: CreateSubscriptionItemBuilderPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemPriceDataRecurringInterval { +pub enum CreateSubscriptionItemBuilderPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateSubscriptionItemPriceDataRecurringInterval { +impl CreateSubscriptionItemBuilderPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemPriceDataRecurringInterval::*; + use CreateSubscriptionItemBuilderPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -417,10 +356,10 @@ impl CreateSubscriptionItemPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateSubscriptionItemPriceDataRecurringInterval { +impl std::str::FromStr for CreateSubscriptionItemBuilderPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemPriceDataRecurringInterval::*; + use CreateSubscriptionItemBuilderPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -430,18 +369,18 @@ impl std::str::FromStr for CreateSubscriptionItemPriceDataRecurringInterval { } } } -impl std::fmt::Display for CreateSubscriptionItemPriceDataRecurringInterval { +impl std::fmt::Display for CreateSubscriptionItemBuilderPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemPriceDataRecurringInterval { +impl std::fmt::Debug for CreateSubscriptionItemBuilderPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemPriceDataRecurringInterval { +impl serde::Serialize for CreateSubscriptionItemBuilderPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -454,14 +393,14 @@ impl serde::Serialize for CreateSubscriptionItemPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemPriceDataTaxBehavior { +pub enum CreateSubscriptionItemBuilderPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateSubscriptionItemPriceDataTaxBehavior { +impl CreateSubscriptionItemBuilderPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemPriceDataTaxBehavior::*; + use CreateSubscriptionItemBuilderPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -470,10 +409,10 @@ impl CreateSubscriptionItemPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateSubscriptionItemPriceDataTaxBehavior { +impl std::str::FromStr for CreateSubscriptionItemBuilderPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemPriceDataTaxBehavior::*; + use CreateSubscriptionItemBuilderPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -482,18 +421,18 @@ impl std::str::FromStr for CreateSubscriptionItemPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateSubscriptionItemPriceDataTaxBehavior { +impl std::fmt::Display for CreateSubscriptionItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemPriceDataTaxBehavior { +impl std::fmt::Debug for CreateSubscriptionItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemPriceDataTaxBehavior { +impl serde::Serialize for CreateSubscriptionItemBuilderPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -504,14 +443,14 @@ impl serde::Serialize for CreateSubscriptionItemPriceDataTaxBehavior { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemProrationBehavior { +pub enum CreateSubscriptionItemBuilderProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl CreateSubscriptionItemProrationBehavior { +impl CreateSubscriptionItemBuilderProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemProrationBehavior::*; + use CreateSubscriptionItemBuilderProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -520,10 +459,10 @@ impl CreateSubscriptionItemProrationBehavior { } } -impl std::str::FromStr for CreateSubscriptionItemProrationBehavior { +impl std::str::FromStr for CreateSubscriptionItemBuilderProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemProrationBehavior::*; + use CreateSubscriptionItemBuilderProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -532,18 +471,18 @@ impl std::str::FromStr for CreateSubscriptionItemProrationBehavior { } } } -impl std::fmt::Display for CreateSubscriptionItemProrationBehavior { +impl std::fmt::Display for CreateSubscriptionItemBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemProrationBehavior { +impl std::fmt::Debug for CreateSubscriptionItemBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemProrationBehavior { +impl serde::Serialize for CreateSubscriptionItemBuilderProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -551,17 +490,101 @@ impl serde::Serialize for CreateSubscriptionItemProrationBehavior { serializer.serialize_str(self.as_str()) } } +/// Adds a new item to an existing subscription. No existing items will be changed or replaced. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSubscriptionItem<'a> { + inner: CreateSubscriptionItemBuilder<'a>, +} impl<'a> CreateSubscriptionItem<'a> { - /// Adds a new item to an existing subscription. No existing items will be changed or replaced. - pub fn send( + pub fn new(subscription: &'a str) -> Self { + Self { inner: CreateSubscriptionItemBuilder::new(subscription) } + } + pub fn billing_thresholds(mut self, billing_thresholds: ItemBillingThresholdsParam) -> Self { + self.inner.billing_thresholds = Some(billing_thresholds); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn payment_behavior( + mut self, + payment_behavior: CreateSubscriptionItemBuilderPaymentBehavior, + ) -> Self { + self.inner.payment_behavior = Some(payment_behavior); + self + } + + pub fn plan(mut self, plan: &'a str) -> Self { + self.inner.plan = Some(plan); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn price_data(mut self, price_data: CreateSubscriptionItemBuilderPriceData<'a>) -> Self { + self.inner.price_data = Some(price_data); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: CreateSubscriptionItemBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn proration_date(mut self, proration_date: stripe_types::Timestamp) -> Self { + self.inner.proration_date = Some(proration_date); + self + } + + pub fn quantity(mut self, quantity: u64) -> Self { + self.inner.quantity = Some(quantity); + self + } + + pub fn tax_rates(mut self, tax_rates: &'a [&'a str]) -> Self { + self.inner.tax_rates = Some(tax_rates); + self + } +} +impl CreateSubscriptionItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/subscription_items", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateSubscriptionItem<'_> { + type Output = stripe_shared::SubscriptionItem; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/subscription_items").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionItem<'a> { +pub struct UpdateSubscriptionItemBuilder<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -596,7 +619,7 @@ pub struct UpdateSubscriptionItem<'a> { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_behavior: Option, + pub payment_behavior: Option, /// The identifier of the new plan for this subscription item. #[serde(skip_serializing_if = "Option::is_none")] pub plan: Option<&'a str>, @@ -606,11 +629,11 @@ pub struct UpdateSubscriptionItem<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// If set, the proration will be calculated as though the subscription was updated at the given time. /// This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. #[serde(skip_serializing_if = "Option::is_none")] @@ -624,7 +647,7 @@ pub struct UpdateSubscriptionItem<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateSubscriptionItem<'a> { +impl<'a> UpdateSubscriptionItemBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -647,15 +670,15 @@ impl<'a> UpdateSubscriptionItem<'a> { /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemPaymentBehavior { +pub enum UpdateSubscriptionItemBuilderPaymentBehavior { AllowIncomplete, DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } -impl UpdateSubscriptionItemPaymentBehavior { +impl UpdateSubscriptionItemBuilderPaymentBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemPaymentBehavior::*; + use UpdateSubscriptionItemBuilderPaymentBehavior::*; match self { AllowIncomplete => "allow_incomplete", DefaultIncomplete => "default_incomplete", @@ -665,10 +688,10 @@ impl UpdateSubscriptionItemPaymentBehavior { } } -impl std::str::FromStr for UpdateSubscriptionItemPaymentBehavior { +impl std::str::FromStr for UpdateSubscriptionItemBuilderPaymentBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemPaymentBehavior::*; + use UpdateSubscriptionItemBuilderPaymentBehavior::*; match s { "allow_incomplete" => Ok(AllowIncomplete), "default_incomplete" => Ok(DefaultIncomplete), @@ -678,18 +701,18 @@ impl std::str::FromStr for UpdateSubscriptionItemPaymentBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionItemPaymentBehavior { +impl std::fmt::Display for UpdateSubscriptionItemBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemPaymentBehavior { +impl std::fmt::Debug for UpdateSubscriptionItemBuilderPaymentBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemPaymentBehavior { +impl serde::Serialize for UpdateSubscriptionItemBuilderPaymentBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -699,20 +722,20 @@ impl serde::Serialize for UpdateSubscriptionItemPaymentBehavior { } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemPriceData<'a> { +pub struct UpdateSubscriptionItemBuilderPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: UpdateSubscriptionItemPriceDataRecurring, + pub recurring: UpdateSubscriptionItemBuilderPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -721,11 +744,11 @@ pub struct UpdateSubscriptionItemPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateSubscriptionItemPriceData<'a> { +impl<'a> UpdateSubscriptionItemBuilderPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: UpdateSubscriptionItemPriceDataRecurring, + recurring: UpdateSubscriptionItemBuilderPriceDataRecurring, ) -> Self { Self { currency, @@ -739,31 +762,31 @@ impl<'a> UpdateSubscriptionItemPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemPriceDataRecurring { +pub struct UpdateSubscriptionItemBuilderPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpdateSubscriptionItemPriceDataRecurringInterval, + pub interval: UpdateSubscriptionItemBuilderPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpdateSubscriptionItemPriceDataRecurring { - pub fn new(interval: UpdateSubscriptionItemPriceDataRecurringInterval) -> Self { +impl UpdateSubscriptionItemBuilderPriceDataRecurring { + pub fn new(interval: UpdateSubscriptionItemBuilderPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemPriceDataRecurringInterval { +pub enum UpdateSubscriptionItemBuilderPriceDataRecurringInterval { Day, Month, Week, Year, } -impl UpdateSubscriptionItemPriceDataRecurringInterval { +impl UpdateSubscriptionItemBuilderPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemPriceDataRecurringInterval::*; + use UpdateSubscriptionItemBuilderPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -773,10 +796,10 @@ impl UpdateSubscriptionItemPriceDataRecurringInterval { } } -impl std::str::FromStr for UpdateSubscriptionItemPriceDataRecurringInterval { +impl std::str::FromStr for UpdateSubscriptionItemBuilderPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemPriceDataRecurringInterval::*; + use UpdateSubscriptionItemBuilderPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -786,18 +809,18 @@ impl std::str::FromStr for UpdateSubscriptionItemPriceDataRecurringInterval { } } } -impl std::fmt::Display for UpdateSubscriptionItemPriceDataRecurringInterval { +impl std::fmt::Display for UpdateSubscriptionItemBuilderPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemPriceDataRecurringInterval { +impl std::fmt::Debug for UpdateSubscriptionItemBuilderPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemPriceDataRecurringInterval { +impl serde::Serialize for UpdateSubscriptionItemBuilderPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -810,14 +833,14 @@ impl serde::Serialize for UpdateSubscriptionItemPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemPriceDataTaxBehavior { +pub enum UpdateSubscriptionItemBuilderPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateSubscriptionItemPriceDataTaxBehavior { +impl UpdateSubscriptionItemBuilderPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemPriceDataTaxBehavior::*; + use UpdateSubscriptionItemBuilderPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -826,10 +849,10 @@ impl UpdateSubscriptionItemPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateSubscriptionItemPriceDataTaxBehavior { +impl std::str::FromStr for UpdateSubscriptionItemBuilderPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemPriceDataTaxBehavior::*; + use UpdateSubscriptionItemBuilderPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -838,18 +861,18 @@ impl std::str::FromStr for UpdateSubscriptionItemPriceDataTaxBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionItemPriceDataTaxBehavior { +impl std::fmt::Display for UpdateSubscriptionItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateSubscriptionItemBuilderPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemPriceDataTaxBehavior { +impl serde::Serialize for UpdateSubscriptionItemBuilderPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -860,14 +883,14 @@ impl serde::Serialize for UpdateSubscriptionItemPriceDataTaxBehavior { /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. /// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionItemProrationBehavior { +pub enum UpdateSubscriptionItemBuilderProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateSubscriptionItemProrationBehavior { +impl UpdateSubscriptionItemBuilderProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionItemProrationBehavior::*; + use UpdateSubscriptionItemBuilderProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -876,10 +899,10 @@ impl UpdateSubscriptionItemProrationBehavior { } } -impl std::str::FromStr for UpdateSubscriptionItemProrationBehavior { +impl std::str::FromStr for UpdateSubscriptionItemBuilderProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionItemProrationBehavior::*; + use UpdateSubscriptionItemBuilderProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -888,18 +911,18 @@ impl std::str::FromStr for UpdateSubscriptionItemProrationBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionItemProrationBehavior { +impl std::fmt::Display for UpdateSubscriptionItemBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionItemProrationBehavior { +impl std::fmt::Debug for UpdateSubscriptionItemBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionItemProrationBehavior { +impl serde::Serialize for UpdateSubscriptionItemBuilderProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -907,16 +930,320 @@ impl serde::Serialize for UpdateSubscriptionItemProrationBehavior { serializer.serialize_str(self.as_str()) } } +/// Updates the plan or quantity of an item on a current subscription. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateSubscriptionItem<'a> { + inner: UpdateSubscriptionItemBuilder<'a>, + item: &'a stripe_shared::SubscriptionItemId, +} impl<'a> UpdateSubscriptionItem<'a> { - /// Updates the plan or quantity of an item on a current subscription. - pub fn send( + pub fn new(item: &'a stripe_shared::SubscriptionItemId) -> Self { + Self { item, inner: UpdateSubscriptionItemBuilder::new() } + } + pub fn billing_thresholds(mut self, billing_thresholds: ItemBillingThresholdsParam) -> Self { + self.inner.billing_thresholds = Some(billing_thresholds); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn off_session(mut self, off_session: bool) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn payment_behavior( + mut self, + payment_behavior: UpdateSubscriptionItemBuilderPaymentBehavior, + ) -> Self { + self.inner.payment_behavior = Some(payment_behavior); + self + } + + pub fn plan(mut self, plan: &'a str) -> Self { + self.inner.plan = Some(plan); + self + } + + pub fn price(mut self, price: &'a str) -> Self { + self.inner.price = Some(price); + self + } + + pub fn price_data(mut self, price_data: UpdateSubscriptionItemBuilderPriceData<'a>) -> Self { + self.inner.price_data = Some(price_data); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: UpdateSubscriptionItemBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn proration_date(mut self, proration_date: stripe_types::Timestamp) -> Self { + self.inner.proration_date = Some(proration_date); + self + } + + pub fn quantity(mut self, quantity: u64) -> Self { + self.inner.quantity = Some(quantity); + self + } + + pub fn tax_rates(mut self, tax_rates: &'a [&'a str]) -> Self { + self.inner.tax_rates = Some(tax_rates); + self + } +} +impl UpdateSubscriptionItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateSubscriptionItem<'_> { + type Output = stripe_shared::SubscriptionItem; + + fn build(&self) -> RequestBuilder { + let item = self.item; + RequestBuilder::new(StripeMethod::Post, format!("/subscription_items/{item}")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DeleteSubscriptionItemBuilder { + /// Delete all usage for the given subscription item. + /// Allowed only when the current plan's `usage_type` is `metered`. + #[serde(skip_serializing_if = "Option::is_none")] + pub clear_usage: Option, + /// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. + /// The default value is `create_prorations`. + #[serde(skip_serializing_if = "Option::is_none")] + pub proration_behavior: Option, + /// If set, the proration will be calculated as though the subscription was updated at the given time. + /// This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. + #[serde(skip_serializing_if = "Option::is_none")] + pub proration_date: Option, +} +impl DeleteSubscriptionItemBuilder { + pub fn new() -> Self { + Self::default() + } +} +/// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. +/// The default value is `create_prorations`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum DeleteSubscriptionItemBuilderProrationBehavior { + AlwaysInvoice, + CreateProrations, + None, +} +impl DeleteSubscriptionItemBuilderProrationBehavior { + pub fn as_str(self) -> &'static str { + use DeleteSubscriptionItemBuilderProrationBehavior::*; + match self { + AlwaysInvoice => "always_invoice", + CreateProrations => "create_prorations", + None => "none", + } + } +} + +impl std::str::FromStr for DeleteSubscriptionItemBuilderProrationBehavior { + type Err = (); + fn from_str(s: &str) -> Result { + use DeleteSubscriptionItemBuilderProrationBehavior::*; + match s { + "always_invoice" => Ok(AlwaysInvoice), + "create_prorations" => Ok(CreateProrations), + "none" => Ok(None), + _ => Err(()), + } + } +} +impl std::fmt::Display for DeleteSubscriptionItemBuilderProrationBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for DeleteSubscriptionItemBuilderProrationBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for DeleteSubscriptionItemBuilderProrationBehavior { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Deletes an item from the subscription. +/// Removing a subscription item from a subscription will not cancel the subscription. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteSubscriptionItem<'a> { + inner: DeleteSubscriptionItemBuilder, + item: &'a stripe_shared::SubscriptionItemId, +} +impl<'a> DeleteSubscriptionItem<'a> { + pub fn new(item: &'a stripe_shared::SubscriptionItemId) -> Self { + Self { item, inner: DeleteSubscriptionItemBuilder::new() } + } + pub fn clear_usage(mut self, clear_usage: bool) -> Self { + self.inner.clear_usage = Some(clear_usage); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: DeleteSubscriptionItemBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } + + pub fn proration_date(mut self, proration_date: stripe_types::Timestamp) -> Self { + self.inner.proration_date = Some(proration_date); + self + } +} +impl DeleteSubscriptionItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteSubscriptionItem<'_> { + type Output = stripe_shared::DeletedSubscriptionItem; + + fn build(&self) -> RequestBuilder { + let item = self.item; + RequestBuilder::new(StripeMethod::Delete, format!("/subscription_items/{item}")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UsageRecordSummariesSubscriptionItemBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> UsageRecordSummariesSubscriptionItemBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// For the specified subscription item, returns a list of summary objects. +/// Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). +/// +/// The list is sorted in reverse-chronological order (newest first). +/// The first list item represents the most current usage period that hasn’t ended yet. +/// Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UsageRecordSummariesSubscriptionItem<'a> { + inner: UsageRecordSummariesSubscriptionItemBuilder<'a>, + subscription_item: &'a stripe_shared::SubscriptionItemId, +} +impl<'a> UsageRecordSummariesSubscriptionItem<'a> { + pub fn new(subscription_item: &'a stripe_shared::SubscriptionItemId) -> Self { + Self { subscription_item, inner: UsageRecordSummariesSubscriptionItemBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl UsageRecordSummariesSubscriptionItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response { - client.send_form(&format!("/subscription_items/{item}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UsageRecordSummariesSubscriptionItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let subscription_item = self.subscription_item; + RequestBuilder::new( + StripeMethod::Get, + format!("/subscription_items/{subscription_item}/usage_record_summaries"), + ) + .query(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ItemBillingThresholdsParam { /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). diff --git a/generated/stripe_billing/src/subscription_schedule/requests.rs b/generated/stripe_billing/src/subscription_schedule/requests.rs index a3e60f65e..4bf667803 100644 --- a/generated/stripe_billing/src/subscription_schedule/requests.rs +++ b/generated/stripe_billing/src/subscription_schedule/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListSubscriptionSchedule<'a> { +pub struct ListSubscriptionScheduleBuilder<'a> { /// Only return subscription schedules that were created canceled the given date interval. #[serde(skip_serializing_if = "Option::is_none")] pub canceled_at: Option, @@ -36,59 +40,104 @@ pub struct ListSubscriptionSchedule<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListSubscriptionSchedule<'a> { +impl<'a> ListSubscriptionScheduleBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the list of your subscription schedules. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSubscriptionSchedule<'a> { + inner: ListSubscriptionScheduleBuilder<'a>, +} impl<'a> ListSubscriptionSchedule<'a> { - /// Retrieves the list of your subscription schedules. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/subscription_schedules", self) + pub fn new() -> Self { + Self { inner: ListSubscriptionScheduleBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/subscription_schedules", self) + pub fn canceled_at(mut self, canceled_at: stripe_types::RangeQueryTs) -> Self { + self.inner.canceled_at = Some(canceled_at); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveSubscriptionSchedule<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveSubscriptionSchedule<'a> { - pub fn new() -> Self { - Self::default() + + pub fn completed_at(mut self, completed_at: stripe_types::RangeQueryTs) -> Self { + self.inner.completed_at = Some(completed_at); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn released_at(mut self, released_at: stripe_types::RangeQueryTs) -> Self { + self.inner.released_at = Some(released_at); + self + } + + pub fn scheduled(mut self, scheduled: bool) -> Self { + self.inner.scheduled = Some(scheduled); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveSubscriptionSchedule<'a> { - /// Retrieves the details of an existing subscription schedule. - /// You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation. - pub fn send( +impl ListSubscriptionSchedule<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - schedule: &stripe_shared::SubscriptionScheduleId, - ) -> stripe::Response { - client.get_query(&format!("/subscription_schedules/{schedule}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListSubscriptionSchedule<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/subscription_schedules").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedule<'a> { +pub struct CreateSubscriptionScheduleBuilder<'a> { /// The identifier of the customer to create the subscription schedule for. #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option<&'a str>, /// Object representing the subscription schedule's default settings. #[serde(skip_serializing_if = "Option::is_none")] - pub default_settings: Option>, + pub default_settings: Option>, /// Behavior of the subscription schedule and underlying subscription when it ends. /// Possible values are `release` or `cancel` with the default being `release`. - /// `release` will end the subscription schedule and keep the underlying subscription running. - /// `cancel` will end the subscription schedule and cancel the underlying subscription. + /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. #[serde(skip_serializing_if = "Option::is_none")] pub end_behavior: Option, /// Specifies which fields in the response should be expanded. @@ -110,21 +159,21 @@ pub struct CreateSubscriptionSchedule<'a> { /// Each phase can be customized to have different durations, plans, and coupons. /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. #[serde(skip_serializing_if = "Option::is_none")] - pub phases: Option<&'a [CreateSubscriptionSchedulePhases<'a>]>, + pub phases: Option<&'a [CreateSubscriptionScheduleBuilderPhases<'a>]>, /// When the subscription schedule starts. /// We recommend using `now` so that it starts the subscription immediately. /// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. #[serde(skip_serializing_if = "Option::is_none")] - pub start_date: Option, + pub start_date: Option, } -impl<'a> CreateSubscriptionSchedule<'a> { +impl<'a> CreateSubscriptionScheduleBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Object representing the subscription schedule's default settings. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettings<'a> { +pub struct CreateSubscriptionScheduleBuilderDefaultSettings<'a> { /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// The request must be made by a platform account on a connected account in order to set an application fee percentage. @@ -133,12 +182,13 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { pub application_fee_percent: Option, /// Default settings for automatic tax computation. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, + pub billing_cycle_anchor: + Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -148,7 +198,7 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// ID of the default payment method for the subscription schedule. /// It must belong to the customer associated with the subscription schedule. /// If not set, invoices will use the default payment method in the customer's invoice settings. @@ -160,7 +210,7 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { pub description: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// The account on behalf of which to charge, for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, @@ -168,101 +218,22 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, } -impl<'a> CreateSubscriptionScheduleDefaultSettings<'a> { +impl<'a> CreateSubscriptionScheduleBuilderDefaultSettings<'a> { pub fn new() -> Self { Self::default() } } -/// Default settings for automatic tax computation. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsAutomaticTax<'a> { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> CreateSubscriptionScheduleDefaultSettingsAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType, -} -impl<'a> CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiability<'a> { - pub fn new(type_: CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +pub enum CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { Automatic, PhaseStart, } -impl CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { pub fn as_str(self) -> &'static str { - use CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor::*; + use CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor::*; match self { Automatic => "automatic", PhaseStart => "phase_start", @@ -270,10 +241,10 @@ impl CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { } } -impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor::*; + use CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor::*; match s { "automatic" => Ok(Automatic), "phase_start" => Ok(PhaseStart), @@ -281,18 +252,18 @@ impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsBillingCycle } } } -impl std::fmt::Display for CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl serde::Serialize for CreateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -305,13 +276,13 @@ impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsBillingCycleA /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionScheduleDefaultSettingsCollectionMethod { +pub enum CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { ChargeAutomatically, SendInvoice, } -impl CreateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionScheduleDefaultSettingsCollectionMethod::*; + use CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod::*; match self { ChargeAutomatically => "charge_automatically", SendInvoice => "send_invoice", @@ -319,10 +290,10 @@ impl CreateSubscriptionScheduleDefaultSettingsCollectionMethod { } } -impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionScheduleDefaultSettingsCollectionMethod::*; + use CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod::*; match s { "charge_automatically" => Ok(ChargeAutomatically), "send_invoice" => Ok(SendInvoice), @@ -330,101 +301,18 @@ impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsCollectionMe } } } -impl std::fmt::Display for CreateSubscriptionScheduleDefaultSettingsCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionScheduleDefaultSettingsCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsInvoiceSettings<'a> { - /// The account tax IDs associated with the subscription schedule. - /// Will be set on invoices generated by the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> CreateSubscriptionScheduleDefaultSettingsInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType, -} -impl<'a> CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - Account, - Self_, -} -impl CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { +impl serde::Serialize for CreateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -436,11 +324,11 @@ impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsInvoiceSettin /// Each phase can be customized to have different durations, plans, and coupons. /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhases<'a> { +pub struct CreateSubscriptionScheduleBuilderPhases<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. /// You may pass up to 20 items. #[serde(skip_serializing_if = "Option::is_none")] - pub add_invoice_items: Option<&'a [CreateSubscriptionSchedulePhasesAddInvoiceItems<'a>]>, + pub add_invoice_items: Option<&'a [CreateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a>]>, /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// The request must be made by a platform account on a connected account in order to set an application fee percentage. @@ -449,12 +337,12 @@ pub struct CreateSubscriptionSchedulePhases<'a> { pub application_fee_percent: Option, /// Automatic tax settings for this phase. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, + pub billing_cycle_anchor: Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -464,7 +352,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The identifier of the coupon to apply to this phase of the subscription schedule. #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, @@ -491,9 +379,9 @@ pub struct CreateSubscriptionSchedulePhases<'a> { pub end_date: Option, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. - pub items: &'a [CreateSubscriptionSchedulePhasesItems<'a>], + pub items: &'a [CreateSubscriptionScheduleBuilderPhasesItems<'a>], /// Integer representing the multiplier applied to the price interval. /// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. /// If set, `end_date` must not be set. @@ -513,7 +401,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, @@ -525,8 +413,8 @@ pub struct CreateSubscriptionSchedulePhases<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub trial_end: Option, } -impl<'a> CreateSubscriptionSchedulePhases<'a> { - pub fn new(items: &'a [CreateSubscriptionSchedulePhasesItems<'a>]) -> Self { +impl<'a> CreateSubscriptionScheduleBuilderPhases<'a> { + pub fn new(items: &'a [CreateSubscriptionScheduleBuilderPhasesItems<'a>]) -> Self { Self { add_invoice_items: None, application_fee_percent: None, @@ -555,13 +443,13 @@ impl<'a> CreateSubscriptionSchedulePhases<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. /// You may pass up to 20 items. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesAddInvoiceItems<'a> { +pub struct CreateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a> { /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. Defaults to 1. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -569,14 +457,14 @@ pub struct CreateSubscriptionSchedulePhasesAddInvoiceItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateSubscriptionSchedulePhasesAddInvoiceItems<'a> { +impl<'a> CreateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { +pub struct CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -587,7 +475,8 @@ pub struct CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: + Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -596,7 +485,7 @@ pub struct CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { +impl<'a> CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -606,14 +495,14 @@ impl<'a> CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +pub enum CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +impl CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -622,10 +511,12 @@ impl CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr + for CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -634,97 +525,24 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceD } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Automatic tax settings for this phase. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesAutomaticTax<'a> { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> CreateSubscriptionSchedulePhasesAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType, -} -impl<'a> CreateSubscriptionSchedulePhasesAutomaticTaxLiability<'a> { - pub fn new(type_: CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl std::fmt::Display + for CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl std::fmt::Debug + for CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl serde::Serialize + for CreateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -736,13 +554,13 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityT /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesBillingCycleAnchor { +pub enum CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { Automatic, PhaseStart, } -impl CreateSubscriptionSchedulePhasesBillingCycleAnchor { +impl CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesBillingCycleAnchor::*; + use CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor::*; match self { Automatic => "automatic", PhaseStart => "phase_start", @@ -750,10 +568,10 @@ impl CreateSubscriptionSchedulePhasesBillingCycleAnchor { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesBillingCycleAnchor::*; + use CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor::*; match s { "automatic" => Ok(Automatic), "phase_start" => Ok(PhaseStart), @@ -761,18 +579,18 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesBillingCycleAnchor { } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesBillingCycleAnchor { +impl serde::Serialize for CreateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -785,13 +603,13 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesBillingCycleAnchor { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesCollectionMethod { +pub enum CreateSubscriptionScheduleBuilderPhasesCollectionMethod { ChargeAutomatically, SendInvoice, } -impl CreateSubscriptionSchedulePhasesCollectionMethod { +impl CreateSubscriptionScheduleBuilderPhasesCollectionMethod { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesCollectionMethod::*; + use CreateSubscriptionScheduleBuilderPhasesCollectionMethod::*; match self { ChargeAutomatically => "charge_automatically", SendInvoice => "send_invoice", @@ -799,10 +617,10 @@ impl CreateSubscriptionSchedulePhasesCollectionMethod { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesCollectionMethod { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderPhasesCollectionMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesCollectionMethod::*; + use CreateSubscriptionScheduleBuilderPhasesCollectionMethod::*; match s { "charge_automatically" => Ok(ChargeAutomatically), "send_invoice" => Ok(SendInvoice), @@ -810,101 +628,18 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesCollectionMethod { } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionSchedulePhasesCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesInvoiceSettings<'a> { - /// The account tax IDs associated with this phase of the subscription schedule. - /// Will be set on invoices generated by this phase of the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `billing=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> CreateSubscriptionSchedulePhasesInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType, -} -impl<'a> CreateSubscriptionSchedulePhasesInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - Account, - Self_, -} -impl CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderPhasesCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderPhasesCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { +impl serde::Serialize for CreateSubscriptionScheduleBuilderPhasesCollectionMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -914,7 +649,7 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesInvoiceSettingsIssuerT } /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesItems<'a> { +pub struct CreateSubscriptionScheduleBuilderPhasesItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -933,7 +668,7 @@ pub struct CreateSubscriptionSchedulePhasesItems<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for the given price. /// Can be set only if the price's `usage_type` is `licensed` and not `metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -944,27 +679,27 @@ pub struct CreateSubscriptionSchedulePhasesItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateSubscriptionSchedulePhasesItems<'a> { +impl<'a> CreateSubscriptionScheduleBuilderPhasesItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesItemsPriceData<'a> { +pub struct CreateSubscriptionScheduleBuilderPhasesItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: CreateSubscriptionSchedulePhasesItemsPriceDataRecurring, + pub recurring: CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -973,11 +708,11 @@ pub struct CreateSubscriptionSchedulePhasesItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateSubscriptionSchedulePhasesItemsPriceData<'a> { +impl<'a> CreateSubscriptionScheduleBuilderPhasesItemsPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: CreateSubscriptionSchedulePhasesItemsPriceDataRecurring, + recurring: CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring, ) -> Self { Self { currency, @@ -991,31 +726,33 @@ impl<'a> CreateSubscriptionSchedulePhasesItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesItemsPriceDataRecurring { +pub struct CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval, + pub interval: CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateSubscriptionSchedulePhasesItemsPriceDataRecurring { - pub fn new(interval: CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval) -> Self { +impl CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring { + pub fn new( + interval: CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval, + ) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +pub enum CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::*; + use CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -1025,10 +762,10 @@ impl CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::*; + use CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -1038,18 +775,18 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesItemsPriceDataRecurri } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl serde::Serialize for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1062,14 +799,14 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesItemsPriceDataRecurrin /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +pub enum CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1078,10 +815,10 @@ impl CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1090,18 +827,18 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBeha } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl serde::Serialize for CreateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1114,14 +851,14 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehav /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionSchedulePhasesProrationBehavior { +pub enum CreateSubscriptionScheduleBuilderPhasesProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl CreateSubscriptionSchedulePhasesProrationBehavior { +impl CreateSubscriptionScheduleBuilderPhasesProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateSubscriptionSchedulePhasesProrationBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -1130,10 +867,10 @@ impl CreateSubscriptionSchedulePhasesProrationBehavior { } } -impl std::str::FromStr for CreateSubscriptionSchedulePhasesProrationBehavior { +impl std::str::FromStr for CreateSubscriptionScheduleBuilderPhasesProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionSchedulePhasesProrationBehavior::*; + use CreateSubscriptionScheduleBuilderPhasesProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -1142,18 +879,18 @@ impl std::str::FromStr for CreateSubscriptionSchedulePhasesProrationBehavior { } } } -impl std::fmt::Display for CreateSubscriptionSchedulePhasesProrationBehavior { +impl std::fmt::Display for CreateSubscriptionScheduleBuilderPhasesProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionSchedulePhasesProrationBehavior { +impl std::fmt::Debug for CreateSubscriptionScheduleBuilderPhasesProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionSchedulePhasesProrationBehavior { +impl serde::Serialize for CreateSubscriptionScheduleBuilderPhasesProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1166,29 +903,149 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesProrationBehavior { /// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateSubscriptionScheduleStartDate { +pub enum CreateSubscriptionScheduleBuilderStartDate { Timestamp(stripe_types::Timestamp), Now, } +/// Creates a new subscription schedule object. +/// Each customer can have up to 500 active or scheduled subscriptions. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSubscriptionSchedule<'a> { + inner: CreateSubscriptionScheduleBuilder<'a>, +} impl<'a> CreateSubscriptionSchedule<'a> { - /// Creates a new subscription schedule object. - /// Each customer can have up to 500 active or scheduled subscriptions. - pub fn send( + pub fn new() -> Self { + Self { inner: CreateSubscriptionScheduleBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn default_settings( + mut self, + default_settings: CreateSubscriptionScheduleBuilderDefaultSettings<'a>, + ) -> Self { + self.inner.default_settings = Some(default_settings); + self + } + + pub fn end_behavior( + mut self, + end_behavior: stripe_shared::SubscriptionScheduleEndBehavior, + ) -> Self { + self.inner.end_behavior = Some(end_behavior); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn from_subscription(mut self, from_subscription: &'a str) -> Self { + self.inner.from_subscription = Some(from_subscription); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn phases(mut self, phases: &'a [CreateSubscriptionScheduleBuilderPhases<'a>]) -> Self { + self.inner.phases = Some(phases); + self + } + + pub fn start_date(mut self, start_date: CreateSubscriptionScheduleBuilderStartDate) -> Self { + self.inner.start_date = Some(start_date); + self + } +} +impl CreateSubscriptionSchedule<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/subscription_schedules", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedule<'a> { + +impl StripeRequest for CreateSubscriptionSchedule<'_> { + type Output = stripe_shared::SubscriptionSchedule; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/subscription_schedules").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveSubscriptionScheduleBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveSubscriptionScheduleBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing subscription schedule. +/// You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveSubscriptionSchedule<'a> { + inner: RetrieveSubscriptionScheduleBuilder<'a>, + schedule: &'a stripe_shared::SubscriptionScheduleId, +} +impl<'a> RetrieveSubscriptionSchedule<'a> { + pub fn new(schedule: &'a stripe_shared::SubscriptionScheduleId) -> Self { + Self { schedule, inner: RetrieveSubscriptionScheduleBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveSubscriptionSchedule<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveSubscriptionSchedule<'_> { + type Output = stripe_shared::SubscriptionSchedule; + + fn build(&self) -> RequestBuilder { + let schedule = self.schedule; + RequestBuilder::new(StripeMethod::Get, format!("/subscription_schedules/{schedule}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateSubscriptionScheduleBuilder<'a> { /// Object representing the subscription schedule's default settings. #[serde(skip_serializing_if = "Option::is_none")] - pub default_settings: Option>, + pub default_settings: Option>, /// Behavior of the subscription schedule and underlying subscription when it ends. /// Possible values are `release` or `cancel` with the default being `release`. - /// `release` will end the subscription schedule and keep the underlying subscription running. - /// `cancel` will end the subscription schedule and cancel the underlying subscription. + /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. #[serde(skip_serializing_if = "Option::is_none")] pub end_behavior: Option, /// Specifies which fields in the response should be expanded. @@ -1205,20 +1062,20 @@ pub struct UpdateSubscriptionSchedule<'a> { /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. /// Note that past phases can be omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub phases: Option<&'a [UpdateSubscriptionSchedulePhases<'a>]>, + pub phases: Option<&'a [UpdateSubscriptionScheduleBuilderPhases<'a>]>, /// If the update changes the current phase, indicates whether the changes should be prorated. /// The default value is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, } -impl<'a> UpdateSubscriptionSchedule<'a> { +impl<'a> UpdateSubscriptionScheduleBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Object representing the subscription schedule's default settings. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { +pub struct UpdateSubscriptionScheduleBuilderDefaultSettings<'a> { /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// The request must be made by a platform account on a connected account in order to set an application fee percentage. @@ -1227,12 +1084,13 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { pub application_fee_percent: Option, /// Default settings for automatic tax computation. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, + pub billing_cycle_anchor: + Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -1242,7 +1100,7 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// ID of the default payment method for the subscription schedule. /// It must belong to the customer associated with the subscription schedule. /// If not set, invoices will use the default payment method in the customer's invoice settings. @@ -1254,7 +1112,7 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { pub description: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// The account on behalf of which to charge, for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, @@ -1262,101 +1120,22 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, } -impl<'a> UpdateSubscriptionScheduleDefaultSettings<'a> { +impl<'a> UpdateSubscriptionScheduleBuilderDefaultSettings<'a> { pub fn new() -> Self { Self::default() } } -/// Default settings for automatic tax computation. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsAutomaticTax<'a> { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpdateSubscriptionScheduleDefaultSettingsAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType, -} -impl<'a> UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiability<'a> { - pub fn new(type_: UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +pub enum UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { Automatic, PhaseStart, } -impl UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor::*; + use UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor::*; match self { Automatic => "automatic", PhaseStart => "phase_start", @@ -1364,10 +1143,10 @@ impl UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { } } -impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor::*; + use UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor::*; match s { "automatic" => Ok(Automatic), "phase_start" => Ok(PhaseStart), @@ -1375,18 +1154,18 @@ impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsBillingCycle } } } -impl std::fmt::Display for UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsBillingCycleAnchor { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderDefaultSettingsBillingCycleAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1399,13 +1178,13 @@ impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsBillingCycleA /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { +pub enum UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { ChargeAutomatically, SendInvoice, } -impl UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleDefaultSettingsCollectionMethod::*; + use UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod::*; match self { ChargeAutomatically => "charge_automatically", SendInvoice => "send_invoice", @@ -1413,10 +1192,10 @@ impl UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { } } -impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleDefaultSettingsCollectionMethod::*; + use UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod::*; match s { "charge_automatically" => Ok(ChargeAutomatically), "send_invoice" => Ok(SendInvoice), @@ -1424,101 +1203,18 @@ impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsCollectionMe } } } -impl std::fmt::Display for UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsInvoiceSettings<'a> { - /// The account tax IDs associated with the subscription schedule. - /// Will be set on invoices generated by the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> UpdateSubscriptionScheduleDefaultSettingsInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType, -} -impl<'a> UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuer<'a> { - pub fn new(type_: UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - Account, - Self_, -} -impl UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsInvoiceSettingsIssuerType { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderDefaultSettingsCollectionMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1531,11 +1227,11 @@ impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsInvoiceSettin /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. /// Note that past phases can be omitted. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhases<'a> { +pub struct UpdateSubscriptionScheduleBuilderPhases<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. /// You may pass up to 20 items. #[serde(skip_serializing_if = "Option::is_none")] - pub add_invoice_items: Option<&'a [UpdateSubscriptionSchedulePhasesAddInvoiceItems<'a>]>, + pub add_invoice_items: Option<&'a [UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a>]>, /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// The request must be made by a platform account on a connected account in order to set an application fee percentage. @@ -1544,12 +1240,12 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { pub application_fee_percent: Option, /// Automatic tax settings for this phase. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[serde(skip_serializing_if = "Option::is_none")] - pub billing_cycle_anchor: Option, + pub billing_cycle_anchor: Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -1559,7 +1255,7 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The identifier of the coupon to apply to this phase of the subscription schedule. #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, @@ -1583,12 +1279,12 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { /// The date at which this phase of the subscription schedule ends. /// If set, `iterations` must not be set. #[serde(skip_serializing_if = "Option::is_none")] - pub end_date: Option, + pub end_date: Option, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option, /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. - pub items: &'a [UpdateSubscriptionSchedulePhasesItems<'a>], + pub items: &'a [UpdateSubscriptionScheduleBuilderPhasesItems<'a>], /// Integer representing the multiplier applied to the price interval. /// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. /// If set, `end_date` must not be set. @@ -1608,11 +1304,11 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// The date at which this phase of the subscription schedule starts or `now`. /// Must be set on the first phase. #[serde(skip_serializing_if = "Option::is_none")] - pub start_date: Option, + pub start_date: Option, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option>, @@ -1622,10 +1318,10 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { /// Sets the phase to trialing from the start date to this date. /// Must be before the phase end date, can not be combined with `trial`. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_end: Option, + pub trial_end: Option, } -impl<'a> UpdateSubscriptionSchedulePhases<'a> { - pub fn new(items: &'a [UpdateSubscriptionSchedulePhasesItems<'a>]) -> Self { +impl<'a> UpdateSubscriptionScheduleBuilderPhases<'a> { + pub fn new(items: &'a [UpdateSubscriptionScheduleBuilderPhasesItems<'a>]) -> Self { Self { add_invoice_items: None, application_fee_percent: None, @@ -1655,13 +1351,13 @@ impl<'a> UpdateSubscriptionSchedulePhases<'a> { /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. /// You may pass up to 20 items. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesAddInvoiceItems<'a> { +pub struct UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a> { /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for this item. Defaults to 1. #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, @@ -1669,14 +1365,14 @@ pub struct UpdateSubscriptionSchedulePhasesAddInvoiceItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateSubscriptionSchedulePhasesAddInvoiceItems<'a> { +impl<'a> UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { +pub struct UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -1687,7 +1383,8 @@ pub struct UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: + Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -1696,7 +1393,7 @@ pub struct UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { +impl<'a> UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency, product: &'a str) -> Self { Self { currency, product, tax_behavior: None, unit_amount: None, unit_amount_decimal: None } } @@ -1706,14 +1403,14 @@ impl<'a> UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceData<'a> { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +pub enum UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +impl UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1722,10 +1419,12 @@ impl UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { +impl std::str::FromStr + for UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1734,97 +1433,24 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceD } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDataTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Automatic tax settings for this phase. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesAutomaticTax<'a> { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpdateSubscriptionSchedulePhasesAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType, -} -impl<'a> UpdateSubscriptionSchedulePhasesAutomaticTaxLiability<'a> { - pub fn new(type_: UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl std::fmt::Display + for UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl std::fmt::Debug + for UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType { +impl serde::Serialize + for UpdateSubscriptionScheduleBuilderPhasesAddInvoiceItemsPriceDataTaxBehavior +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1836,13 +1462,13 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityT /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +pub enum UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { Automatic, PhaseStart, } -impl UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +impl UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesBillingCycleAnchor::*; + use UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor::*; match self { Automatic => "automatic", PhaseStart => "phase_start", @@ -1850,10 +1476,10 @@ impl UpdateSubscriptionSchedulePhasesBillingCycleAnchor { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesBillingCycleAnchor::*; + use UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor::*; match s { "automatic" => Ok(Automatic), "phase_start" => Ok(PhaseStart), @@ -1861,18 +1487,18 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderPhasesBillingCycleAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1885,13 +1511,13 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically` on creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesCollectionMethod { +pub enum UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { ChargeAutomatically, SendInvoice, } -impl UpdateSubscriptionSchedulePhasesCollectionMethod { +impl UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesCollectionMethod::*; + use UpdateSubscriptionScheduleBuilderPhasesCollectionMethod::*; match self { ChargeAutomatically => "charge_automatically", SendInvoice => "send_invoice", @@ -1899,10 +1525,10 @@ impl UpdateSubscriptionSchedulePhasesCollectionMethod { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesCollectionMethod { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesCollectionMethod::*; + use UpdateSubscriptionScheduleBuilderPhasesCollectionMethod::*; match s { "charge_automatically" => Ok(ChargeAutomatically), "send_invoice" => Ok(SendInvoice), @@ -1910,18 +1536,18 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesCollectionMethod { } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesCollectionMethod { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesCollectionMethod { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesCollectionMethod { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderPhasesCollectionMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1933,96 +1559,13 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesCollectionMethod { /// If set, `iterations` must not be set. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateSubscriptionSchedulePhasesEndDate { +pub enum UpdateSubscriptionScheduleBuilderPhasesEndDate { Timestamp(stripe_types::Timestamp), Now, } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesInvoiceSettings<'a> { - /// The account tax IDs associated with this phase of the subscription schedule. - /// Will be set on invoices generated by this phase of the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option<&'a [&'a str]>, - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `billing=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, -} -impl<'a> UpdateSubscriptionSchedulePhasesInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType, -} -impl<'a> UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuer<'a> { - pub fn new(type_: UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - Account, - Self_, -} -impl UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionSchedulePhasesInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesItems<'a> { +pub struct UpdateSubscriptionScheduleBuilderPhasesItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] @@ -2041,7 +1584,7 @@ pub struct UpdateSubscriptionSchedulePhasesItems<'a> { pub price: Option<&'a str>, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// Quantity for the given price. /// Can be set only if the price's `usage_type` is `licensed` and not `metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -2052,27 +1595,27 @@ pub struct UpdateSubscriptionSchedulePhasesItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> UpdateSubscriptionSchedulePhasesItems<'a> { +impl<'a> UpdateSubscriptionScheduleBuilderPhasesItems<'a> { pub fn new() -> Self { Self::default() } } /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesItemsPriceData<'a> { +pub struct UpdateSubscriptionScheduleBuilderPhasesItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// The ID of the product that this price will belong to. pub product: &'a str, /// The recurring components of a price such as `interval` and `interval_count`. - pub recurring: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring, + pub recurring: UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -2081,11 +1624,11 @@ pub struct UpdateSubscriptionSchedulePhasesItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> UpdateSubscriptionSchedulePhasesItemsPriceData<'a> { +impl<'a> UpdateSubscriptionScheduleBuilderPhasesItemsPriceData<'a> { pub fn new( currency: stripe_types::Currency, product: &'a str, - recurring: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring, + recurring: UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring, ) -> Self { Self { currency, @@ -2099,31 +1642,33 @@ impl<'a> UpdateSubscriptionSchedulePhasesItemsPriceData<'a> { } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring { +pub struct UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval, + pub interval: UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring { - pub fn new(interval: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval) -> Self { +impl UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurring { + pub fn new( + interval: UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval, + ) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +pub enum UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::*; + use UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -2133,10 +1678,10 @@ impl UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::*; + use UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -2146,18 +1691,18 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurri } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2170,14 +1715,14 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurrin /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +pub enum UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -2186,10 +1731,10 @@ impl UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -2198,18 +1743,18 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBeha } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderPhasesItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2222,14 +1767,14 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehav /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionSchedulePhasesProrationBehavior { +pub enum UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateSubscriptionSchedulePhasesProrationBehavior { +impl UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionSchedulePhasesProrationBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -2238,10 +1783,10 @@ impl UpdateSubscriptionSchedulePhasesProrationBehavior { } } -impl std::str::FromStr for UpdateSubscriptionSchedulePhasesProrationBehavior { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionSchedulePhasesProrationBehavior::*; + use UpdateSubscriptionScheduleBuilderPhasesProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -2250,18 +1795,18 @@ impl std::str::FromStr for UpdateSubscriptionSchedulePhasesProrationBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionSchedulePhasesProrationBehavior { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionSchedulePhasesProrationBehavior { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionSchedulePhasesProrationBehavior { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderPhasesProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2273,7 +1818,7 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesProrationBehavior { /// Must be set on the first phase. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateSubscriptionSchedulePhasesStartDate { +pub enum UpdateSubscriptionScheduleBuilderPhasesStartDate { Timestamp(stripe_types::Timestamp), Now, } @@ -2281,21 +1826,21 @@ pub enum UpdateSubscriptionSchedulePhasesStartDate { /// Must be before the phase end date, can not be combined with `trial`. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateSubscriptionSchedulePhasesTrialEnd { +pub enum UpdateSubscriptionScheduleBuilderPhasesTrialEnd { Timestamp(stripe_types::Timestamp), Now, } /// If the update changes the current phase, indicates whether the changes should be prorated. /// The default value is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleProrationBehavior { +pub enum UpdateSubscriptionScheduleBuilderProrationBehavior { AlwaysInvoice, CreateProrations, None, } -impl UpdateSubscriptionScheduleProrationBehavior { +impl UpdateSubscriptionScheduleBuilderProrationBehavior { pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleProrationBehavior::*; + use UpdateSubscriptionScheduleBuilderProrationBehavior::*; match self { AlwaysInvoice => "always_invoice", CreateProrations => "create_prorations", @@ -2304,10 +1849,10 @@ impl UpdateSubscriptionScheduleProrationBehavior { } } -impl std::str::FromStr for UpdateSubscriptionScheduleProrationBehavior { +impl std::str::FromStr for UpdateSubscriptionScheduleBuilderProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleProrationBehavior::*; + use UpdateSubscriptionScheduleBuilderProrationBehavior::*; match s { "always_invoice" => Ok(AlwaysInvoice), "create_prorations" => Ok(CreateProrations), @@ -2316,18 +1861,18 @@ impl std::str::FromStr for UpdateSubscriptionScheduleProrationBehavior { } } } -impl std::fmt::Display for UpdateSubscriptionScheduleProrationBehavior { +impl std::fmt::Display for UpdateSubscriptionScheduleBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSubscriptionScheduleProrationBehavior { +impl std::fmt::Debug for UpdateSubscriptionScheduleBuilderProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSubscriptionScheduleProrationBehavior { +impl serde::Serialize for UpdateSubscriptionScheduleBuilderProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2335,22 +1880,82 @@ impl serde::Serialize for UpdateSubscriptionScheduleProrationBehavior { serializer.serialize_str(self.as_str()) } } +/// Updates an existing subscription schedule. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateSubscriptionSchedule<'a> { + inner: UpdateSubscriptionScheduleBuilder<'a>, + schedule: &'a stripe_shared::SubscriptionScheduleId, +} impl<'a> UpdateSubscriptionSchedule<'a> { - /// Updates an existing subscription schedule. - pub fn send( + pub fn new(schedule: &'a stripe_shared::SubscriptionScheduleId) -> Self { + Self { schedule, inner: UpdateSubscriptionScheduleBuilder::new() } + } + pub fn default_settings( + mut self, + default_settings: UpdateSubscriptionScheduleBuilderDefaultSettings<'a>, + ) -> Self { + self.inner.default_settings = Some(default_settings); + self + } + + pub fn end_behavior( + mut self, + end_behavior: stripe_shared::SubscriptionScheduleEndBehavior, + ) -> Self { + self.inner.end_behavior = Some(end_behavior); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn phases(mut self, phases: &'a [UpdateSubscriptionScheduleBuilderPhases<'a>]) -> Self { + self.inner.phases = Some(phases); + self + } + + pub fn proration_behavior( + mut self, + proration_behavior: UpdateSubscriptionScheduleBuilderProrationBehavior, + ) -> Self { + self.inner.proration_behavior = Some(proration_behavior); + self + } +} +impl UpdateSubscriptionSchedule<'_> { + pub async fn send( &self, - client: &stripe::Client, - schedule: &stripe_shared::SubscriptionScheduleId, - ) -> stripe::Response { - client.send_form( - &format!("/subscription_schedules/{schedule}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateSubscriptionSchedule<'_> { + type Output = stripe_shared::SubscriptionSchedule; + + fn build(&self) -> RequestBuilder { + let schedule = self.schedule; + RequestBuilder::new(StripeMethod::Post, format!("/subscription_schedules/{schedule}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelSubscriptionSchedule<'a> { +pub struct CancelSubscriptionScheduleBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -2363,28 +1968,67 @@ pub struct CancelSubscriptionSchedule<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub prorate: Option, } -impl<'a> CancelSubscriptionSchedule<'a> { +impl<'a> CancelSubscriptionScheduleBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). +/// A subscription schedule can only be canceled if its status is `not_started` or `active`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelSubscriptionSchedule<'a> { + inner: CancelSubscriptionScheduleBuilder<'a>, + schedule: &'a stripe_shared::SubscriptionScheduleId, +} impl<'a> CancelSubscriptionSchedule<'a> { - /// Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). - /// A subscription schedule can only be canceled if its status is `not_started` or `active`. - pub fn send( + pub fn new(schedule: &'a stripe_shared::SubscriptionScheduleId) -> Self { + Self { schedule, inner: CancelSubscriptionScheduleBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_now(mut self, invoice_now: bool) -> Self { + self.inner.invoice_now = Some(invoice_now); + self + } + + pub fn prorate(mut self, prorate: bool) -> Self { + self.inner.prorate = Some(prorate); + self + } +} +impl CancelSubscriptionSchedule<'_> { + pub async fn send( &self, - client: &stripe::Client, - schedule: &stripe_shared::SubscriptionScheduleId, - ) -> stripe::Response { - client.send_form( - &format!("/subscription_schedules/{schedule}/cancel"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelSubscriptionSchedule<'_> { + type Output = stripe_shared::SubscriptionSchedule; + + fn build(&self) -> RequestBuilder { + let schedule = self.schedule; + RequestBuilder::new( + StripeMethod::Post, + format!("/subscription_schedules/{schedule}/cancel"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReleaseSubscriptionSchedule<'a> { +pub struct ReleaseSubscriptionScheduleBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -2392,25 +2036,70 @@ pub struct ReleaseSubscriptionSchedule<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub preserve_cancel_date: Option, } -impl<'a> ReleaseSubscriptionSchedule<'a> { +impl<'a> ReleaseSubscriptionScheduleBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. +/// A schedule can only be released if its status is `not_started` or `active`. +/// If the subscription schedule is currently associated with a subscription, releasing it will remove its `subscription` property and set the subscription’s ID to the `released_subscription` property. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReleaseSubscriptionSchedule<'a> { + inner: ReleaseSubscriptionScheduleBuilder<'a>, + schedule: &'a stripe_shared::SubscriptionScheduleId, +} impl<'a> ReleaseSubscriptionSchedule<'a> { - /// Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. - /// A schedule can only be released if its status is `not_started` or `active`. - /// If the subscription schedule is currently associated with a subscription, releasing it will remove its `subscription` property and set the subscription’s ID to the `released_subscription` property. - pub fn send( + pub fn new(schedule: &'a stripe_shared::SubscriptionScheduleId) -> Self { + Self { schedule, inner: ReleaseSubscriptionScheduleBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn preserve_cancel_date(mut self, preserve_cancel_date: bool) -> Self { + self.inner.preserve_cancel_date = Some(preserve_cancel_date); + self + } +} +impl ReleaseSubscriptionSchedule<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - schedule: &stripe_shared::SubscriptionScheduleId, - ) -> stripe::Response { - client.send_form( - &format!("/subscription_schedules/{schedule}/release"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ReleaseSubscriptionSchedule<'_> { + type Output = stripe_shared::SubscriptionSchedule; + + fn build(&self) -> RequestBuilder { + let schedule = self.schedule; + RequestBuilder::new( + StripeMethod::Post, + format!("/subscription_schedules/{schedule}/release"), ) + .form(&self.inner) + } +} + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxConfig { + /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. + pub enabled: bool, +} +impl AutomaticTaxConfig { + pub fn new(enabled: bool) -> Self { + Self { enabled } } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -2428,6 +2117,18 @@ impl BillingThresholdsParam { Self::default() } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SubscriptionScheduleDefaultSettingsParam { + /// Number of days within which a customer must pay invoices generated by this subscription schedule. + /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} +impl SubscriptionScheduleDefaultSettingsParam { + pub fn new() -> Self { + Self::default() + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct TransferDataSpecs<'a> { /// A non-negative decimal between 0 and 100, with at most two decimal places. @@ -2443,6 +2144,18 @@ impl<'a> TransferDataSpecs<'a> { Self { amount_percent: None, destination } } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct InvoiceSettings { + /// Number of days within which a customer must pay invoices generated by this subscription schedule. + /// This value will be `null` for subscription schedules where `billing=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} +impl InvoiceSettings { + pub fn new() -> Self { + Self::default() + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ItemBillingThresholdsParam { /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). diff --git a/generated/stripe_billing/src/tax_id/requests.rs b/generated/stripe_billing/src/tax_id/requests.rs index 89de3b060..cdf265724 100644 --- a/generated/stripe_billing/src/tax_id/requests.rs +++ b/generated/stripe_billing/src/tax_id/requests.rs @@ -1,256 +1,27 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteCustomerTaxId {} -impl DeleteCustomerTaxId { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteCustomerTaxId { - /// Deletes an existing `tax_id` object. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/tax_ids/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteIdTaxId {} -impl DeleteIdTaxId { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteIdTaxId { - /// Deletes an existing account or customer `tax_id` object. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::TaxIdId, - ) -> stripe::Response { - client.send_form(&format!("/tax_ids/{id}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCustomerTaxId<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListCustomerTaxId<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListCustomerTaxId<'a> { - /// Returns a list of tax IDs for a customer. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/tax_ids"), self) - } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/customers/{customer}/tax_ids"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCustomerTaxId<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCustomerTaxId<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveCustomerTaxId<'a> { - /// Retrieves the `tax_id` object with the given identifier. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}/tax_ids/{id}"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTaxId<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// The account or customer the tax ID belongs to. Defaults to `owner[type]=self`. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListTaxId<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The account or customer the tax ID belongs to. Defaults to `owner[type]=self`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTaxIdOwner<'a> { - /// Account the tax ID belongs to. Required when `type=account` - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Customer the tax ID belongs to. Required when `type=customer` - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// Type of owner referenced. - #[serde(rename = "type")] - pub type_: ListTaxIdOwnerType, -} -impl<'a> ListTaxIdOwner<'a> { - pub fn new(type_: ListTaxIdOwnerType) -> Self { - Self { account: None, customer: None, type_ } - } -} -/// Type of owner referenced. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTaxIdOwnerType { - Account, - Application, - Customer, - Self_, -} -impl ListTaxIdOwnerType { - pub fn as_str(self) -> &'static str { - use ListTaxIdOwnerType::*; - match self { - Account => "account", - Application => "application", - Customer => "customer", - Self_ => "self", - } - } -} - -impl std::str::FromStr for ListTaxIdOwnerType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTaxIdOwnerType::*; - match s { - "account" => Ok(Account), - "application" => Ok(Application), - "customer" => Ok(Customer), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for ListTaxIdOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; -impl std::fmt::Debug for ListTaxIdOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTaxIdOwnerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> ListTaxId<'a> { - /// Returns a list of tax IDs. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/tax_ids", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/tax_ids", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIdTaxId<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIdTaxId<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveIdTaxId<'a> { - /// Retrieves an account or customer `tax_id` object. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::TaxIdId, - ) -> stripe::Response { - client.get_query(&format!("/tax_ids/{id}"), self) - } -} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerTaxId<'a> { +pub struct CreateCustomerTaxIdBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[serde(rename = "type")] - pub type_: CreateCustomerTaxIdType, + pub type_: CreateCustomerTaxIdBuilderType, /// Value of the tax ID. pub value: &'a str, } -impl<'a> CreateCustomerTaxId<'a> { - pub fn new(type_: CreateCustomerTaxIdType, value: &'a str) -> Self { +impl<'a> CreateCustomerTaxIdBuilder<'a> { + pub fn new(type_: CreateCustomerTaxIdBuilderType, value: &'a str) -> Self { Self { expand: None, type_, value } } } /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateCustomerTaxIdType { +pub enum CreateCustomerTaxIdBuilderType { AdNrt, AeTrn, ArCuit, @@ -320,9 +91,9 @@ pub enum CreateCustomerTaxIdType { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateCustomerTaxIdType { +impl CreateCustomerTaxIdBuilderType { pub fn as_str(self) -> &'static str { - use CreateCustomerTaxIdType::*; + use CreateCustomerTaxIdBuilderType::*; match self { AdNrt => "ad_nrt", AeTrn => "ae_trn", @@ -395,10 +166,10 @@ impl CreateCustomerTaxIdType { } } -impl std::str::FromStr for CreateCustomerTaxIdType { +impl std::str::FromStr for CreateCustomerTaxIdBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCustomerTaxIdType::*; + use CreateCustomerTaxIdBuilderType::*; match s { "ad_nrt" => Ok(AdNrt), "ae_trn" => Ok(AeTrn), @@ -470,18 +241,18 @@ impl std::str::FromStr for CreateCustomerTaxIdType { } } } -impl std::fmt::Display for CreateCustomerTaxIdType { +impl std::fmt::Display for CreateCustomerTaxIdBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCustomerTaxIdType { +impl std::fmt::Debug for CreateCustomerTaxIdBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCustomerTaxIdType { +impl serde::Serialize for CreateCustomerTaxIdBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -489,350 +260,216 @@ impl serde::Serialize for CreateCustomerTaxIdType { serializer.serialize_str(self.as_str()) } } +/// Creates a new `tax_id` object for a customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCustomerTaxId<'a> { + inner: CreateCustomerTaxIdBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> CreateCustomerTaxId<'a> { - /// Creates a new `tax_id` object for a customer. - pub fn send( + pub fn new( + customer: &'a stripe_shared::CustomerId, + type_: CreateCustomerTaxIdBuilderType, + value: &'a str, + ) -> Self { + Self { customer, inner: CreateCustomerTaxIdBuilder::new(type_, value) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreateCustomerTaxId<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form(&format!("/customers/{customer}/tax_ids"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxId<'a> { + +impl StripeRequest for CreateCustomerTaxId<'_> { + type Output = stripe_shared::TaxId; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}/tax_ids")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTaxIdBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The account or customer the tax ID belongs to. Defaults to `owner[type]=self`. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, - /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. - #[serde(rename = "type")] - pub type_: CreateTaxIdType, - /// Value of the tax ID. - pub value: &'a str, } -impl<'a> CreateTaxId<'a> { - pub fn new(type_: CreateTaxIdType, value: &'a str) -> Self { - Self { expand: None, owner: None, type_, value } +impl<'a> RetrieveTaxIdBuilder<'a> { + pub fn new() -> Self { + Self::default() } } -/// The account or customer the tax ID belongs to. Defaults to `owner[type]=self`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxIdOwner<'a> { - /// Account the tax ID belongs to. Required when `type=account` - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Customer the tax ID belongs to. Required when `type=customer` - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// Type of owner referenced. - #[serde(rename = "type")] - pub type_: CreateTaxIdOwnerType, +/// Retrieves the `tax_id` object with the given identifier. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTaxId<'a> { + inner: RetrieveTaxIdBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, } -impl<'a> CreateTaxIdOwner<'a> { - pub fn new(type_: CreateTaxIdOwnerType) -> Self { - Self { account: None, customer: None, type_ } +impl<'a> RetrieveTaxId<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: RetrieveTaxIdBuilder::new() } } -} -/// Type of owner referenced. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxIdOwnerType { - Account, - Application, - Customer, - Self_, -} -impl CreateTaxIdOwnerType { - pub fn as_str(self) -> &'static str { - use CreateTaxIdOwnerType::*; - match self { - Account => "account", - Application => "application", - Customer => "customer", - Self_ => "self", - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } - -impl std::str::FromStr for CreateTaxIdOwnerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateTaxIdOwnerType::*; - match s { - "account" => Ok(Account), - "application" => Ok(Application), - "customer" => Ok(Customer), - "self" => Ok(Self_), - _ => Err(()), - } +impl RetrieveTaxId<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::fmt::Display for CreateTaxIdOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for CreateTaxIdOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for RetrieveTaxId<'_> { + type Output = stripe_shared::TaxId; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/tax_ids/{id}")) + .query(&self.inner) } } -impl serde::Serialize for CreateTaxIdOwnerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListCustomerTaxIdBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListCustomerTaxIdBuilder<'a> { + pub fn new() -> Self { + Self::default() } } -/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateTaxIdType { - AdNrt, - AeTrn, - ArCuit, - AuAbn, - AuArn, - BgUic, - BoTin, - BrCnpj, - BrCpf, - CaBn, - CaGstHst, - CaPstBc, - CaPstMb, - CaPstSk, - CaQst, - ChVat, - ClTin, - CnTin, - CoNit, - CrTin, - DoRcn, - EcRuc, - EgTin, - EsCif, - EuOssVat, - EuVat, - GbVat, - GeVat, - HkBr, - HuTin, - IdNpwp, - IlVat, - InGst, - IsVat, - JpCn, - JpRn, - JpTrn, - KePin, - KrBrn, - LiUid, - MxRfc, - MyFrp, - MyItn, - MySst, - NoVat, - NzGst, - PeRuc, - PhTin, - RoTin, - RsPib, - RuInn, - RuKpp, - SaVat, - SgGst, - SgUen, - SiTin, - SvNit, - ThVat, - TrTin, - TwVat, - UaVat, - UsEin, - UyRuc, - VeRif, - VnTin, - ZaVat, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, +/// Returns a list of tax IDs for a customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCustomerTaxId<'a> { + inner: ListCustomerTaxIdBuilder<'a>, + customer: &'a stripe_shared::CustomerId, } -impl CreateTaxIdType { - pub fn as_str(self) -> &'static str { - use CreateTaxIdType::*; - match self { - AdNrt => "ad_nrt", - AeTrn => "ae_trn", - ArCuit => "ar_cuit", - AuAbn => "au_abn", - AuArn => "au_arn", - BgUic => "bg_uic", - BoTin => "bo_tin", - BrCnpj => "br_cnpj", - BrCpf => "br_cpf", - CaBn => "ca_bn", - CaGstHst => "ca_gst_hst", - CaPstBc => "ca_pst_bc", - CaPstMb => "ca_pst_mb", - CaPstSk => "ca_pst_sk", - CaQst => "ca_qst", - ChVat => "ch_vat", - ClTin => "cl_tin", - CnTin => "cn_tin", - CoNit => "co_nit", - CrTin => "cr_tin", - DoRcn => "do_rcn", - EcRuc => "ec_ruc", - EgTin => "eg_tin", - EsCif => "es_cif", - EuOssVat => "eu_oss_vat", - EuVat => "eu_vat", - GbVat => "gb_vat", - GeVat => "ge_vat", - HkBr => "hk_br", - HuTin => "hu_tin", - IdNpwp => "id_npwp", - IlVat => "il_vat", - InGst => "in_gst", - IsVat => "is_vat", - JpCn => "jp_cn", - JpRn => "jp_rn", - JpTrn => "jp_trn", - KePin => "ke_pin", - KrBrn => "kr_brn", - LiUid => "li_uid", - MxRfc => "mx_rfc", - MyFrp => "my_frp", - MyItn => "my_itn", - MySst => "my_sst", - NoVat => "no_vat", - NzGst => "nz_gst", - PeRuc => "pe_ruc", - PhTin => "ph_tin", - RoTin => "ro_tin", - RsPib => "rs_pib", - RuInn => "ru_inn", - RuKpp => "ru_kpp", - SaVat => "sa_vat", - SgGst => "sg_gst", - SgUen => "sg_uen", - SiTin => "si_tin", - SvNit => "sv_nit", - ThVat => "th_vat", - TrTin => "tr_tin", - TwVat => "tw_vat", - UaVat => "ua_vat", - UsEin => "us_ein", - UyRuc => "uy_ruc", - VeRif => "ve_rif", - VnTin => "vn_tin", - ZaVat => "za_vat", - Unknown => "unknown", - } +impl<'a> ListCustomerTaxId<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: ListCustomerTaxIdBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -impl std::str::FromStr for CreateTaxIdType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateTaxIdType::*; - match s { - "ad_nrt" => Ok(AdNrt), - "ae_trn" => Ok(AeTrn), - "ar_cuit" => Ok(ArCuit), - "au_abn" => Ok(AuAbn), - "au_arn" => Ok(AuArn), - "bg_uic" => Ok(BgUic), - "bo_tin" => Ok(BoTin), - "br_cnpj" => Ok(BrCnpj), - "br_cpf" => Ok(BrCpf), - "ca_bn" => Ok(CaBn), - "ca_gst_hst" => Ok(CaGstHst), - "ca_pst_bc" => Ok(CaPstBc), - "ca_pst_mb" => Ok(CaPstMb), - "ca_pst_sk" => Ok(CaPstSk), - "ca_qst" => Ok(CaQst), - "ch_vat" => Ok(ChVat), - "cl_tin" => Ok(ClTin), - "cn_tin" => Ok(CnTin), - "co_nit" => Ok(CoNit), - "cr_tin" => Ok(CrTin), - "do_rcn" => Ok(DoRcn), - "ec_ruc" => Ok(EcRuc), - "eg_tin" => Ok(EgTin), - "es_cif" => Ok(EsCif), - "eu_oss_vat" => Ok(EuOssVat), - "eu_vat" => Ok(EuVat), - "gb_vat" => Ok(GbVat), - "ge_vat" => Ok(GeVat), - "hk_br" => Ok(HkBr), - "hu_tin" => Ok(HuTin), - "id_npwp" => Ok(IdNpwp), - "il_vat" => Ok(IlVat), - "in_gst" => Ok(InGst), - "is_vat" => Ok(IsVat), - "jp_cn" => Ok(JpCn), - "jp_rn" => Ok(JpRn), - "jp_trn" => Ok(JpTrn), - "ke_pin" => Ok(KePin), - "kr_brn" => Ok(KrBrn), - "li_uid" => Ok(LiUid), - "mx_rfc" => Ok(MxRfc), - "my_frp" => Ok(MyFrp), - "my_itn" => Ok(MyItn), - "my_sst" => Ok(MySst), - "no_vat" => Ok(NoVat), - "nz_gst" => Ok(NzGst), - "pe_ruc" => Ok(PeRuc), - "ph_tin" => Ok(PhTin), - "ro_tin" => Ok(RoTin), - "rs_pib" => Ok(RsPib), - "ru_inn" => Ok(RuInn), - "ru_kpp" => Ok(RuKpp), - "sa_vat" => Ok(SaVat), - "sg_gst" => Ok(SgGst), - "sg_uen" => Ok(SgUen), - "si_tin" => Ok(SiTin), - "sv_nit" => Ok(SvNit), - "th_vat" => Ok(ThVat), - "tr_tin" => Ok(TrTin), - "tw_vat" => Ok(TwVat), - "ua_vat" => Ok(UaVat), - "us_ein" => Ok(UsEin), - "uy_ruc" => Ok(UyRuc), - "ve_rif" => Ok(VeRif), - "vn_tin" => Ok(VnTin), - "za_vat" => Ok(ZaVat), - _ => Err(()), - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl std::fmt::Display for CreateTaxIdType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl ListCustomerTaxId<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for CreateTaxIdType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for ListCustomerTaxId<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/tax_ids")) + .query(&self.inner) } } -impl serde::Serialize for CreateTaxIdType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +/// Deletes an existing `tax_id` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteTaxId<'a> { + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} +impl<'a> DeleteTaxId<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id } + } +} +impl DeleteTaxId<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateTaxId<'a> { - /// Creates a new account or customer `tax_id` object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax_ids", self, http_types::Method::Post) + +impl StripeRequest for DeleteTaxId<'_> { + type Output = stripe_shared::DeletedTaxId; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/tax_ids/{id}")) } } diff --git a/generated/stripe_billing/src/test_helpers_test_clock/requests.rs b/generated/stripe_billing/src/test_helpers_test_clock/requests.rs index 5afa16c10..2e58c6547 100644 --- a/generated/stripe_billing/src/test_helpers_test_clock/requests.rs +++ b/generated/stripe_billing/src/test_helpers_test_clock/requests.rs @@ -1,86 +1,60 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteTestHelpersTestClock {} -impl DeleteTestHelpersTestClock { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteTestHelpersTestClock { - /// Deletes a test clock. - pub fn send( - &self, - client: &stripe::Client, - test_clock: &stripe_shared::TestHelpersTestClockId, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/test_clocks/{test_clock}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTestHelpersTestClock<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveTestHelpersTestClockBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> ListTestHelpersTestClock<'a> { +impl<'a> RetrieveTestHelpersTestClockBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListTestHelpersTestClock<'a> { - /// Returns a list of your test clocks. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/test_helpers/test_clocks", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/test_helpers/test_clocks", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves a test clock. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrieveTestHelpersTestClock<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: RetrieveTestHelpersTestClockBuilder<'a>, + test_clock: &'a stripe_shared::TestHelpersTestClockId, } impl<'a> RetrieveTestHelpersTestClock<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(test_clock: &'a stripe_shared::TestHelpersTestClockId) -> Self { + Self { test_clock, inner: RetrieveTestHelpersTestClockBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrieveTestHelpersTestClock<'a> { - /// Retrieves a test clock. - pub fn send( +impl RetrieveTestHelpersTestClock<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - test_clock: &stripe_shared::TestHelpersTestClockId, - ) -> stripe::Response { - client.get_query(&format!("/test_helpers/test_clocks/{test_clock}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTestHelpersTestClock<'_> { + type Output = stripe_shared::TestHelpersTestClock; + + fn build(&self) -> RequestBuilder { + let test_clock = self.test_clock; + RequestBuilder::new(StripeMethod::Get, format!("/test_helpers/test_clocks/{test_clock}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTestHelpersTestClock<'a> { +pub struct CreateTestHelpersTestClockBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -90,22 +64,89 @@ pub struct CreateTestHelpersTestClock<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, } -impl<'a> CreateTestHelpersTestClock<'a> { +impl<'a> CreateTestHelpersTestClockBuilder<'a> { pub fn new(frozen_time: stripe_types::Timestamp) -> Self { Self { expand: None, frozen_time, name: None } } } +/// Creates a new test clock that can be attached to new customers and quotes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTestHelpersTestClock<'a> { + inner: CreateTestHelpersTestClockBuilder<'a>, +} impl<'a> CreateTestHelpersTestClock<'a> { - /// Creates a new test clock that can be attached to new customers and quotes. - pub fn send( + pub fn new(frozen_time: stripe_types::Timestamp) -> Self { + Self { inner: CreateTestHelpersTestClockBuilder::new(frozen_time) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl CreateTestHelpersTestClock<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTestHelpersTestClock<'_> { + type Output = stripe_shared::TestHelpersTestClock; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/test_helpers/test_clocks").form(&self.inner) + } +} +/// Deletes a test clock. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteTestHelpersTestClock<'a> { + test_clock: &'a stripe_shared::TestHelpersTestClockId, +} +impl<'a> DeleteTestHelpersTestClock<'a> { + pub fn new(test_clock: &'a stripe_shared::TestHelpersTestClockId) -> Self { + Self { test_clock } + } +} +impl DeleteTestHelpersTestClock<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/test_helpers/test_clocks", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteTestHelpersTestClock<'_> { + type Output = stripe_shared::DeletedTestHelpersTestClock; + + fn build(&self) -> RequestBuilder { + let test_clock = self.test_clock; + RequestBuilder::new(StripeMethod::Delete, format!("/test_helpers/test_clocks/{test_clock}")) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct AdvanceTestHelpersTestClock<'a> { +pub struct AdvanceTestHelpersTestClockBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -115,23 +156,132 @@ pub struct AdvanceTestHelpersTestClock<'a> { /// If there are no subscriptions in this test clock, it cannot be more than two years in the future. pub frozen_time: stripe_types::Timestamp, } -impl<'a> AdvanceTestHelpersTestClock<'a> { +impl<'a> AdvanceTestHelpersTestClockBuilder<'a> { pub fn new(frozen_time: stripe_types::Timestamp) -> Self { Self { expand: None, frozen_time } } } +/// Starts advancing a test clock to a specified time in the future. +/// Advancement is done when status changes to `Ready`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct AdvanceTestHelpersTestClock<'a> { + inner: AdvanceTestHelpersTestClockBuilder<'a>, + test_clock: &'a stripe_shared::TestHelpersTestClockId, +} impl<'a> AdvanceTestHelpersTestClock<'a> { - /// Starts advancing a test clock to a specified time in the future. - /// Advancement is done when status changes to `Ready`. - pub fn send( + pub fn new( + test_clock: &'a stripe_shared::TestHelpersTestClockId, + frozen_time: stripe_types::Timestamp, + ) -> Self { + Self { test_clock, inner: AdvanceTestHelpersTestClockBuilder::new(frozen_time) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl AdvanceTestHelpersTestClock<'_> { + pub async fn send( &self, - client: &stripe::Client, - test_clock: &stripe_shared::TestHelpersTestClockId, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/test_clocks/{test_clock}/advance"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for AdvanceTestHelpersTestClock<'_> { + type Output = stripe_shared::TestHelpersTestClock; + + fn build(&self) -> RequestBuilder { + let test_clock = self.test_clock; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/test_clocks/{test_clock}/advance"), ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListTestHelpersTestClockBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListTestHelpersTestClockBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of your test clocks. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTestHelpersTestClock<'a> { + inner: ListTestHelpersTestClockBuilder<'a>, +} +impl<'a> ListTestHelpersTestClock<'a> { + pub fn new() -> Self { + Self { inner: ListTestHelpersTestClockBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTestHelpersTestClock<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTestHelpersTestClock<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/test_helpers/test_clocks").query(&self.inner) } } diff --git a/generated/stripe_billing/src/usage_record/requests.rs b/generated/stripe_billing/src/usage_record/requests.rs index f684d93eb..6b299c36d 100644 --- a/generated/stripe_billing/src/usage_record/requests.rs +++ b/generated/stripe_billing/src/usage_record/requests.rs @@ -1,11 +1,15 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemUsageRecord<'a> { +pub struct CreateSubscriptionItemUsageRecordBuilder<'a> { /// Valid values are `increment` (default) or `set`. /// When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. /// The `set` action will overwrite the usage quantity at that timestamp. /// If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value. #[serde(skip_serializing_if = "Option::is_none")] - pub action: Option, + pub action: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -16,9 +20,9 @@ pub struct CreateSubscriptionItemUsageRecord<'a> { /// When passing `"now"`, Stripe records usage for the current time. /// Default is `"now"` if a value is not provided. #[serde(skip_serializing_if = "Option::is_none")] - pub timestamp: Option, + pub timestamp: Option, } -impl<'a> CreateSubscriptionItemUsageRecord<'a> { +impl<'a> CreateSubscriptionItemUsageRecordBuilder<'a> { pub fn new(quantity: u64) -> Self { Self { action: None, expand: None, quantity, timestamp: None } } @@ -28,13 +32,13 @@ impl<'a> CreateSubscriptionItemUsageRecord<'a> { /// The `set` action will overwrite the usage quantity at that timestamp. /// If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionItemUsageRecordAction { +pub enum CreateSubscriptionItemUsageRecordBuilderAction { Increment, Set, } -impl CreateSubscriptionItemUsageRecordAction { +impl CreateSubscriptionItemUsageRecordBuilderAction { pub fn as_str(self) -> &'static str { - use CreateSubscriptionItemUsageRecordAction::*; + use CreateSubscriptionItemUsageRecordBuilderAction::*; match self { Increment => "increment", Set => "set", @@ -42,10 +46,10 @@ impl CreateSubscriptionItemUsageRecordAction { } } -impl std::str::FromStr for CreateSubscriptionItemUsageRecordAction { +impl std::str::FromStr for CreateSubscriptionItemUsageRecordBuilderAction { type Err = (); fn from_str(s: &str) -> Result { - use CreateSubscriptionItemUsageRecordAction::*; + use CreateSubscriptionItemUsageRecordBuilderAction::*; match s { "increment" => Ok(Increment), "set" => Ok(Set), @@ -53,18 +57,18 @@ impl std::str::FromStr for CreateSubscriptionItemUsageRecordAction { } } } -impl std::fmt::Display for CreateSubscriptionItemUsageRecordAction { +impl std::fmt::Display for CreateSubscriptionItemUsageRecordBuilderAction { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSubscriptionItemUsageRecordAction { +impl std::fmt::Debug for CreateSubscriptionItemUsageRecordBuilderAction { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSubscriptionItemUsageRecordAction { +impl serde::Serialize for CreateSubscriptionItemUsageRecordBuilderAction { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -78,32 +82,74 @@ impl serde::Serialize for CreateSubscriptionItemUsageRecordAction { /// Default is `"now"` if a value is not provided. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateSubscriptionItemUsageRecordTimestamp { +pub enum CreateSubscriptionItemUsageRecordBuilderTimestamp { Now, Timestamp(stripe_types::Timestamp), } +/// Creates a usage record for a specified subscription item and date, and fills it with a quantity. +/// +/// Usage records provide `quantity` information that Stripe uses to track how much a customer is using your service. +/// With usage information and the pricing model set up by the [metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) plan, Stripe helps you send accurate invoices to your customers. +/// +/// The default calculation for usage is to add up all the `quantity` values of the usage records within a billing period. +/// You can change this default behavior with the billing plan’s `aggregate_usage` [parameter](https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage). +/// When there is more than one usage record with the same timestamp, Stripe adds the `quantity` values together. +/// In most cases, this is the desired resolution, however, you can change this behavior with the `action` parameter. +/// +/// The default pricing model for metered billing is [per-unit pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme). +/// For finer granularity, you can configure metered billing to have a [tiered pricing](https://stripe.com/docs/billing/subscriptions/tiers) model. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSubscriptionItemUsageRecord<'a> { + inner: CreateSubscriptionItemUsageRecordBuilder<'a>, + subscription_item: &'a stripe_shared::SubscriptionItemId, +} impl<'a> CreateSubscriptionItemUsageRecord<'a> { - /// Creates a usage record for a specified subscription item and date, and fills it with a quantity. - /// - /// Usage records provide `quantity` information that Stripe uses to track how much a customer is using your service. - /// With usage information and the pricing model set up by the [metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) plan, Stripe helps you send accurate invoices to your customers. - /// - /// The default calculation for usage is to add up all the `quantity` values of the usage records within a billing period. - /// You can change this default behavior with the billing plan’s `aggregate_usage` [parameter](https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage). - /// When there is more than one usage record with the same timestamp, Stripe adds the `quantity` values together. - /// In most cases, this is the desired resolution, however, you can change this behavior with the `action` parameter. - /// - /// The default pricing model for metered billing is [per-unit pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme). - /// For finer granularity, you can configure metered billing to have a [tiered pricing](https://stripe.com/docs/billing/subscriptions/tiers) model. - pub fn send( + pub fn new(subscription_item: &'a stripe_shared::SubscriptionItemId, quantity: u64) -> Self { + Self { subscription_item, inner: CreateSubscriptionItemUsageRecordBuilder::new(quantity) } + } + pub fn action(mut self, action: CreateSubscriptionItemUsageRecordBuilderAction) -> Self { + self.inner.action = Some(action); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn timestamp( + mut self, + timestamp: CreateSubscriptionItemUsageRecordBuilderTimestamp, + ) -> Self { + self.inner.timestamp = Some(timestamp); + self + } +} +impl CreateSubscriptionItemUsageRecord<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - subscription_item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response { - client.send_form( - &format!("/subscription_items/{subscription_item}/usage_records"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateSubscriptionItemUsageRecord<'_> { + type Output = stripe_billing::UsageRecord; + + fn build(&self) -> RequestBuilder { + let subscription_item = self.subscription_item; + RequestBuilder::new( + StripeMethod::Post, + format!("/subscription_items/{subscription_item}/usage_records"), ) + .form(&self.inner) } } diff --git a/generated/stripe_billing/src/usage_record_summary/requests.rs b/generated/stripe_billing/src/usage_record_summary/requests.rs index af87b912b..b3dc8e0f2 100644 --- a/generated/stripe_billing/src/usage_record_summary/requests.rs +++ b/generated/stripe_billing/src/usage_record_summary/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListSubscriptionItemUsageRecordSummary<'a> { +pub struct ListSubscriptionItemUsageRecordSummaryBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,35 +22,71 @@ pub struct ListSubscriptionItemUsageRecordSummary<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListSubscriptionItemUsageRecordSummary<'a> { +impl<'a> ListSubscriptionItemUsageRecordSummaryBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// For the specified subscription item, returns a list of summary objects. +/// Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). +/// +/// The list is sorted in reverse-chronological order (newest first). +/// The first list item represents the most current usage period that hasn’t ended yet. +/// Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSubscriptionItemUsageRecordSummary<'a> { + inner: ListSubscriptionItemUsageRecordSummaryBuilder<'a>, + subscription_item: &'a stripe_shared::SubscriptionItemId, +} impl<'a> ListSubscriptionItemUsageRecordSummary<'a> { - /// For the specified subscription item, returns a list of summary objects. - /// Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). - /// - /// The list is sorted in reverse-chronological order (newest first). - /// The first list item represents the most current usage period that hasn’t ended yet. - /// Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends. - pub fn send( + pub fn new(subscription_item: &'a stripe_shared::SubscriptionItemId) -> Self { + Self { subscription_item, inner: ListSubscriptionItemUsageRecordSummaryBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListSubscriptionItemUsageRecordSummary<'_> { + pub async fn send( &self, - client: &stripe::Client, - subscription_item: &stripe_shared::SubscriptionItemId, - ) -> stripe::Response> { - client.get_query( - &format!("/subscription_items/{subscription_item}/usage_record_summaries"), - self, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - subscription_item: &stripe_shared::SubscriptionItemId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/subscription_items/{subscription_item}/usage_record_summaries"), - self, + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListSubscriptionItemUsageRecordSummary<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let subscription_item = self.subscription_item; + RequestBuilder::new( + StripeMethod::Get, + format!("/subscription_items/{subscription_item}/usage_record_summaries"), ) + .query(&self.inner) } } diff --git a/generated/stripe_checkout/Cargo.toml b/generated/stripe_checkout/Cargo.toml index 11ffe804b..c20450b6a 100644 --- a/generated/stripe_checkout/Cargo.toml +++ b/generated/stripe_checkout/Cargo.toml @@ -19,28 +19,17 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - checkout_session = [] full = ["checkout_session"] [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_checkout/src/checkout_session/requests.rs b/generated/stripe_checkout/src/checkout_session/requests.rs index d7bcb4a45..5f18ef09a 100644 --- a/generated/stripe_checkout/src/checkout_session/requests.rs +++ b/generated/stripe_checkout/src/checkout_session/requests.rs @@ -1,14 +1,15 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCheckoutSession<'a> { - /// Only return the Checkout Sessions that were created during the given date interval. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, +pub struct ListCheckoutSessionBuilder<'a> { /// Only return the Checkout Sessions for the Customer specified. #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option<&'a str>, /// Only return the Checkout Sessions for the Customer details specified. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_details: Option>, + pub customer_details: Option>, /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -39,113 +40,169 @@ pub struct ListCheckoutSession<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub subscription: Option<&'a str>, } -impl<'a> ListCheckoutSession<'a> { +impl<'a> ListCheckoutSessionBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Only return the Checkout Sessions for the Customer details specified. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListCheckoutSessionCustomerDetails<'a> { +pub struct ListCheckoutSessionBuilderCustomerDetails<'a> { /// Customer's email address. pub email: &'a str, } -impl<'a> ListCheckoutSessionCustomerDetails<'a> { +impl<'a> ListCheckoutSessionBuilderCustomerDetails<'a> { pub fn new(email: &'a str) -> Self { Self { email } } } +/// Returns a list of Checkout Sessions. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCheckoutSession<'a> { + inner: ListCheckoutSessionBuilder<'a>, +} impl<'a> ListCheckoutSession<'a> { - /// Returns a list of Checkout Sessions. - pub fn send( + pub fn new() -> Self { + Self { inner: ListCheckoutSessionBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_details( + mut self, + customer_details: ListCheckoutSessionBuilderCustomerDetails<'a>, + ) -> Self { + self.inner.customer_details = Some(customer_details); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn payment_link(mut self, payment_link: &'a str) -> Self { + self.inner.payment_link = Some(payment_link); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_checkout::CheckoutSessionStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn subscription(mut self, subscription: &'a str) -> Self { + self.inner.subscription = Some(subscription); + self + } +} +impl ListCheckoutSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/checkout/sessions", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/checkout/sessions", self) +} + +impl StripeRequest for ListCheckoutSession<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/checkout/sessions").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCheckoutSession<'a> { +pub struct RetrieveCheckoutSessionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveCheckoutSession<'a> { +impl<'a> RetrieveCheckoutSessionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a Session object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCheckoutSession<'a> { + inner: RetrieveCheckoutSessionBuilder<'a>, + session: &'a stripe_checkout::CheckoutSessionId, +} impl<'a> RetrieveCheckoutSession<'a> { - /// Retrieves a Session object. - pub fn send( - &self, - client: &stripe::Client, - session: &stripe_checkout::CheckoutSessionId, - ) -> stripe::Response { - client.get_query(&format!("/checkout/sessions/{session}"), self) + pub fn new(session: &'a stripe_checkout::CheckoutSessionId) -> Self { + Self { session, inner: RetrieveCheckoutSessionBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListLineItemsCheckoutSession<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListLineItemsCheckoutSession<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> ListLineItemsCheckoutSession<'a> { - /// When retrieving a Checkout Session, there is an includable **line_items** property containing the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( +impl RetrieveCheckoutSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - session: &stripe_checkout::CheckoutSessionId, - ) -> stripe::Response> { - client.get_query(&format!("/checkout/sessions/{session}/line_items"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - session: &stripe_checkout::CheckoutSessionId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/checkout/sessions/{session}/line_items"), - self, - ) +} + +impl StripeRequest for RetrieveCheckoutSession<'_> { + type Output = stripe_checkout::CheckoutSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new(StripeMethod::Get, format!("/checkout/sessions/{session}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSession<'a> { +pub struct CreateCheckoutSessionBuilder<'a> { /// Configure actions after a Checkout Session has expired. #[serde(skip_serializing_if = "Option::is_none")] - pub after_expiration: Option, + pub after_expiration: Option, /// Enables user redeemable promotion codes. #[serde(skip_serializing_if = "Option::is_none")] pub allow_promotion_codes: Option, /// Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Specify whether Checkout should collect the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing_address_collection: @@ -160,19 +217,19 @@ pub struct CreateCheckoutSession<'a> { pub client_reference_id: Option<&'a str>, /// Configure fields for the Checkout Session to gather active consent from customers. #[serde(skip_serializing_if = "Option::is_none")] - pub consent_collection: Option, + pub consent_collection: Option, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). /// Required in `setup` mode when `payment_method_types` is not set. #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option, /// Collect additional information from your customer using custom fields. - /// Up to 3 fields are supported. + /// Up to 2 fields are supported. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CreateCheckoutSessionCustomFields<'a>]>, + pub custom_fields: Option<&'a [CreateCheckoutSessionBuilderCustomFields<'a>]>, /// Display additional text for your customers using custom text. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_text: Option>, + pub custom_text: Option>, /// ID of an existing Customer, if one exists. /// In `payment` mode, the customer’s most recently saved card. /// payment method will be used to prefill the email, name, card details, and billing address @@ -200,7 +257,7 @@ pub struct CreateCheckoutSession<'a> { /// /// Can only be set in `payment` and `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_creation: Option, + pub customer_creation: Option, /// If provided, this value will be used when the Customer object is created. /// If not provided, customers will be asked to enter their email address. /// Use this parameter to prefill customer data if you already have an email @@ -211,10 +268,10 @@ pub struct CreateCheckoutSession<'a> { /// Controls what fields on Customer can be updated by the Checkout Session. /// Can only be provided when `customer` is provided. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_update: Option, + pub customer_update: Option, /// The coupon or promotion code to apply to this Session. Currently, only up to one may be specified. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [CreateCheckoutSessionDiscounts<'a>]>, + pub discounts: Option<&'a [CreateCheckoutSessionBuilderDiscounts<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -225,7 +282,7 @@ pub struct CreateCheckoutSession<'a> { pub expires_at: Option, /// Generate a post-purchase Invoice for one-time payments. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_creation: Option>, + pub invoice_creation: Option>, /// A list of items the customer is purchasing. /// Use this parameter to pass one-time or recurring [Prices](https://stripe.com/docs/api/prices). /// @@ -234,7 +291,7 @@ pub struct CreateCheckoutSession<'a> { /// For `subscription` mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. /// Line items with one-time Prices will be on the initial invoice only. #[serde(skip_serializing_if = "Option::is_none")] - pub line_items: Option<&'a [CreateCheckoutSessionLineItems<'a>]>, + pub line_items: Option<&'a [CreateCheckoutSessionBuilderLineItems<'a>]>, /// The IETF language tag of the locale Checkout is displayed in. /// If blank or `auto`, the browser's locale is used. #[serde(skip_serializing_if = "Option::is_none")] @@ -251,7 +308,7 @@ pub struct CreateCheckoutSession<'a> { pub mode: Option, /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_intent_data: Option>, + pub payment_intent_data: Option>, /// Specify whether Checkout should collect a payment method. /// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0. /// This may occur if the Checkout Session includes a free trial or a discount. @@ -260,13 +317,13 @@ pub struct CreateCheckoutSession<'a> { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on configuring [subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_collection: Option, + pub payment_method_collection: Option, /// 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<&'a str>, /// Payment-method-specific configuration. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// A list of the types of payment methods (e.g., `card`) this Checkout Session can accept. /// /// You can omit this attribute to manage your payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). @@ -279,14 +336,14 @@ pub struct CreateCheckoutSession<'a> { /// prioritize the most relevant payment methods based on the customer's location and /// other characteristics. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [CreateCheckoutSessionPaymentMethodTypes]>, + pub payment_method_types: Option<&'a [CreateCheckoutSessionBuilderPaymentMethodTypes]>, /// Controls phone number collection settings for the session. /// /// We recommend that you review your privacy policy and check with your legal contacts /// before using this feature. /// Learn more about [collecting phone numbers with Checkout](https://stripe.com/docs/payments/checkout/phone-numbers). #[serde(skip_serializing_if = "Option::is_none")] - pub phone_number_collection: Option, + pub phone_number_collection: Option, /// This parameter applies to `ui_mode: embedded`. /// By default, Stripe will always redirect to your return_url after a successful confirmation. /// If you set `redirect_on_completion: 'if_required'`, then we will only redirect if your user chooses a redirect-based payment method. @@ -299,21 +356,23 @@ pub struct CreateCheckoutSession<'a> { pub return_url: Option<&'a str>, /// A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_intent_data: Option>, + pub setup_intent_data: Option>, /// When set, provides configuration for Checkout to collect a shipping address from a customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address_collection: Option>, + pub shipping_address_collection: + Option>, /// The shipping rate options to apply to this Session. Up to a maximum of 5. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_options: Option<&'a [CreateCheckoutSessionShippingOptions<'a>]>, + pub shipping_options: Option<&'a [CreateCheckoutSessionBuilderShippingOptions<'a>]>, /// Describes the type of transaction being performed by Checkout in order to customize /// relevant text on the page, such as the submit button. `submit_type` can only be - /// specified on Checkout Sessions in `payment` mode. If blank or `auto`, `pay` is used. + /// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions + /// in `subscription` or `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] pub submit_type: Option, /// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_data: Option>, + pub subscription_data: Option>, /// The URL to which Stripe should send customers when payment or setup /// is complete. /// This parameter is not allowed if ui_mode is `embedded`. If you’d like to use @@ -323,31 +382,31 @@ pub struct CreateCheckoutSession<'a> { pub success_url: Option<&'a str>, /// Controls tax ID collection settings for the session. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id_collection: Option, + pub tax_id_collection: Option, /// `ui_mode` can be `hosted` or `embedded`. The default is `hosted`. #[serde(skip_serializing_if = "Option::is_none")] pub ui_mode: Option, } -impl<'a> CreateCheckoutSession<'a> { +impl<'a> CreateCheckoutSessionBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Configure actions after a Checkout Session has expired. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionAfterExpiration { +pub struct CreateCheckoutSessionBuilderAfterExpiration { /// Configure a Checkout Session that can be used to recover an expired session. #[serde(skip_serializing_if = "Option::is_none")] - pub recovery: Option, + pub recovery: Option, } -impl CreateCheckoutSessionAfterExpiration { +impl CreateCheckoutSessionBuilderAfterExpiration { pub fn new() -> Self { Self::default() } } /// Configure a Checkout Session that can be used to recover an expired session. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionAfterExpirationRecovery { +pub struct CreateCheckoutSessionBuilderAfterExpirationRecovery { /// Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to `false` #[serde(skip_serializing_if = "Option::is_none")] pub allow_promotion_codes: Option, @@ -356,198 +415,53 @@ pub struct CreateCheckoutSessionAfterExpirationRecovery { /// Checkout Session object upon expiration. pub enabled: bool, } -impl CreateCheckoutSessionAfterExpirationRecovery { +impl CreateCheckoutSessionBuilderAfterExpirationRecovery { pub fn new(enabled: bool) -> Self { Self { allow_promotion_codes: None, enabled } } } /// Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionAutomaticTax<'a> { +pub struct CreateCheckoutSessionBuilderAutomaticTax { /// Set to true to enable automatic taxes. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, } -impl<'a> CreateCheckoutSessionAutomaticTax<'a> { +impl CreateCheckoutSessionBuilderAutomaticTax { pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateCheckoutSessionAutomaticTaxLiabilityType, -} -impl<'a> CreateCheckoutSessionAutomaticTaxLiability<'a> { - pub fn new(type_: CreateCheckoutSessionAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreateCheckoutSessionAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateCheckoutSessionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionAutomaticTaxLiabilityType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionAutomaticTaxLiabilityType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + Self { enabled } } } /// Configure fields for the Checkout Session to gather active consent from customers. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionConsentCollection { - /// Determines the display of payment method reuse agreement text in the UI. - /// If set to `hidden`, it will hide legal text related to the reuse of a payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_reuse_agreement: - Option, +pub struct CreateCheckoutSessionBuilderConsentCollection { /// If set to `auto`, enables the collection of customer consent for promotional communications. /// The Checkout. /// Session will determine whether to display an option to opt into promotional communication /// from the merchant depending on the customer's locale. Only available to US merchants. #[serde(skip_serializing_if = "Option::is_none")] - pub promotions: Option, + pub promotions: Option, /// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay. /// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public). #[serde(skip_serializing_if = "Option::is_none")] - pub terms_of_service: Option, + pub terms_of_service: Option, } -impl CreateCheckoutSessionConsentCollection { +impl CreateCheckoutSessionBuilderConsentCollection { pub fn new() -> Self { Self::default() } } -/// Determines the display of payment method reuse agreement text in the UI. -/// If set to `hidden`, it will hide legal text related to the reuse of a payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement { - /// Determines the position and visibility of the payment method reuse agreement in the UI. - /// When set to `auto`, Stripe's. - /// defaults will be used. - /// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. - pub position: CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition, -} -impl CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement { - pub fn new( - position: CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition, - ) -> Self { - Self { position } - } -} -/// Determines the position and visibility of the payment method reuse agreement in the UI. -/// When set to `auto`, Stripe's. -/// defaults will be used. -/// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition { - Auto, - Hidden, -} -impl CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition::*; - match self { - Auto => "auto", - Hidden => "hidden", - } - } -} - -impl std::str::FromStr - for CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition::*; - match s { - "auto" => Ok(Auto), - "hidden" => Ok(Hidden), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// If set to `auto`, enables the collection of customer consent for promotional communications. /// The Checkout. /// Session will determine whether to display an option to opt into promotional communication /// from the merchant depending on the customer's locale. Only available to US merchants. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionConsentCollectionPromotions { +pub enum CreateCheckoutSessionBuilderConsentCollectionPromotions { Auto, None, } -impl CreateCheckoutSessionConsentCollectionPromotions { +impl CreateCheckoutSessionBuilderConsentCollectionPromotions { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionConsentCollectionPromotions::*; + use CreateCheckoutSessionBuilderConsentCollectionPromotions::*; match self { Auto => "auto", None => "none", @@ -555,10 +469,10 @@ impl CreateCheckoutSessionConsentCollectionPromotions { } } -impl std::str::FromStr for CreateCheckoutSessionConsentCollectionPromotions { +impl std::str::FromStr for CreateCheckoutSessionBuilderConsentCollectionPromotions { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionConsentCollectionPromotions::*; + use CreateCheckoutSessionBuilderConsentCollectionPromotions::*; match s { "auto" => Ok(Auto), "none" => Ok(None), @@ -566,18 +480,18 @@ impl std::str::FromStr for CreateCheckoutSessionConsentCollectionPromotions { } } } -impl std::fmt::Display for CreateCheckoutSessionConsentCollectionPromotions { +impl std::fmt::Display for CreateCheckoutSessionBuilderConsentCollectionPromotions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionConsentCollectionPromotions { +impl std::fmt::Debug for CreateCheckoutSessionBuilderConsentCollectionPromotions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionConsentCollectionPromotions { +impl serde::Serialize for CreateCheckoutSessionBuilderConsentCollectionPromotions { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -588,13 +502,13 @@ impl serde::Serialize for CreateCheckoutSessionConsentCollectionPromotions { /// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay. /// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionConsentCollectionTermsOfService { +pub enum CreateCheckoutSessionBuilderConsentCollectionTermsOfService { None, Required, } -impl CreateCheckoutSessionConsentCollectionTermsOfService { +impl CreateCheckoutSessionBuilderConsentCollectionTermsOfService { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionConsentCollectionTermsOfService::*; + use CreateCheckoutSessionBuilderConsentCollectionTermsOfService::*; match self { None => "none", Required => "required", @@ -602,10 +516,10 @@ impl CreateCheckoutSessionConsentCollectionTermsOfService { } } -impl std::str::FromStr for CreateCheckoutSessionConsentCollectionTermsOfService { +impl std::str::FromStr for CreateCheckoutSessionBuilderConsentCollectionTermsOfService { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionConsentCollectionTermsOfService::*; + use CreateCheckoutSessionBuilderConsentCollectionTermsOfService::*; match s { "none" => Ok(None), "required" => Ok(Required), @@ -613,18 +527,18 @@ impl std::str::FromStr for CreateCheckoutSessionConsentCollectionTermsOfService } } } -impl std::fmt::Display for CreateCheckoutSessionConsentCollectionTermsOfService { +impl std::fmt::Display for CreateCheckoutSessionBuilderConsentCollectionTermsOfService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionConsentCollectionTermsOfService { +impl std::fmt::Debug for CreateCheckoutSessionBuilderConsentCollectionTermsOfService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionConsentCollectionTermsOfService { +impl serde::Serialize for CreateCheckoutSessionBuilderConsentCollectionTermsOfService { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -633,115 +547,115 @@ impl serde::Serialize for CreateCheckoutSessionConsentCollectionTermsOfService { } } /// Collect additional information from your customer using custom fields. -/// Up to 3 fields are supported. +/// Up to 2 fields are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFields<'a> { +pub struct CreateCheckoutSessionBuilderCustomFields<'a> { /// Configuration for `type=dropdown` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub dropdown: Option>, + pub dropdown: Option>, /// String of your choice that your integration can use to reconcile this field. /// Must be unique to this field, alphanumeric, and up to 200 characters. pub key: &'a str, /// The label for the field, displayed to the customer. - pub label: CreateCheckoutSessionCustomFieldsLabel<'a>, + pub label: CreateCheckoutSessionBuilderCustomFieldsLabel<'a>, /// Configuration for `type=numeric` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub numeric: Option, + pub numeric: Option, /// Whether the customer is required to complete the field before completing the Checkout Session. /// Defaults to `false`. #[serde(skip_serializing_if = "Option::is_none")] pub optional: Option, /// Configuration for `type=text` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, + pub text: Option, /// The type of the field. #[serde(rename = "type")] - pub type_: CreateCheckoutSessionCustomFieldsType, + pub type_: CreateCheckoutSessionBuilderCustomFieldsType, } -impl<'a> CreateCheckoutSessionCustomFields<'a> { +impl<'a> CreateCheckoutSessionBuilderCustomFields<'a> { pub fn new( key: &'a str, - label: CreateCheckoutSessionCustomFieldsLabel<'a>, - type_: CreateCheckoutSessionCustomFieldsType, + label: CreateCheckoutSessionBuilderCustomFieldsLabel<'a>, + type_: CreateCheckoutSessionBuilderCustomFieldsType, ) -> Self { Self { dropdown: None, key, label, numeric: None, optional: None, text: None, type_ } } } /// Configuration for `type=dropdown` fields. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFieldsDropdown<'a> { +pub struct CreateCheckoutSessionBuilderCustomFieldsDropdown<'a> { /// The options available for the customer to select. Up to 200 options allowed. - pub options: &'a [CreateCheckoutSessionCustomFieldsDropdownOptions<'a>], + pub options: &'a [CreateCheckoutSessionBuilderCustomFieldsDropdownOptions<'a>], } -impl<'a> CreateCheckoutSessionCustomFieldsDropdown<'a> { - pub fn new(options: &'a [CreateCheckoutSessionCustomFieldsDropdownOptions<'a>]) -> Self { +impl<'a> CreateCheckoutSessionBuilderCustomFieldsDropdown<'a> { + pub fn new(options: &'a [CreateCheckoutSessionBuilderCustomFieldsDropdownOptions<'a>]) -> Self { Self { options } } } /// The options available for the customer to select. Up to 200 options allowed. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFieldsDropdownOptions<'a> { +pub struct CreateCheckoutSessionBuilderCustomFieldsDropdownOptions<'a> { /// The label for the option, displayed to the customer. Up to 100 characters. pub label: &'a str, /// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. /// Must be unique to this option, alphanumeric, and up to 100 characters. pub value: &'a str, } -impl<'a> CreateCheckoutSessionCustomFieldsDropdownOptions<'a> { +impl<'a> CreateCheckoutSessionBuilderCustomFieldsDropdownOptions<'a> { pub fn new(label: &'a str, value: &'a str) -> Self { Self { label, value } } } /// The label for the field, displayed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFieldsLabel<'a> { +pub struct CreateCheckoutSessionBuilderCustomFieldsLabel<'a> { /// Custom text for the label, displayed to the customer. Up to 50 characters. pub custom: &'a str, /// The type of the label. #[serde(rename = "type")] - pub type_: CreateCheckoutSessionCustomFieldsLabelType, + pub type_: CreateCheckoutSessionBuilderCustomFieldsLabelType, } -impl<'a> CreateCheckoutSessionCustomFieldsLabel<'a> { - pub fn new(custom: &'a str, type_: CreateCheckoutSessionCustomFieldsLabelType) -> Self { +impl<'a> CreateCheckoutSessionBuilderCustomFieldsLabel<'a> { + pub fn new(custom: &'a str, type_: CreateCheckoutSessionBuilderCustomFieldsLabelType) -> Self { Self { custom, type_ } } } /// The type of the label. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomFieldsLabelType { +pub enum CreateCheckoutSessionBuilderCustomFieldsLabelType { Custom, } -impl CreateCheckoutSessionCustomFieldsLabelType { +impl CreateCheckoutSessionBuilderCustomFieldsLabelType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomFieldsLabelType::*; + use CreateCheckoutSessionBuilderCustomFieldsLabelType::*; match self { Custom => "custom", } } } -impl std::str::FromStr for CreateCheckoutSessionCustomFieldsLabelType { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomFieldsLabelType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomFieldsLabelType::*; + use CreateCheckoutSessionBuilderCustomFieldsLabelType::*; match s { "custom" => Ok(Custom), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionCustomFieldsLabelType { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomFieldsLabelType { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomFieldsLabelType { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomFieldsLabelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -751,7 +665,7 @@ impl serde::Serialize for CreateCheckoutSessionCustomFieldsLabelType { } /// Configuration for `type=numeric` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFieldsNumeric { +pub struct CreateCheckoutSessionBuilderCustomFieldsNumeric { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -759,14 +673,14 @@ pub struct CreateCheckoutSessionCustomFieldsNumeric { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl CreateCheckoutSessionCustomFieldsNumeric { +impl CreateCheckoutSessionBuilderCustomFieldsNumeric { pub fn new() -> Self { Self::default() } } /// Configuration for `type=text` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionCustomFieldsText { +pub struct CreateCheckoutSessionBuilderCustomFieldsText { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -774,21 +688,21 @@ pub struct CreateCheckoutSessionCustomFieldsText { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl CreateCheckoutSessionCustomFieldsText { +impl CreateCheckoutSessionBuilderCustomFieldsText { pub fn new() -> Self { Self::default() } } /// The type of the field. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomFieldsType { +pub enum CreateCheckoutSessionBuilderCustomFieldsType { Dropdown, Numeric, Text, } -impl CreateCheckoutSessionCustomFieldsType { +impl CreateCheckoutSessionBuilderCustomFieldsType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomFieldsType::*; + use CreateCheckoutSessionBuilderCustomFieldsType::*; match self { Dropdown => "dropdown", Numeric => "numeric", @@ -797,10 +711,10 @@ impl CreateCheckoutSessionCustomFieldsType { } } -impl std::str::FromStr for CreateCheckoutSessionCustomFieldsType { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomFieldsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomFieldsType::*; + use CreateCheckoutSessionBuilderCustomFieldsType::*; match s { "dropdown" => Ok(Dropdown), "numeric" => Ok(Numeric), @@ -809,18 +723,18 @@ impl std::str::FromStr for CreateCheckoutSessionCustomFieldsType { } } } -impl std::fmt::Display for CreateCheckoutSessionCustomFieldsType { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomFieldsType { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomFieldsType { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomFieldsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -830,10 +744,7 @@ impl serde::Serialize for CreateCheckoutSessionCustomFieldsType { } /// Display additional text for your customers using custom text. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionCustomText<'a> { - /// Custom text that should be displayed after the payment confirmation button. - #[serde(skip_serializing_if = "Option::is_none")] - pub after_submit: Option>, +pub struct CreateCheckoutSessionBuilderCustomText<'a> { /// Custom text that should be displayed alongside shipping address collection. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_address: Option>, @@ -844,7 +755,7 @@ pub struct CreateCheckoutSessionCustomText<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub terms_of_service_acceptance: Option>, } -impl<'a> CreateCheckoutSessionCustomText<'a> { +impl<'a> CreateCheckoutSessionBuilderCustomText<'a> { pub fn new() -> Self { Self::default() } @@ -860,13 +771,13 @@ impl<'a> CreateCheckoutSessionCustomText<'a> { /// /// Can only be set in `payment` and `setup` mode. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomerCreation { +pub enum CreateCheckoutSessionBuilderCustomerCreation { Always, IfRequired, } -impl CreateCheckoutSessionCustomerCreation { +impl CreateCheckoutSessionBuilderCustomerCreation { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomerCreation::*; + use CreateCheckoutSessionBuilderCustomerCreation::*; match self { Always => "always", IfRequired => "if_required", @@ -874,10 +785,10 @@ impl CreateCheckoutSessionCustomerCreation { } } -impl std::str::FromStr for CreateCheckoutSessionCustomerCreation { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomerCreation { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomerCreation::*; + use CreateCheckoutSessionBuilderCustomerCreation::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -885,18 +796,18 @@ impl std::str::FromStr for CreateCheckoutSessionCustomerCreation { } } } -impl std::fmt::Display for CreateCheckoutSessionCustomerCreation { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomerCreation { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomerCreation { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomerCreation { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -907,20 +818,20 @@ impl serde::Serialize for CreateCheckoutSessionCustomerCreation { /// Controls what fields on Customer can be updated by the Checkout Session. /// Can only be provided when `customer` is provided. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionCustomerUpdate { +pub struct CreateCheckoutSessionBuilderCustomerUpdate { /// Describes whether Checkout saves the billing address onto `customer.address`. /// To always collect a full billing address, use `billing_address_collection`. Defaults to `never`. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option, + pub address: Option, /// Describes whether Checkout saves the name onto `customer.name`. Defaults to `never`. #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, + pub name: Option, /// Describes whether Checkout saves shipping information onto `customer.shipping`. /// To collect shipping information, use `shipping_address_collection`. Defaults to `never`. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option, + pub shipping: Option, } -impl CreateCheckoutSessionCustomerUpdate { +impl CreateCheckoutSessionBuilderCustomerUpdate { pub fn new() -> Self { Self::default() } @@ -928,13 +839,13 @@ impl CreateCheckoutSessionCustomerUpdate { /// Describes whether Checkout saves the billing address onto `customer.address`. /// To always collect a full billing address, use `billing_address_collection`. Defaults to `never`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomerUpdateAddress { +pub enum CreateCheckoutSessionBuilderCustomerUpdateAddress { Auto, Never, } -impl CreateCheckoutSessionCustomerUpdateAddress { +impl CreateCheckoutSessionBuilderCustomerUpdateAddress { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomerUpdateAddress::*; + use CreateCheckoutSessionBuilderCustomerUpdateAddress::*; match self { Auto => "auto", Never => "never", @@ -942,10 +853,10 @@ impl CreateCheckoutSessionCustomerUpdateAddress { } } -impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateAddress { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomerUpdateAddress { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomerUpdateAddress::*; + use CreateCheckoutSessionBuilderCustomerUpdateAddress::*; match s { "auto" => Ok(Auto), "never" => Ok(Never), @@ -953,18 +864,18 @@ impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateAddress { } } } -impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateAddress { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomerUpdateAddress { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomerUpdateAddress { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomerUpdateAddress { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomerUpdateAddress { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomerUpdateAddress { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -974,13 +885,13 @@ impl serde::Serialize for CreateCheckoutSessionCustomerUpdateAddress { } /// Describes whether Checkout saves the name onto `customer.name`. Defaults to `never`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomerUpdateName { +pub enum CreateCheckoutSessionBuilderCustomerUpdateName { Auto, Never, } -impl CreateCheckoutSessionCustomerUpdateName { +impl CreateCheckoutSessionBuilderCustomerUpdateName { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomerUpdateName::*; + use CreateCheckoutSessionBuilderCustomerUpdateName::*; match self { Auto => "auto", Never => "never", @@ -988,10 +899,10 @@ impl CreateCheckoutSessionCustomerUpdateName { } } -impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateName { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomerUpdateName { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomerUpdateName::*; + use CreateCheckoutSessionBuilderCustomerUpdateName::*; match s { "auto" => Ok(Auto), "never" => Ok(Never), @@ -999,18 +910,18 @@ impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateName { } } } -impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateName { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomerUpdateName { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomerUpdateName { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomerUpdateName { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomerUpdateName { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomerUpdateName { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1021,13 +932,13 @@ impl serde::Serialize for CreateCheckoutSessionCustomerUpdateName { /// Describes whether Checkout saves shipping information onto `customer.shipping`. /// To collect shipping information, use `shipping_address_collection`. Defaults to `never`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionCustomerUpdateShipping { +pub enum CreateCheckoutSessionBuilderCustomerUpdateShipping { Auto, Never, } -impl CreateCheckoutSessionCustomerUpdateShipping { +impl CreateCheckoutSessionBuilderCustomerUpdateShipping { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionCustomerUpdateShipping::*; + use CreateCheckoutSessionBuilderCustomerUpdateShipping::*; match self { Auto => "auto", Never => "never", @@ -1035,10 +946,10 @@ impl CreateCheckoutSessionCustomerUpdateShipping { } } -impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateShipping { +impl std::str::FromStr for CreateCheckoutSessionBuilderCustomerUpdateShipping { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionCustomerUpdateShipping::*; + use CreateCheckoutSessionBuilderCustomerUpdateShipping::*; match s { "auto" => Ok(Auto), "never" => Ok(Never), @@ -1046,18 +957,18 @@ impl std::str::FromStr for CreateCheckoutSessionCustomerUpdateShipping { } } } -impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateShipping { +impl std::fmt::Display for CreateCheckoutSessionBuilderCustomerUpdateShipping { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionCustomerUpdateShipping { +impl std::fmt::Debug for CreateCheckoutSessionBuilderCustomerUpdateShipping { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionCustomerUpdateShipping { +impl serde::Serialize for CreateCheckoutSessionBuilderCustomerUpdateShipping { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1067,7 +978,7 @@ impl serde::Serialize for CreateCheckoutSessionCustomerUpdateShipping { } /// The coupon or promotion code to apply to this Session. Currently, only up to one may be specified. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionDiscounts<'a> { +pub struct CreateCheckoutSessionBuilderDiscounts<'a> { /// The ID of the coupon to apply to this Session. #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, @@ -1075,45 +986,41 @@ pub struct CreateCheckoutSessionDiscounts<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub promotion_code: Option<&'a str>, } -impl<'a> CreateCheckoutSessionDiscounts<'a> { +impl<'a> CreateCheckoutSessionBuilderDiscounts<'a> { pub fn new() -> Self { Self::default() } } /// Generate a post-purchase Invoice for one-time payments. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionInvoiceCreation<'a> { +pub struct CreateCheckoutSessionBuilderInvoiceCreation<'a> { /// Set to `true` to enable invoice creation. pub enabled: bool, /// Parameters passed when creating invoices for payment-mode Checkout Sessions. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_data: Option>, + pub invoice_data: Option>, } -impl<'a> CreateCheckoutSessionInvoiceCreation<'a> { +impl<'a> CreateCheckoutSessionBuilderInvoiceCreation<'a> { pub fn new(enabled: bool) -> Self { Self { enabled, invoice_data: None } } } /// Parameters passed when creating invoices for payment-mode Checkout Sessions. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionInvoiceCreationInvoiceData<'a> { +pub struct CreateCheckoutSessionBuilderInvoiceCreationInvoiceData<'a> { /// The account tax IDs associated with the invoice. #[serde(skip_serializing_if = "Option::is_none")] pub account_tax_ids: Option<&'a [&'a str]>, /// Default custom fields to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: - Option<&'a [CreateCheckoutSessionInvoiceCreationInvoiceDataCustomFields<'a>]>, + Option<&'a [CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataCustomFields<'a>]>, /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, /// Default footer to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<&'a str>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -1122,100 +1029,40 @@ pub struct CreateCheckoutSessionInvoiceCreationInvoiceData<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Default options for invoice PDF rendering for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, + pub rendering_options: + Option, } -impl<'a> CreateCheckoutSessionInvoiceCreationInvoiceData<'a> { +impl<'a> CreateCheckoutSessionBuilderInvoiceCreationInvoiceData<'a> { pub fn new() -> Self { Self::default() } } /// Default custom fields to be displayed on invoices for this customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionInvoiceCreationInvoiceDataCustomFields<'a> { +pub struct CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataCustomFields<'a> { /// The name of the custom field. This may be up to 30 characters. pub name: &'a str, /// The value of the custom field. This may be up to 30 characters. pub value: &'a str, } -impl<'a> CreateCheckoutSessionInvoiceCreationInvoiceDataCustomFields<'a> { +impl<'a> CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataCustomFields<'a> { pub fn new(name: &'a str, value: &'a str) -> Self { Self { name, value } } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionInvoiceCreationInvoiceDataIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType, -} -impl<'a> CreateCheckoutSessionInvoiceCreationInvoiceDataIssuer<'a> { - pub fn new(type_: CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - Account, - Self_, -} -impl CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionInvoiceCreationInvoiceDataIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptions { +pub struct CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptions { /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. /// One of `exclude_tax` or `include_inclusive_tax`. /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: - Option, + pub amount_tax_display: Option< + CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay, + >, } -impl CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptions { +impl CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptions { pub fn new() -> Self { Self::default() } @@ -1225,13 +1072,13 @@ impl CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptions { /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +pub enum CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { ExcludeTax, IncludeInclusiveTax, } -impl CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +impl CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match self { ExcludeTax => "exclude_tax", IncludeInclusiveTax => "include_inclusive_tax", @@ -1240,11 +1087,11 @@ impl CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDis } impl std::str::FromStr - for CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match s { "exclude_tax" => Ok(ExcludeTax), "include_inclusive_tax" => Ok(IncludeInclusiveTax), @@ -1253,7 +1100,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1261,14 +1108,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreateCheckoutSessionBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where @@ -1285,10 +1132,10 @@ impl serde::Serialize /// For `subscription` mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. /// Line items with one-time Prices will be on the initial invoice only. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionLineItems<'a> { +pub struct CreateCheckoutSessionBuilderLineItems<'a> { /// When set, provides configuration for this item’s quantity to be adjusted by the customer during Checkout. #[serde(skip_serializing_if = "Option::is_none")] - pub adjustable_quantity: Option, + pub adjustable_quantity: Option, /// The [tax rates](https://stripe.com/docs/api/tax_rates) that will be applied to this line item depending on the customer's billing/shipping address. /// We currently support the following countries: US, GB, AU, and all countries in the EU. #[serde(skip_serializing_if = "Option::is_none")] @@ -1300,7 +1147,7 @@ pub struct CreateCheckoutSessionLineItems<'a> { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub price_data: Option>, + pub price_data: Option>, /// The quantity of the line item being purchased. /// Quantity should not be defined when `recurring.usage_type=metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -1309,14 +1156,14 @@ pub struct CreateCheckoutSessionLineItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_rates: Option<&'a [&'a str]>, } -impl<'a> CreateCheckoutSessionLineItems<'a> { +impl<'a> CreateCheckoutSessionBuilderLineItems<'a> { pub fn new() -> Self { Self::default() } } /// When set, provides configuration for this item’s quantity to be adjusted by the customer during Checkout. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionLineItemsAdjustableQuantity { +pub struct CreateCheckoutSessionBuilderLineItemsAdjustableQuantity { /// Set to true if the quantity can be adjusted to any non-negative integer. /// By default customers will be able to remove the line item by setting the quantity to 0. pub enabled: bool, @@ -1330,7 +1177,7 @@ pub struct CreateCheckoutSessionLineItemsAdjustableQuantity { #[serde(skip_serializing_if = "Option::is_none")] pub minimum: Option, } -impl CreateCheckoutSessionLineItemsAdjustableQuantity { +impl CreateCheckoutSessionBuilderLineItemsAdjustableQuantity { pub fn new(enabled: bool) -> Self { Self { enabled, maximum: None, minimum: None } } @@ -1338,7 +1185,7 @@ impl CreateCheckoutSessionLineItemsAdjustableQuantity { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. /// One of `price` or `price_data` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionLineItemsPriceData<'a> { +pub struct CreateCheckoutSessionBuilderLineItemsPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -1348,16 +1195,16 @@ pub struct CreateCheckoutSessionLineItemsPriceData<'a> { pub product: Option<&'a str>, /// Data used to generate a new product object inline. One of `product` or `product_data` is required. #[serde(skip_serializing_if = "Option::is_none")] - pub product_data: Option>, + pub product_data: Option>, /// The recurring components of a price such as `interval` and `interval_count`. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A non-negative integer in cents (or local equivalent) representing how much to charge. /// One of `unit_amount` or `unit_amount_decimal` is required. #[serde(skip_serializing_if = "Option::is_none")] @@ -1367,7 +1214,7 @@ pub struct CreateCheckoutSessionLineItemsPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateCheckoutSessionLineItemsPriceData<'a> { +impl<'a> CreateCheckoutSessionBuilderLineItemsPriceData<'a> { pub fn new(currency: stripe_types::Currency) -> Self { Self { currency, @@ -1382,7 +1229,7 @@ impl<'a> CreateCheckoutSessionLineItemsPriceData<'a> { } /// Data used to generate a new product object inline. One of `product` or `product_data` is required. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionLineItemsPriceDataProductData<'a> { +pub struct CreateCheckoutSessionBuilderLineItemsPriceDataProductData<'a> { /// The product's description, meant to be displayable to the customer. /// Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. #[serde(skip_serializing_if = "Option::is_none")] @@ -1402,38 +1249,38 @@ pub struct CreateCheckoutSessionLineItemsPriceDataProductData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, } -impl<'a> CreateCheckoutSessionLineItemsPriceDataProductData<'a> { +impl<'a> CreateCheckoutSessionBuilderLineItemsPriceDataProductData<'a> { pub fn new(name: &'a str) -> Self { Self { description: None, images: None, metadata: None, name, tax_code: None } } } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionLineItemsPriceDataRecurring { +pub struct CreateCheckoutSessionBuilderLineItemsPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateCheckoutSessionLineItemsPriceDataRecurringInterval, + pub interval: CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateCheckoutSessionLineItemsPriceDataRecurring { - pub fn new(interval: CreateCheckoutSessionLineItemsPriceDataRecurringInterval) -> Self { +impl CreateCheckoutSessionBuilderLineItemsPriceDataRecurring { + pub fn new(interval: CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +pub enum CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +impl CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionLineItemsPriceDataRecurringInterval::*; + use CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -1443,10 +1290,10 @@ impl CreateCheckoutSessionLineItemsPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +impl std::str::FromStr for CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionLineItemsPriceDataRecurringInterval::*; + use CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -1456,18 +1303,18 @@ impl std::str::FromStr for CreateCheckoutSessionLineItemsPriceDataRecurringInter } } } -impl std::fmt::Display for CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +impl std::fmt::Display for CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +impl std::fmt::Debug for CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionLineItemsPriceDataRecurringInterval { +impl serde::Serialize for CreateCheckoutSessionBuilderLineItemsPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1480,14 +1327,14 @@ impl serde::Serialize for CreateCheckoutSessionLineItemsPriceDataRecurringInterv /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +pub enum CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +impl CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionLineItemsPriceDataTaxBehavior::*; + use CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -1496,10 +1343,10 @@ impl CreateCheckoutSessionLineItemsPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +impl std::str::FromStr for CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionLineItemsPriceDataTaxBehavior::*; + use CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -1508,18 +1355,18 @@ impl std::str::FromStr for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +impl std::fmt::Display for CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +impl std::fmt::Debug for CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { +impl serde::Serialize for CreateCheckoutSessionBuilderLineItemsPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1529,7 +1376,7 @@ impl serde::Serialize for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { } /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentIntentData<'a> { +pub struct CreateCheckoutSessionBuilderPaymentIntentData<'a> { /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. /// The amount of the application fee collected will be capped at the total payment amount. /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). @@ -1537,7 +1384,7 @@ pub struct CreateCheckoutSessionPaymentIntentData<'a> { pub application_fee_amount: Option, /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -1577,10 +1424,10 @@ pub struct CreateCheckoutSessionPaymentIntentData<'a> { /// to dynamically optimize your payment flow and comply with regional /// legislation and network rules, such as SCA. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: Option, /// Shipping information for this payment. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// Extra information about the payment. This will appear on your /// customer's statement when this payment succeeds in creating a charge. #[serde(skip_serializing_if = "Option::is_none")] @@ -1593,27 +1440,27 @@ pub struct CreateCheckoutSessionPaymentIntentData<'a> { /// The parameters used to automatically create a Transfer when the payment succeeds. /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// A string that identifies the resulting payment as part of a group. /// See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> CreateCheckoutSessionPaymentIntentData<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentIntentData<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentIntentDataCaptureMethod { +pub enum CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { Automatic, AutomaticAsync, Manual, } -impl CreateCheckoutSessionPaymentIntentDataCaptureMethod { +impl CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentIntentDataCaptureMethod::*; + use CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod::*; match self { Automatic => "automatic", AutomaticAsync => "automatic_async", @@ -1622,10 +1469,10 @@ impl CreateCheckoutSessionPaymentIntentDataCaptureMethod { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentIntentDataCaptureMethod { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentIntentDataCaptureMethod::*; + use CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod::*; match s { "automatic" => Ok(Automatic), "automatic_async" => Ok(AutomaticAsync), @@ -1634,18 +1481,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentIntentDataCaptureMethod { } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentIntentDataCaptureMethod { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentIntentDataCaptureMethod { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentIntentDataCaptureMethod { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentIntentDataCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1674,13 +1521,13 @@ impl serde::Serialize for CreateCheckoutSessionPaymentIntentDataCaptureMethod { /// to dynamically optimize your payment flow and comply with regional /// legislation and network rules, such as SCA. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { OffSession, OnSession, } -impl CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentIntentDataSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage::*; match self { OffSession => "off_session", OnSession => "on_session", @@ -1688,10 +1535,10 @@ impl CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentIntentDataSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage::*; match s { "off_session" => Ok(OffSession), "on_session" => Ok(OnSession), @@ -1699,18 +1546,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentIntentDataSetupFutureUsag } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentIntentDataSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentIntentDataSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1720,9 +1567,9 @@ impl serde::Serialize for CreateCheckoutSessionPaymentIntentDataSetupFutureUsage } /// Shipping information for this payment. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentIntentDataShipping<'a> { +pub struct CreateCheckoutSessionBuilderPaymentIntentDataShipping<'a> { /// Shipping address. - pub address: CreateCheckoutSessionPaymentIntentDataShippingAddress<'a>, + pub address: CreateCheckoutSessionBuilderPaymentIntentDataShippingAddress<'a>, /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. #[serde(skip_serializing_if = "Option::is_none")] pub carrier: Option<&'a str>, @@ -1736,9 +1583,9 @@ pub struct CreateCheckoutSessionPaymentIntentDataShipping<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tracking_number: Option<&'a str>, } -impl<'a> CreateCheckoutSessionPaymentIntentDataShipping<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentIntentDataShipping<'a> { pub fn new( - address: CreateCheckoutSessionPaymentIntentDataShippingAddress<'a>, + address: CreateCheckoutSessionBuilderPaymentIntentDataShippingAddress<'a>, name: &'a str, ) -> Self { Self { address, carrier: None, name, phone: None, tracking_number: None } @@ -1746,7 +1593,7 @@ impl<'a> CreateCheckoutSessionPaymentIntentDataShipping<'a> { } /// Shipping address. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentIntentDataShippingAddress<'a> { +pub struct CreateCheckoutSessionBuilderPaymentIntentDataShippingAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1765,7 +1612,7 @@ pub struct CreateCheckoutSessionPaymentIntentDataShippingAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateCheckoutSessionPaymentIntentDataShippingAddress<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentIntentDataShippingAddress<'a> { pub fn new(line1: &'a str) -> Self { Self { city: None, country: None, line1, line2: None, postal_code: None, state: None } } @@ -1773,7 +1620,7 @@ impl<'a> CreateCheckoutSessionPaymentIntentDataShippingAddress<'a> { /// The parameters used to automatically create a Transfer when the payment succeeds. /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentIntentDataTransferData<'a> { +pub struct CreateCheckoutSessionBuilderPaymentIntentDataTransferData<'a> { /// The amount that will be transferred automatically when a charge succeeds. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -1783,7 +1630,7 @@ pub struct CreateCheckoutSessionPaymentIntentDataTransferData<'a> { /// returned on the successful charge's `transfer` field. pub destination: &'a str, } -impl<'a> CreateCheckoutSessionPaymentIntentDataTransferData<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentIntentDataTransferData<'a> { pub fn new(destination: &'a str) -> Self { Self { amount: None, destination } } @@ -1796,13 +1643,13 @@ impl<'a> CreateCheckoutSessionPaymentIntentDataTransferData<'a> { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on configuring [subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodCollection { +pub enum CreateCheckoutSessionBuilderPaymentMethodCollection { Always, IfRequired, } -impl CreateCheckoutSessionPaymentMethodCollection { +impl CreateCheckoutSessionBuilderPaymentMethodCollection { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodCollection::*; + use CreateCheckoutSessionBuilderPaymentMethodCollection::*; match self { Always => "always", IfRequired => "if_required", @@ -1810,10 +1657,10 @@ impl CreateCheckoutSessionPaymentMethodCollection { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodCollection { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodCollection { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodCollection::*; + use CreateCheckoutSessionBuilderPaymentMethodCollection::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -1821,18 +1668,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodCollection { } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodCollection { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodCollection { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodCollection { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1842,115 +1689,113 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodCollection { } /// Payment-method-specific configuration. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptions<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptions<'a> { /// contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// contains details about the Affirm payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option, + pub affirm: Option, /// contains details about the Afterpay Clearpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option, + pub afterpay_clearpay: Option, /// contains details about the Alipay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// contains details about the AU Becs Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// contains details about the Bacs Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// contains details about the Bancontact payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// contains details about the Card payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// contains details about the Cashapp Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, + pub cashapp: Option, /// contains details about the Customer Balance payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option>, + pub customer_balance: + Option>, /// contains details about the EPS payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// contains details about the FPX payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// contains details about the Giropay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// contains details about the Grabpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// contains details about the Ideal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// contains details about the Klarna payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// contains details about the Konbini payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option, + pub konbini: Option, /// contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option, + pub link: Option, /// contains details about the OXXO payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// contains details about the P24 payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// contains details about the PayNow payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// contains details about the Pix payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub pix: Option, + pub pix: Option, /// contains details about the RevolutPay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub revolut_pay: Option, /// contains details about the Sepa Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option, + pub sepa_debit: Option, /// contains details about the Sofort payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// contains details about the Swish payment method options. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option>, + pub sofort: Option, /// contains details about the Us Bank Account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// contains details about the WeChat Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option>, + pub wechat_pay: Option>, } -impl<'a> CreateCheckoutSessionPaymentMethodOptions<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebit<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). /// This is only accepted for Checkout Sessions in `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, + pub currency: Option, /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option>, + Option>, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -1959,13 +1804,13 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebit<'a> { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsAcssDebit<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } @@ -1974,13 +1819,13 @@ impl<'a> CreateCheckoutSessionPaymentMethodOptionsAcssDebit<'a> { /// Must be a [supported currency](https://stripe.com/docs/currencies). /// This is only accepted for Checkout Sessions in `setup` mode. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { Cad, Usd, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency::*; match self { Cad => "cad", Usd => "usd", @@ -1988,10 +1833,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency::*; match s { "cad" => Ok(Cad), "usd" => Ok(Usd), @@ -1999,18 +1844,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCur } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurrency { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitCurrency { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2020,7 +1865,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitCurr } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -2029,22 +1874,25 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptions<'a> /// List of Stripe products where this mandate can be selected automatically. /// Only usable in `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub default_for: - Option<&'a [CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, + pub default_for: Option< + &'a [CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor], + >, /// Description of the mandate interval. /// Only required if 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] pub interval_description: Option<&'a str>, /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_schedule: - Option, + pub payment_schedule: Option< + CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule, + >, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: - Option, + pub transaction_type: Option< + CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, + >, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } @@ -2052,13 +1900,13 @@ impl<'a> CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// List of Stripe products where this mandate can be selected automatically. /// Only usable in `setup` mode. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { Invoice, Subscription, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match self { Invoice => "invoice", Subscription => "subscription", @@ -2067,11 +1915,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match s { "invoice" => Ok(Invoice), "subscription" => Ok(Subscription), @@ -2080,7 +1928,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2088,14 +1936,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { fn serialize(&self, serializer: S) -> Result where @@ -2106,14 +1954,14 @@ impl serde::Serialize } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -2123,11 +1971,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSche } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -2137,7 +1985,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2145,14 +1993,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -2163,13 +2011,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -2178,11 +2026,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransaction } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -2191,7 +2039,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2199,14 +2047,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -2222,14 +2070,14 @@ impl serde::Serialize /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2238,10 +2086,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2250,18 +2100,22 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSet } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2271,14 +2125,14 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitSetu } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -2287,10 +2141,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -2299,18 +2155,24 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVer } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2320,7 +2182,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVeri } /// contains details about the Affirm payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAffirm { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAffirm { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2328,9 +2190,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAffirm { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsAffirm { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAffirm { pub fn new() -> Self { Self::default() } @@ -2342,40 +2205,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsAffirm { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2385,7 +2248,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAffirmSetupFu } /// contains details about the Afterpay Clearpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpay { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2394,9 +2257,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpay { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpay { pub fn new() -> Self { Self::default() } @@ -2408,12 +2271,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match self { None => "none", } @@ -2421,11 +2284,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage + for CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), @@ -2433,20 +2296,22 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage + for CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsAfterpayClearpaySetupFutureUsage + for CreateCheckoutSessionBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where @@ -2457,7 +2322,7 @@ impl serde::Serialize } /// contains details about the Alipay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAlipay { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAlipay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2465,9 +2330,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAlipay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsAlipay { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAlipay { pub fn new() -> Self { Self::default() } @@ -2479,40 +2345,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsAlipay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2522,7 +2388,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAlipaySetupFu } /// contains details about the AU Becs Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsAuBecsDebit { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2531,9 +2397,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAuBecsDebit { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsAuBecsDebit { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebit { pub fn new() -> Self { Self::default() } @@ -2545,40 +2411,48 @@ impl CreateCheckoutSessionPaymentMethodOptionsAuBecsDebit { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2588,7 +2462,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsAuBecsDebitSe } /// contains details about the Bacs Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsBacsDebit { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2597,9 +2471,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsBacsDebit { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsBacsDebit { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebit { pub fn new() -> Self { Self::default() } @@ -2611,14 +2485,14 @@ impl CreateCheckoutSessionPaymentMethodOptionsBacsDebit { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2627,10 +2501,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2639,18 +2515,22 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSet } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2660,7 +2540,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBacsDebitSetu } /// contains details about the Bancontact payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsBancontact { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsBancontact { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2669,9 +2549,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsBancontact { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsBancontact { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } @@ -2683,40 +2563,48 @@ impl CreateCheckoutSessionPaymentMethodOptionsBancontact { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBancontactSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2726,7 +2614,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBancontactSet } /// contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsBoleto { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsBoleto { /// The number of calendar days before a Boleto voucher expires. /// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time. #[serde(skip_serializing_if = "Option::is_none")] @@ -2738,9 +2626,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsBoleto { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsBoleto { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBoleto { pub fn new() -> Self { Self::default() } @@ -2752,14 +2641,14 @@ impl CreateCheckoutSessionPaymentMethodOptionsBoleto { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2768,10 +2657,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2780,18 +2669,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupF } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2801,10 +2690,10 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsBoletoSetupFu } /// contains details about the Card payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCard<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCard<'a> { /// Installment options for card payments #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, + pub installments: Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2812,7 +2701,8 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsCard<'a> { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Provides information about a card payment that customers see on their statements. /// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor. /// Maximum 22 characters. @@ -2826,20 +2716,20 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsCard<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix_kanji: Option<&'a str>, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsCard<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Installment options for card payments #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCardInstallments { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCardInstallments { /// Setting to true enables installments for this Checkout Session. /// Setting to false will prevent any installment plan from applying to a payment. #[serde(skip_serializing_if = "Option::is_none")] pub enabled: Option, } -impl CreateCheckoutSessionPaymentMethodOptionsCardInstallments { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } @@ -2851,13 +2741,13 @@ impl CreateCheckoutSessionPaymentMethodOptionsCardInstallments { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match self { OffSession => "off_session", OnSession => "on_session", @@ -2865,10 +2755,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match s { "off_session" => Ok(OffSession), "on_session" => Ok(OnSession), @@ -2876,18 +2766,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsCardSetupFut } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCardSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsCardSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2897,7 +2787,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCardSetupFutu } /// contains details about the Cashapp Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCashapp { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCashapp { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2906,9 +2796,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsCashapp { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsCashapp { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCashapp { pub fn new() -> Self { Self::default() } @@ -2920,14 +2810,14 @@ impl CreateCheckoutSessionPaymentMethodOptionsCashapp { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2936,10 +2826,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2948,18 +2838,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsCashappSetup } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCashappSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2969,15 +2859,16 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCashappSetupF } /// contains details about the Customer Balance payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCustomerBalance<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalance<'a> { /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] pub bank_transfer: - Option>, + Option>, /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option, + pub funding_type: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2986,45 +2877,49 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsCustomerBalance<'a> { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsCustomerBalance<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalance<'a> { pub fn new() -> Self { Self::default() } } /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, +pub eu_bank_transfer: Option>, /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[serde(skip_serializing_if = "Option::is_none")] -pub requested_address_types: Option<&'a [CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, +pub requested_address_types: Option<&'a [CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, /// The list of bank transfer types that this PaymentIntent is allowed to use for funding. #[serde(rename = "type")] -pub type_: CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType, +pub type_: CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { pub fn new( - type_: CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType, + type_: CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, ) -> Self { Self { eu_bank_transfer: None, requested_address_types: None, type_ } } } /// Configuration for eu_bank_transfer funding type. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< + 'a, +> { /// The desired country code of the bank account information. /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. pub country: &'a str, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { +impl<'a> + CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> +{ pub fn new(country: &'a str) -> Self { Self { country } } @@ -3034,7 +2929,8 @@ impl<'a> CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEuB /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ Aba, Iban, Sepa, @@ -3043,9 +2939,11 @@ pub enum CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferReq Swift, Zengin, } -impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +impl + CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match self { Aba => "aba", Iban => "iban", @@ -3058,61 +2956,51 @@ impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequest } } -impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match s { - "aba" => Ok(Aba), - "iban" => Ok(Iban), - "sepa" => Ok(Sepa), - "sort_code" => Ok(SortCode), - "spei" => Ok(Spei), - "swift" => Ok(Swift), - "zengin" => Ok(Zengin), - _ => Err(()), + "aba" => Ok(Aba), +"iban" => Ok(Iban), +"sepa" => Ok(Sepa), +"sort_code" => Ok(SortCode), +"spei" => Ok(Spei), +"swift" => Ok(Swift), +"zengin" => Ok(Zengin), +_ => Err(()) + } } } -impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// The list of bank transfer types that this PaymentIntent is allowed to use for funding. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { EuBankTransfer, GbBankTransfer, JpBankTransfer, MxBankTransfer, UsBankTransfer, } -impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match self { EuBankTransfer => "eu_bank_transfer", GbBankTransfer => "gb_bank_transfer", @@ -3124,11 +3012,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType { } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match s { "eu_bank_transfer" => Ok(EuBankTransfer), "gb_bank_transfer" => Ok(GbBankTransfer), @@ -3140,19 +3028,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferType { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3163,40 +3055,48 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalan /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType { BankTransfer, } -impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match self { BankTransfer => "bank_transfer", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match s { "bank_transfer" => Ok(BankTransfer), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceFundingType { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3211,12 +3111,12 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalan /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match self { None => "none", } @@ -3224,11 +3124,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage { } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), @@ -3236,19 +3136,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3258,7 +3162,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsCustomerBalan } /// contains details about the EPS payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsEps { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsEps { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3266,9 +3170,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsEps { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsEps { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsEps { pub fn new() -> Self { Self::default() } @@ -3280,40 +3185,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsEps { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3323,7 +3228,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsEpsSetupFutur } /// contains details about the FPX payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsFpx { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsFpx { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3331,9 +3236,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsFpx { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsFpx { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsFpx { pub fn new() -> Self { Self::default() } @@ -3345,40 +3251,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsFpx { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3388,7 +3294,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsFpxSetupFutur } /// contains details about the Giropay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsGiropay { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsGiropay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3397,9 +3303,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsGiropay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsGiropay { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsGiropay { pub fn new() -> Self { Self::default() } @@ -3411,40 +3317,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsGiropay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsGiropaySetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3454,7 +3360,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsGiropaySetupF } /// contains details about the Grabpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsGrabpay { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3463,9 +3369,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsGrabpay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsGrabpay { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpay { pub fn new() -> Self { Self::default() } @@ -3477,40 +3383,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsGrabpay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3520,7 +3426,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsGrabpaySetupF } /// contains details about the Ideal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsIdeal { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsIdeal { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3528,9 +3434,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsIdeal { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsIdeal { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsIdeal { pub fn new() -> Self { Self::default() } @@ -3542,40 +3449,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsIdeal { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsIdealSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3585,7 +3492,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsIdealSetupFut } /// contains details about the Klarna payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsKlarna { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsKlarna { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3593,9 +3500,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsKlarna { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsKlarna { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsKlarna { pub fn new() -> Self { Self::default() } @@ -3607,40 +3515,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsKlarna { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3650,7 +3558,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsKlarnaSetupFu } /// contains details about the Konbini payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsKonbini { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsKonbini { /// The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire. /// For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST. /// Defaults to 3 days. @@ -3664,9 +3572,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsKonbini { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsKonbini { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsKonbini { pub fn new() -> Self { Self::default() } @@ -3678,40 +3586,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsKonbini { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3721,7 +3629,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsKonbiniSetupF } /// contains details about the Link payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsLink { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsLink { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3729,9 +3637,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsLink { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsLink { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsLink { pub fn new() -> Self { Self::default() } @@ -3743,13 +3652,13 @@ impl CreateCheckoutSessionPaymentMethodOptionsLink { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { None, OffSession, } -impl CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -3757,10 +3666,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -3768,18 +3677,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFut } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3789,7 +3698,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsLinkSetupFutu } /// contains details about the OXXO payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsOxxo { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsOxxo { /// The number of calendar days before an OXXO voucher expires. /// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. #[serde(skip_serializing_if = "Option::is_none")] @@ -3801,9 +3710,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsOxxo { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsOxxo { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsOxxo { pub fn new() -> Self { Self::default() } @@ -3815,40 +3725,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsOxxo { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3858,7 +3768,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsOxxoSetupFutu } /// contains details about the P24 payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsP24 { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsP24 { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3866,12 +3776,13 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsP24 { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Confirm that the payer has accepted the P24 terms and conditions. #[serde(skip_serializing_if = "Option::is_none")] pub tos_shown_and_accepted: Option, } -impl CreateCheckoutSessionPaymentMethodOptionsP24 { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsP24 { pub fn new() -> Self { Self::default() } @@ -3883,40 +3794,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsP24 { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsP24SetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsP24SetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3926,7 +3837,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsP24SetupFutur } /// contains details about the PayNow payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsPaynow { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsPaynow { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -3934,9 +3845,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsPaynow { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsPaynow { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPaynow { pub fn new() -> Self { Self::default() } @@ -3948,40 +3860,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsPaynow { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3991,13 +3903,14 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaynowSetupFu } /// contains details about the PayPal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsPaypal<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsPaypal<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. /// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. #[serde(skip_serializing_if = "Option::is_none")] @@ -4014,49 +3927,50 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsPaypal<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsPaypal<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsPaypal<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { Manual, } -impl CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalCaptureMethod { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4067,7 +3981,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalCapture /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -4092,9 +4006,9 @@ pub enum CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -4122,10 +4036,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -4152,18 +4066,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaypalPrefer } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalPreferredLocale { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4180,13 +4094,13 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalPreferr /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { None, OffSession, } -impl CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4194,10 +4108,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4205,18 +4119,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupF } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4226,20 +4140,20 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsPaypalSetupFu } /// contains details about the Pix payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsPix { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsPix { /// The number of seconds (between 10 and 1209600) after which Pix payment will expire. /// Defaults to 86400 seconds. #[serde(skip_serializing_if = "Option::is_none")] pub expires_after_seconds: Option, } -impl CreateCheckoutSessionPaymentMethodOptionsPix { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsPix { pub fn new() -> Self { Self::default() } } /// contains details about the RevolutPay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsRevolutPay { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4248,9 +4162,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsRevolutPay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsRevolutPay { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPay { pub fn new() -> Self { Self::default() } @@ -4262,13 +4176,13 @@ impl CreateCheckoutSessionPaymentMethodOptionsRevolutPay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { None, OffSession, } -impl CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4276,10 +4190,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4287,18 +4203,24 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySe } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4308,7 +4230,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsRevolutPaySet } /// contains details about the Sepa Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsSepaDebit { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4317,9 +4239,9 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsSepaDebit { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsSepaDebit { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebit { pub fn new() -> Self { Self::default() } @@ -4331,14 +4253,14 @@ impl CreateCheckoutSessionPaymentMethodOptionsSepaDebit { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4347,10 +4269,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4359,18 +4283,22 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSet } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4380,7 +4308,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsSepaDebitSetu } /// contains details about the Sofort payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsSofort { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsSofort { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4388,9 +4316,10 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsSofort { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreateCheckoutSessionPaymentMethodOptionsSofort { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsSofort { pub fn new() -> Self { Self::default() } @@ -4402,40 +4331,40 @@ impl CreateCheckoutSessionPaymentMethodOptionsSofort { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsSofortSetupFutureUsage { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4443,26 +4372,14 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsSofortSetupFu serializer.serialize_str(self.as_str()) } } -/// contains details about the Swish payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsSwish<'a> { - /// The order reference that will be displayed to customers in the Swish application. - /// Defaults to the `id` of the Payment Intent. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option<&'a str>, -} -impl<'a> CreateCheckoutSessionPaymentMethodOptionsSwish<'a> { - pub fn new() -> Self { - Self::default() - } -} /// contains details about the Us Bank Account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsUsBankAccount<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: - Option>, + pub financial_connections: Option< + CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, + >, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4471,31 +4388,31 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsUsBankAccount<'a> { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, +pub permissions: Option<&'a [CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, +pub prefetch: Option<&'a [CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -4504,15 +4421,16 @@ impl<'a> CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnecti /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ Balances, Ownership, PaymentMethod, Transactions, } -impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -4523,11 +4441,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsP } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -4538,7 +4456,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4546,14 +4464,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -4564,35 +4482,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), _ => Err(()), } } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4600,14 +4515,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -4623,14 +4538,14 @@ impl serde::Serialize /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { None, OffSession, OnSession, } -impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4639,10 +4554,12 @@ impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4651,18 +4568,24 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsUsBankAccoun } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4672,13 +4595,13 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsUsBankAccount } /// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, } -impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -4687,11 +4610,11 @@ impl CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod { } impl std::str::FromStr - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -4700,19 +4623,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4722,12 +4649,12 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsUsBankAccount } /// contains details about the WeChat Pay payment method options. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPaymentMethodOptionsWechatPay<'a> { +pub struct CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPay<'a> { /// The app ID registered with WeChat Pay. Only required when client is ios or android. #[serde(skip_serializing_if = "Option::is_none")] pub app_id: Option<&'a str>, /// The client type that the end customer will pay from - pub client: CreateCheckoutSessionPaymentMethodOptionsWechatPayClient, + pub client: CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4736,23 +4663,23 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsWechatPay<'a> { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreateCheckoutSessionPaymentMethodOptionsWechatPay<'a> { - pub fn new(client: CreateCheckoutSessionPaymentMethodOptionsWechatPayClient) -> Self { +impl<'a> CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPay<'a> { + pub fn new(client: CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient) -> Self { Self { app_id: None, client, setup_future_usage: None } } } /// The client type that the end customer will pay from #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { Android, Ios, Web, } -impl CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsWechatPayClient::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient::*; match self { Android => "android", Ios => "ios", @@ -4761,10 +4688,10 @@ impl CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsWechatPayClient::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient::*; match s { "android" => Ok(Android), "ios" => Ok(Ios), @@ -4773,18 +4700,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsWechatPayCli } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPayClient { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4799,40 +4726,46 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsWechatPayClie /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +pub enum CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { None, } -impl CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +impl CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::str::FromStr + for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Display + for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsWechatPaySetupFutureUsage { +impl serde::Serialize + for CreateCheckoutSessionBuilderPaymentMethodOptionsWechatPaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4853,7 +4786,7 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodOptionsWechatPaySetu /// other characteristics. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateCheckoutSessionPaymentMethodTypes { +pub enum CreateCheckoutSessionBuilderPaymentMethodTypes { AcssDebit, Affirm, AfterpayClearpay, @@ -4883,16 +4816,15 @@ pub enum CreateCheckoutSessionPaymentMethodTypes { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateCheckoutSessionPaymentMethodTypes { +impl CreateCheckoutSessionBuilderPaymentMethodTypes { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionPaymentMethodTypes::*; + use CreateCheckoutSessionBuilderPaymentMethodTypes::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -4923,7 +4855,6 @@ impl CreateCheckoutSessionPaymentMethodTypes { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -4932,10 +4863,10 @@ impl CreateCheckoutSessionPaymentMethodTypes { } } -impl std::str::FromStr for CreateCheckoutSessionPaymentMethodTypes { +impl std::str::FromStr for CreateCheckoutSessionBuilderPaymentMethodTypes { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionPaymentMethodTypes::*; + use CreateCheckoutSessionBuilderPaymentMethodTypes::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -4966,7 +4897,6 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodTypes { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -4974,18 +4904,18 @@ impl std::str::FromStr for CreateCheckoutSessionPaymentMethodTypes { } } } -impl std::fmt::Display for CreateCheckoutSessionPaymentMethodTypes { +impl std::fmt::Display for CreateCheckoutSessionBuilderPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionPaymentMethodTypes { +impl std::fmt::Debug for CreateCheckoutSessionBuilderPaymentMethodTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionPaymentMethodTypes { +impl serde::Serialize for CreateCheckoutSessionBuilderPaymentMethodTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4999,18 +4929,18 @@ impl serde::Serialize for CreateCheckoutSessionPaymentMethodTypes { /// before using this feature. /// Learn more about [collecting phone numbers with Checkout](https://stripe.com/docs/payments/checkout/phone-numbers). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionPhoneNumberCollection { +pub struct CreateCheckoutSessionBuilderPhoneNumberCollection { /// Set to `true` to enable phone number collection. pub enabled: bool, } -impl CreateCheckoutSessionPhoneNumberCollection { +impl CreateCheckoutSessionBuilderPhoneNumberCollection { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in `setup` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionSetupIntentData<'a> { +pub struct CreateCheckoutSessionBuilderSetupIntentData<'a> { /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -5024,22 +4954,23 @@ pub struct CreateCheckoutSessionSetupIntentData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, } -impl<'a> CreateCheckoutSessionSetupIntentData<'a> { +impl<'a> CreateCheckoutSessionBuilderSetupIntentData<'a> { pub fn new() -> Self { Self::default() } } /// When set, provides configuration for Checkout to collect a shipping address from a customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingAddressCollection<'a> { +pub struct CreateCheckoutSessionBuilderShippingAddressCollection<'a> { /// An array of two-letter ISO country codes representing which countries Checkout should provide as options for. /// shipping locations. /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. - pub allowed_countries: &'a [CreateCheckoutSessionShippingAddressCollectionAllowedCountries], + pub allowed_countries: + &'a [CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries], } -impl<'a> CreateCheckoutSessionShippingAddressCollection<'a> { +impl<'a> CreateCheckoutSessionBuilderShippingAddressCollection<'a> { pub fn new( - allowed_countries: &'a [CreateCheckoutSessionShippingAddressCollectionAllowedCountries], + allowed_countries: &'a [CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries], ) -> Self { Self { allowed_countries } } @@ -5049,7 +4980,7 @@ impl<'a> CreateCheckoutSessionShippingAddressCollection<'a> { /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +pub enum CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { Ac, Ad, Ae, @@ -5290,9 +5221,9 @@ pub enum CreateCheckoutSessionShippingAddressCollectionAllowedCountries { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +impl CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingAddressCollectionAllowedCountries::*; + use CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries::*; match self { Ac => "AC", Ad => "AD", @@ -5536,10 +5467,10 @@ impl CreateCheckoutSessionShippingAddressCollectionAllowedCountries { } } -impl std::str::FromStr for CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +impl std::str::FromStr for CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingAddressCollectionAllowedCountries::*; + use CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries::*; match s { "AC" => Ok(Ac), "AD" => Ok(Ad), @@ -5782,18 +5713,18 @@ impl std::str::FromStr for CreateCheckoutSessionShippingAddressCollectionAllowed } } } -impl std::fmt::Display for CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +impl std::fmt::Display for CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +impl std::fmt::Debug for CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionShippingAddressCollectionAllowedCountries { +impl serde::Serialize for CreateCheckoutSessionBuilderShippingAddressCollectionAllowedCountries { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5803,33 +5734,34 @@ impl serde::Serialize for CreateCheckoutSessionShippingAddressCollectionAllowedC } /// The shipping rate options to apply to this Session. Up to a maximum of 5. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptions<'a> { +pub struct CreateCheckoutSessionBuilderShippingOptions<'a> { /// The ID of the Shipping Rate to use for this shipping option. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_rate: Option<&'a str>, /// Parameters to be passed to Shipping Rate creation for this shipping option #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate_data: Option>, + pub shipping_rate_data: Option>, } -impl<'a> CreateCheckoutSessionShippingOptions<'a> { +impl<'a> CreateCheckoutSessionBuilderShippingOptions<'a> { pub fn new() -> Self { Self::default() } } /// Parameters to be passed to Shipping Rate creation for this shipping option #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateData<'a> { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateData<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[serde(skip_serializing_if = "Option::is_none")] pub delivery_estimate: - Option, + Option, /// The name of the shipping rate, meant to be displayable to the customer. /// This will appear on CheckoutSessions. pub display_name: &'a str, /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amount: Option>, + pub fixed_amount: + Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -5839,7 +5771,8 @@ pub struct CreateCheckoutSessionShippingOptionsShippingRateData<'a> { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: + Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. /// The Shipping tax code is `txcd_92010001`. #[serde(skip_serializing_if = "Option::is_none")] @@ -5847,9 +5780,9 @@ pub struct CreateCheckoutSessionShippingOptionsShippingRateData<'a> { /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> CreateCheckoutSessionShippingOptionsShippingRateData<'a> { +impl<'a> CreateCheckoutSessionBuilderShippingOptionsShippingRateData<'a> { pub fn new(display_name: &'a str) -> Self { Self { delivery_estimate: None, @@ -5865,32 +5798,33 @@ impl<'a> CreateCheckoutSessionShippingOptionsShippingRateData<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimate { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimate { /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[serde(skip_serializing_if = "Option::is_none")] pub maximum: - Option, + Option, /// The lower bound of the estimated range. If empty, represents no lower bound. #[serde(skip_serializing_if = "Option::is_none")] pub minimum: - Option, + Option, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimate { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimate { pub fn new() -> Self { Self::default() } } /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximum { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximum { /// A unit of time. - pub unit: CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit, + pub unit: + CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit, /// Must be greater than 0. pub value: i64, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximum { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximum { pub fn new( - unit: CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit, + unit: CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit, value: i64, ) -> Self { Self { unit, value } @@ -5898,16 +5832,16 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximum } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { +pub enum CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { BusinessDay, Day, Hour, Month, Week, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -5919,11 +5853,11 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximum } impl std::str::FromStr - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -5935,7 +5869,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -5943,14 +5877,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMaximumUnit { fn serialize(&self, serializer: S) -> Result where @@ -5961,15 +5895,16 @@ impl serde::Serialize } /// The lower bound of the estimated range. If empty, represents no lower bound. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimum { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimum { /// A unit of time. - pub unit: CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit, + pub unit: + CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit, /// Must be greater than 0. pub value: i64, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimum { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimum { pub fn new( - unit: CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit, + unit: CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit, value: i64, ) -> Self { Self { unit, value } @@ -5977,16 +5912,16 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimum } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { +pub enum CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { BusinessDay, Day, Hour, Month, Week, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -5998,11 +5933,11 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimum } impl std::str::FromStr - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -6014,7 +5949,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6022,14 +5957,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit + for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataDeliveryEstimateMinimumUnit { fn serialize(&self, serializer: S) -> Result where @@ -6040,7 +5975,7 @@ impl serde::Serialize } /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmount<'a> { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmount<'a> { /// A non-negative integer in cents representing how much to charge. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -6052,11 +5987,11 @@ pub struct CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmount<'a> { pub currency_options: Option< &'a std::collections::HashMap< stripe_types::Currency, - CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptions, + CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptions, >, >, } -impl<'a> CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmount<'a> { +impl<'a> CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmount<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, currency, currency_options: None } } @@ -6064,17 +5999,16 @@ impl<'a> CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmount<'a> { /// Shipping rates defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptions { +pub struct CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptions { /// A non-negative integer in cents representing how much to charge. - pub amount: i64, - /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. +pub amount: i64, + /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option< - CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub tax_behavior: Option, + } -impl CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptions { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptions { pub fn new(amount: i64) -> Self { Self { amount, tax_behavior: None } } @@ -6082,14 +6016,17 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOpti /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { +pub enum CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ Exclusive, Inclusive, Unspecified, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { +impl + CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior +{ pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -6098,56 +6035,46 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOpti } } -impl std::str::FromStr - for CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::str::FromStr for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::*; match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), + "exclusive" => Ok(Exclusive), +"inclusive" => Ok(Inclusive), +"unspecified" => Ok(Unspecified), +_ => Err(()) + } } } -impl std::fmt::Display - for CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::fmt::Display for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ +impl std::fmt::Debug for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateCheckoutSessionShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataFixedAmountCurrencyOptionsTaxBehavior { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +pub enum CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -6156,10 +6083,10 @@ impl CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { } } -impl std::str::FromStr for CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +impl std::str::FromStr for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -6168,18 +6095,18 @@ impl std::str::FromStr for CreateCheckoutSessionShippingOptionsShippingRateDataT } } } -impl std::fmt::Display for CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +impl std::fmt::Display for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +impl std::fmt::Debug for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionShippingOptionsShippingRateDataTaxBehavior { +impl serde::Serialize for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6189,40 +6116,40 @@ impl serde::Serialize for CreateCheckoutSessionShippingOptionsShippingRateDataTa } /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionShippingOptionsShippingRateDataType { +pub enum CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { FixedAmount, } -impl CreateCheckoutSessionShippingOptionsShippingRateDataType { +impl CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionShippingOptionsShippingRateDataType::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType::*; match self { FixedAmount => "fixed_amount", } } } -impl std::str::FromStr for CreateCheckoutSessionShippingOptionsShippingRateDataType { +impl std::str::FromStr for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionShippingOptionsShippingRateDataType::*; + use CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType::*; match s { "fixed_amount" => Ok(FixedAmount), _ => Err(()), } } } -impl std::fmt::Display for CreateCheckoutSessionShippingOptionsShippingRateDataType { +impl std::fmt::Display for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionShippingOptionsShippingRateDataType { +impl std::fmt::Debug for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionShippingOptionsShippingRateDataType { +impl serde::Serialize for CreateCheckoutSessionBuilderShippingOptionsShippingRateDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6232,7 +6159,7 @@ impl serde::Serialize for CreateCheckoutSessionShippingOptionsShippingRateDataTy } /// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionData<'a> { +pub struct CreateCheckoutSessionBuilderSubscriptionData<'a> { /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. /// To use an application fee percent, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. @@ -6252,9 +6179,6 @@ pub struct CreateCheckoutSessionSubscriptionData<'a> { /// for rendering in the [customer portal](https://stripe.com/docs/customer-management). #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, - /// All invoices will be billed using the specified settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -6267,10 +6191,10 @@ pub struct CreateCheckoutSessionSubscriptionData<'a> { /// Determines how to handle prorations resulting from the `billing_cycle_anchor`. /// If no value is passed, the default is `create_prorations`. #[serde(skip_serializing_if = "Option::is_none")] - pub proration_behavior: Option, + pub proration_behavior: Option, /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// Unix timestamp representing the end of the trial period the customer /// will get before being charged for the first time. Has to be at least /// 48 hours in the future. @@ -6282,98 +6206,23 @@ pub struct CreateCheckoutSessionSubscriptionData<'a> { pub trial_period_days: Option, /// Settings related to subscription trials. #[serde(skip_serializing_if = "Option::is_none")] - pub trial_settings: Option, -} -impl<'a> CreateCheckoutSessionSubscriptionData<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionDataInvoiceSettings<'a> { - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, + pub trial_settings: Option, } -impl<'a> CreateCheckoutSessionSubscriptionDataInvoiceSettings<'a> { +impl<'a> CreateCheckoutSessionBuilderSubscriptionData<'a> { pub fn new() -> Self { Self::default() } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType, -} -impl<'a> CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - Account, - Self_, -} -impl CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionSubscriptionDataInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Determines how to handle prorations resulting from the `billing_cycle_anchor`. /// If no value is passed, the default is `create_prorations`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionSubscriptionDataProrationBehavior { +pub enum CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { CreateProrations, None, } -impl CreateCheckoutSessionSubscriptionDataProrationBehavior { +impl CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionSubscriptionDataProrationBehavior::*; + use CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior::*; match self { CreateProrations => "create_prorations", None => "none", @@ -6381,10 +6230,10 @@ impl CreateCheckoutSessionSubscriptionDataProrationBehavior { } } -impl std::str::FromStr for CreateCheckoutSessionSubscriptionDataProrationBehavior { +impl std::str::FromStr for CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionSubscriptionDataProrationBehavior::*; + use CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior::*; match s { "create_prorations" => Ok(CreateProrations), "none" => Ok(None), @@ -6392,18 +6241,18 @@ impl std::str::FromStr for CreateCheckoutSessionSubscriptionDataProrationBehavio } } } -impl std::fmt::Display for CreateCheckoutSessionSubscriptionDataProrationBehavior { +impl std::fmt::Display for CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCheckoutSessionSubscriptionDataProrationBehavior { +impl std::fmt::Debug for CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCheckoutSessionSubscriptionDataProrationBehavior { +impl serde::Serialize for CreateCheckoutSessionBuilderSubscriptionDataProrationBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6413,7 +6262,7 @@ impl serde::Serialize for CreateCheckoutSessionSubscriptionDataProrationBehavior } /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionDataTransferData<'a> { +pub struct CreateCheckoutSessionBuilderSubscriptionDataTransferData<'a> { /// A non-negative decimal between 0 and 100, with at most two decimal places. /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. /// By default, the entire amount is transferred to the destination. @@ -6422,48 +6271,48 @@ pub struct CreateCheckoutSessionSubscriptionDataTransferData<'a> { /// ID of an existing, connected Stripe account. pub destination: &'a str, } -impl<'a> CreateCheckoutSessionSubscriptionDataTransferData<'a> { +impl<'a> CreateCheckoutSessionBuilderSubscriptionDataTransferData<'a> { pub fn new(destination: &'a str) -> Self { Self { amount_percent: None, destination } } } /// Settings related to subscription trials. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionDataTrialSettings { +pub struct CreateCheckoutSessionBuilderSubscriptionDataTrialSettings { /// Defines how the subscription should behave when the user's free trial ends. - pub end_behavior: CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior, + pub end_behavior: CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehavior, } -impl CreateCheckoutSessionSubscriptionDataTrialSettings { +impl CreateCheckoutSessionBuilderSubscriptionDataTrialSettings { pub fn new( - end_behavior: CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior, + end_behavior: CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehavior, ) -> Self { Self { end_behavior } } } /// Defines how the subscription should behave when the user's free trial ends. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior { +pub struct CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehavior { /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. pub missing_payment_method: - CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, + CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, } -impl CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior { +impl CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehavior { pub fn new( - missing_payment_method: CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, + missing_payment_method: CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, ) -> Self { Self { missing_payment_method } } } /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { +pub enum CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { Cancel, CreateInvoice, Pause, } -impl CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { +impl CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; + use CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; match self { Cancel => "cancel", CreateInvoice => "create_invoice", @@ -6473,11 +6322,11 @@ impl CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPayment } impl std::str::FromStr - for CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod + for CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; + use CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; match s { "cancel" => Ok(Cancel), "create_invoice" => Ok(CreateInvoice), @@ -6487,7 +6336,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod + for CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6495,14 +6344,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod + for CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod + for CreateCheckoutSessionBuilderSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { fn serialize(&self, serializer: S) -> Result where @@ -6513,51 +6362,432 @@ impl serde::Serialize } /// Controls tax ID collection settings for the session. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionTaxIdCollection { +pub struct CreateCheckoutSessionBuilderTaxIdCollection { /// Set to true to enable Tax ID collection. pub enabled: bool, } -impl CreateCheckoutSessionTaxIdCollection { +impl CreateCheckoutSessionBuilderTaxIdCollection { pub fn new(enabled: bool) -> Self { Self { enabled } } } +/// Creates a Session object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCheckoutSession<'a> { + inner: CreateCheckoutSessionBuilder<'a>, +} impl<'a> CreateCheckoutSession<'a> { - /// Creates a Session object. - pub fn send( + pub fn new() -> Self { + Self { inner: CreateCheckoutSessionBuilder::new() } + } + pub fn after_expiration( + mut self, + after_expiration: CreateCheckoutSessionBuilderAfterExpiration, + ) -> Self { + self.inner.after_expiration = Some(after_expiration); + self + } + + pub fn allow_promotion_codes(mut self, allow_promotion_codes: bool) -> Self { + self.inner.allow_promotion_codes = Some(allow_promotion_codes); + self + } + + pub fn automatic_tax( + mut self, + automatic_tax: CreateCheckoutSessionBuilderAutomaticTax, + ) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self + } + + pub fn billing_address_collection( + mut self, + billing_address_collection: stripe_checkout::CheckoutSessionBillingAddressCollection, + ) -> Self { + self.inner.billing_address_collection = Some(billing_address_collection); + self + } + + pub fn cancel_url(mut self, cancel_url: &'a str) -> Self { + self.inner.cancel_url = Some(cancel_url); + self + } + + pub fn client_reference_id(mut self, client_reference_id: &'a str) -> Self { + self.inner.client_reference_id = Some(client_reference_id); + self + } + + pub fn consent_collection( + mut self, + consent_collection: CreateCheckoutSessionBuilderConsentCollection, + ) -> Self { + self.inner.consent_collection = Some(consent_collection); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn custom_fields( + mut self, + custom_fields: &'a [CreateCheckoutSessionBuilderCustomFields<'a>], + ) -> Self { + self.inner.custom_fields = Some(custom_fields); + self + } + + pub fn custom_text(mut self, custom_text: CreateCheckoutSessionBuilderCustomText<'a>) -> Self { + self.inner.custom_text = Some(custom_text); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_creation( + mut self, + customer_creation: CreateCheckoutSessionBuilderCustomerCreation, + ) -> Self { + self.inner.customer_creation = Some(customer_creation); + self + } + + pub fn customer_email(mut self, customer_email: &'a str) -> Self { + self.inner.customer_email = Some(customer_email); + self + } + + pub fn customer_update( + mut self, + customer_update: CreateCheckoutSessionBuilderCustomerUpdate, + ) -> Self { + self.inner.customer_update = Some(customer_update); + self + } + + pub fn discounts(mut self, discounts: &'a [CreateCheckoutSessionBuilderDiscounts<'a>]) -> Self { + self.inner.discounts = Some(discounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn invoice_creation( + mut self, + invoice_creation: CreateCheckoutSessionBuilderInvoiceCreation<'a>, + ) -> Self { + self.inner.invoice_creation = Some(invoice_creation); + self + } + + pub fn line_items( + mut self, + line_items: &'a [CreateCheckoutSessionBuilderLineItems<'a>], + ) -> Self { + self.inner.line_items = Some(line_items); + self + } + + pub fn locale(mut self, locale: stripe_checkout::CheckoutSessionLocale) -> Self { + self.inner.locale = Some(locale); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn mode(mut self, mode: stripe_checkout::CheckoutSessionMode) -> Self { + self.inner.mode = Some(mode); + self + } + + pub fn payment_intent_data( + mut self, + payment_intent_data: CreateCheckoutSessionBuilderPaymentIntentData<'a>, + ) -> Self { + self.inner.payment_intent_data = Some(payment_intent_data); + self + } + + pub fn payment_method_collection( + mut self, + payment_method_collection: CreateCheckoutSessionBuilderPaymentMethodCollection, + ) -> Self { + self.inner.payment_method_collection = Some(payment_method_collection); + self + } + + pub fn payment_method_configuration(mut self, payment_method_configuration: &'a str) -> Self { + self.inner.payment_method_configuration = Some(payment_method_configuration); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: CreateCheckoutSessionBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn payment_method_types( + mut self, + payment_method_types: &'a [CreateCheckoutSessionBuilderPaymentMethodTypes], + ) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn phone_number_collection( + mut self, + phone_number_collection: CreateCheckoutSessionBuilderPhoneNumberCollection, + ) -> Self { + self.inner.phone_number_collection = Some(phone_number_collection); + self + } + + pub fn redirect_on_completion( + mut self, + redirect_on_completion: stripe_checkout::CheckoutSessionRedirectOnCompletion, + ) -> Self { + self.inner.redirect_on_completion = Some(redirect_on_completion); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } + + pub fn setup_intent_data( + mut self, + setup_intent_data: CreateCheckoutSessionBuilderSetupIntentData<'a>, + ) -> Self { + self.inner.setup_intent_data = Some(setup_intent_data); + self + } + + pub fn shipping_address_collection( + mut self, + shipping_address_collection: CreateCheckoutSessionBuilderShippingAddressCollection<'a>, + ) -> Self { + self.inner.shipping_address_collection = Some(shipping_address_collection); + self + } + + pub fn shipping_options( + mut self, + shipping_options: &'a [CreateCheckoutSessionBuilderShippingOptions<'a>], + ) -> Self { + self.inner.shipping_options = Some(shipping_options); + self + } + + pub fn submit_type(mut self, submit_type: stripe_checkout::CheckoutSessionSubmitType) -> Self { + self.inner.submit_type = Some(submit_type); + self + } + + pub fn subscription_data( + mut self, + subscription_data: CreateCheckoutSessionBuilderSubscriptionData<'a>, + ) -> Self { + self.inner.subscription_data = Some(subscription_data); + self + } + + pub fn success_url(mut self, success_url: &'a str) -> Self { + self.inner.success_url = Some(success_url); + self + } + + pub fn tax_id_collection( + mut self, + tax_id_collection: CreateCheckoutSessionBuilderTaxIdCollection, + ) -> Self { + self.inner.tax_id_collection = Some(tax_id_collection); + self + } + + pub fn ui_mode(mut self, ui_mode: stripe_checkout::CheckoutSessionUiMode) -> Self { + self.inner.ui_mode = Some(ui_mode); + self + } +} +impl CreateCheckoutSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/checkout/sessions", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCheckoutSession<'_> { + type Output = stripe_checkout::CheckoutSession; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/checkout/sessions").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ExpireCheckoutSession<'a> { +pub struct ListLineItemsCheckoutSessionBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, } -impl<'a> ExpireCheckoutSession<'a> { +impl<'a> ListLineItemsCheckoutSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// When retrieving a Checkout Session, there is an includable **line_items** property containing the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListLineItemsCheckoutSession<'a> { + inner: ListLineItemsCheckoutSessionBuilder<'a>, + session: &'a stripe_checkout::CheckoutSessionId, +} +impl<'a> ListLineItemsCheckoutSession<'a> { + pub fn new(session: &'a stripe_checkout::CheckoutSessionId) -> Self { + Self { session, inner: ListLineItemsCheckoutSessionBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListLineItemsCheckoutSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListLineItemsCheckoutSession<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new(StripeMethod::Get, format!("/checkout/sessions/{session}/line_items")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ExpireCheckoutSessionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> ExpireCheckoutSessionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// A Session can be expired when it is in one of these statuses: `open` +/// +/// After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ExpireCheckoutSession<'a> { + inner: ExpireCheckoutSessionBuilder<'a>, + session: &'a stripe_checkout::CheckoutSessionId, +} impl<'a> ExpireCheckoutSession<'a> { - /// A Session can be expired when it is in one of these statuses: `open` - /// - /// After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired. - pub fn send( + pub fn new(session: &'a stripe_checkout::CheckoutSessionId) -> Self { + Self { session, inner: ExpireCheckoutSessionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ExpireCheckoutSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - session: &stripe_checkout::CheckoutSessionId, - ) -> stripe::Response { - client.send_form( - &format!("/checkout/sessions/{session}/expire"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for ExpireCheckoutSession<'_> { + type Output = stripe_checkout::CheckoutSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new(StripeMethod::Post, format!("/checkout/sessions/{session}/expire")) + .form(&self.inner) + } +} + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CustomTextPositionParam<'a> { /// Text may be up to 1200 characters in length. diff --git a/generated/stripe_checkout/src/checkout_session/types.rs b/generated/stripe_checkout/src/checkout_session/types.rs index c3a08e6f4..d4538ea53 100644 --- a/generated/stripe_checkout/src/checkout_session/types.rs +++ b/generated/stripe_checkout/src/checkout_session/types.rs @@ -48,7 +48,7 @@ pub struct CheckoutSession { /// Currency conversion details for automatic currency conversion sessions pub currency_conversion: Option, /// Collect additional information from your customer using custom fields. - /// Up to 3 fields are supported. + /// Up to 2 fields are supported. pub custom_fields: Vec, pub custom_text: stripe_checkout::PaymentPagesCheckoutSessionCustomText, /// The ID of the customer for this Session. @@ -135,7 +135,8 @@ pub struct CheckoutSession { pub status: Option, /// Describes the type of transaction being performed by Checkout in order to customize /// relevant text on the page, such as the submit button. `submit_type` can only be - /// specified on Checkout Sessions in `payment` mode. If blank or `auto`, `pay` is used. + /// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions + /// in `subscription` or `setup` mode. pub submit_type: Option, /// The ID of the subscription for Checkout Sessions in `subscription` mode. pub subscription: Option>, diff --git a/generated/stripe_checkout/src/checkout_session_payment_method_options.rs b/generated/stripe_checkout/src/checkout_session_payment_method_options.rs index 60296debe..ca92e35c9 100644 --- a/generated/stripe_checkout/src/checkout_session_payment_method_options.rs +++ b/generated/stripe_checkout/src/checkout_session_payment_method_options.rs @@ -55,7 +55,5 @@ pub struct CheckoutSessionPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: Option, } diff --git a/generated/stripe_checkout/src/checkout_swish_payment_method_options.rs b/generated/stripe_checkout/src/checkout_swish_payment_method_options.rs deleted file mode 100644 index 8e5b54650..000000000 --- a/generated/stripe_checkout/src/checkout_swish_payment_method_options.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct CheckoutSwishPaymentMethodOptions { - /// The order reference that will be displayed to customers in the Swish application. - /// Defaults to the `id` of the Payment Intent. - pub reference: Option, -} diff --git a/generated/stripe_checkout/src/mod.rs b/generated/stripe_checkout/src/mod.rs index 4c6859829..4fb8b07bc 100644 --- a/generated/stripe_checkout/src/mod.rs +++ b/generated/stripe_checkout/src/mod.rs @@ -134,10 +134,6 @@ pub mod checkout_sofort_payment_method_options; #[doc(inline)] pub use checkout_sofort_payment_method_options::*; #[doc(hidden)] -pub mod checkout_swish_payment_method_options; -#[doc(inline)] -pub use checkout_swish_payment_method_options::*; -#[doc(hidden)] pub mod checkout_us_bank_account_payment_method_options; #[doc(inline)] pub use checkout_us_bank_account_payment_method_options::*; @@ -210,10 +206,6 @@ pub mod payment_pages_checkout_session_invoice_settings; #[doc(inline)] pub use payment_pages_checkout_session_invoice_settings::*; #[doc(hidden)] -pub mod payment_pages_checkout_session_payment_method_reuse_agreement; -#[doc(inline)] -pub use payment_pages_checkout_session_payment_method_reuse_agreement::*; -#[doc(hidden)] pub mod payment_pages_checkout_session_phone_number_collection; #[doc(inline)] pub use payment_pages_checkout_session_phone_number_collection::*; diff --git a/generated/stripe_checkout/src/payment_pages_checkout_session_automatic_tax.rs b/generated/stripe_checkout/src/payment_pages_checkout_session_automatic_tax.rs index ca13dfeb7..daf17a133 100644 --- a/generated/stripe_checkout/src/payment_pages_checkout_session_automatic_tax.rs +++ b/generated/stripe_checkout/src/payment_pages_checkout_session_automatic_tax.rs @@ -1,11 +1,7 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct PaymentPagesCheckoutSessionAutomaticTax { /// Indicates whether automatic tax is enabled for the session pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, /// The status of the most recent automated tax calculation for this session. pub status: Option, } diff --git a/generated/stripe_checkout/src/payment_pages_checkout_session_consent_collection.rs b/generated/stripe_checkout/src/payment_pages_checkout_session_consent_collection.rs index 74b3cb0ff..f0ed7b0a1 100644 --- a/generated/stripe_checkout/src/payment_pages_checkout_session_consent_collection.rs +++ b/generated/stripe_checkout/src/payment_pages_checkout_session_consent_collection.rs @@ -1,8 +1,5 @@ #[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentPagesCheckoutSessionConsentCollection { - /// If set to `hidden`, it will hide legal text related to the reuse of a payment method. - pub payment_method_reuse_agreement: - Option, /// If set to `auto`, enables the collection of customer consent for promotional communications. /// The Checkout. /// Session will determine whether to display an option to opt into promotional communication diff --git a/generated/stripe_checkout/src/payment_pages_checkout_session_custom_text.rs b/generated/stripe_checkout/src/payment_pages_checkout_session_custom_text.rs index 7f0ccbfe8..6a5c4d221 100644 --- a/generated/stripe_checkout/src/payment_pages_checkout_session_custom_text.rs +++ b/generated/stripe_checkout/src/payment_pages_checkout_session_custom_text.rs @@ -1,7 +1,5 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentPagesCheckoutSessionCustomText { - /// Custom text that should be displayed after the payment confirmation button. - pub after_submit: Option, /// Custom text that should be displayed alongside shipping address collection. pub shipping_address: Option, /// Custom text that should be displayed alongside the payment confirmation button. diff --git a/generated/stripe_checkout/src/payment_pages_checkout_session_invoice_settings.rs b/generated/stripe_checkout/src/payment_pages_checkout_session_invoice_settings.rs index 677233882..ede351ff0 100644 --- a/generated/stripe_checkout/src/payment_pages_checkout_session_invoice_settings.rs +++ b/generated/stripe_checkout/src/payment_pages_checkout_session_invoice_settings.rs @@ -8,9 +8,6 @@ pub struct PaymentPagesCheckoutSessionInvoiceSettings { pub description: Option, /// Footer displayed on the invoice. pub footer: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - pub issuer: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. pub metadata: Option>, diff --git a/generated/stripe_checkout/src/payment_pages_checkout_session_payment_method_reuse_agreement.rs b/generated/stripe_checkout/src/payment_pages_checkout_session_payment_method_reuse_agreement.rs deleted file mode 100644 index 67c8b855a..000000000 --- a/generated/stripe_checkout/src/payment_pages_checkout_session_payment_method_reuse_agreement.rs +++ /dev/null @@ -1,70 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct PaymentPagesCheckoutSessionPaymentMethodReuseAgreement { - /// Determines the position and visibility of the payment method reuse agreement in the UI. - /// When set to `auto`, Stripe's defaults will be used. - /// - /// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. - pub position: PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition, -} -/// Determines the position and visibility of the payment method reuse agreement in the UI. -/// When set to `auto`, Stripe's defaults will be used. -/// -/// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - Auto, - Hidden, -} -impl PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - pub fn as_str(self) -> &'static str { - use PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition::*; - match self { - Auto => "auto", - Hidden => "hidden", - } - } -} - -impl std::str::FromStr for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition::*; - match s { - "auto" => Ok(Auto), - "hidden" => Ok(Hidden), - _ => Err(()), - } - } -} -impl std::fmt::Display for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> - for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition -{ - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for PaymentPagesCheckoutSessionPaymentMethodReuseAgreementPosition", - ) - }) - } -} diff --git a/generated/stripe_connect/Cargo.toml b/generated/stripe_connect/Cargo.toml index 095e49cd5..54ee0e549 100644 --- a/generated/stripe_connect/Cargo.toml +++ b/generated/stripe_connect/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - account = [] account_link = [] account_session = [] @@ -68,5 +57,5 @@ full = ["account", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_connect/src/account/requests.rs b/generated/stripe_connect/src/account/requests.rs index 728713933..63360dabf 100644 --- a/generated/stripe_connect/src/account/requests.rs +++ b/generated/stripe_connect/src/account/requests.rs @@ -1,203 +1,107 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteAccount {} -impl DeleteAccount { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteAccount { - /// With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage. - /// - /// Accounts created using test-mode keys can be deleted at any time. - /// Standard accounts created using live-mode keys cannot be deleted. - /// Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero. - /// - /// If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveForMyAccountAccount<'a> { +pub struct RetrieveForMyAccountAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveForMyAccountAccount<'a> { +impl<'a> RetrieveForMyAccountAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveForMyAccountAccount<'a> { - /// Retrieves the details of an account. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/account", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccount<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, +/// Retrieves the details of an account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveForMyAccountAccount<'a> { + inner: RetrieveForMyAccountAccountBuilder<'a>, } -impl<'a> ListAccount<'a> { +impl<'a> RetrieveForMyAccountAccount<'a> { pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListAccount<'a> { - /// Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). - /// If you’re not a platform, the list is empty. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/accounts", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/accounts", self) + Self { inner: RetrieveForMyAccountAccountBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveAccount<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrieveAccount<'a> { - /// Retrieves the details of an account. - pub fn send( +impl RetrieveForMyAccountAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.get_query(&format!("/accounts/{account}"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CapabilitiesAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CapabilitiesAccount<'a> { - pub fn new() -> Self { - Self::default() + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl<'a> CapabilitiesAccount<'a> { - /// Returns a list of capabilities associated with the account. - /// The capabilities are returned sorted by creation date, with the most recent capability appearing first. - pub fn send( + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/capabilities"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/capabilities"), self) +} + +impl StripeRequest for RetrieveForMyAccountAccount<'_> { + type Output = stripe_shared::Account; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/account").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PersonsAccount<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Filters on the list of people returned based on the person's relationship to the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> PersonsAccount<'a> { +impl<'a> RetrieveAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Filters on the list of people returned based on the person's relationship to the account's company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PersonsAccountRelationship { - /// A filter on the list of people returned based on whether these people are directors of the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub director: Option, - /// A filter on the list of people returned based on whether these people are executives of the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub executive: Option, - /// A filter on the list of people returned based on whether these people are legal guardians of the account's representative. - #[serde(skip_serializing_if = "Option::is_none")] - pub legal_guardian: Option, - /// A filter on the list of people returned based on whether these people are owners of the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// A filter on the list of people returned based on whether these people are the representative of the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub representative: Option, +/// Retrieves the details of an account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveAccount<'a> { + inner: RetrieveAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, } -impl PersonsAccountRelationship { - pub fn new() -> Self { - Self::default() +impl<'a> RetrieveAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: RetrieveAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> PersonsAccount<'a> { - /// Returns a list of people associated with the account’s legal entity. - /// The people are returned sorted by creation date, with the most recent people appearing first. - pub fn send( +impl RetrieveAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/persons"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/persons"), self) +} + +impl StripeRequest for RetrieveAccount<'_> { + type Output = stripe_shared::Account; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccount<'a> { +pub struct UpdateAccountBuilder<'a> { /// An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. #[serde(skip_serializing_if = "Option::is_none")] pub account_token: Option<&'a str>, @@ -205,7 +109,6 @@ pub struct CreateAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub business_profile: Option>, /// The business type. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] pub business_type: Option, /// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. @@ -214,17 +117,9 @@ pub struct CreateAccount<'a> { /// An account may have some of its requested capabilities be active and some be inactive. #[serde(skip_serializing_if = "Option::is_none")] pub capabilities: Option, - /// Information about the company or business. - /// This field is available for any `business_type`. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, - /// The country in which the account holder resides, or in which the business is legally established. - /// This should be an ISO 3166-1 alpha-2 country code. - /// For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. - /// Available countries include [Stripe's global markets](https://stripe.com/global) as well as countries where [cross-border payouts](https://stripe.com/docs/connect/cross-border-payouts) are supported. + /// Information about the company or business. This field is available for any `business_type`. #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, + pub company: Option>, /// Three-letter ISO currency code representing the default currency for the account. /// This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). #[serde(skip_serializing_if = "Option::is_none")] @@ -246,14 +141,12 @@ pub struct CreateAccount<'a> { /// /// By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. /// To add additional external accounts without replacing the existing default for the currency, use the [bank account](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs. - /// After you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] pub external_account: Option<&'a str>, /// Information about the person represented by the account. /// This field is null unless `business_type` is set to `individual`. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, + pub individual: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -262,34 +155,28 @@ pub struct CreateAccount<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Options for customizing how the account functions within Stripe. #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option>, - /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance) This property can only be updated for Custom accounts. + pub settings: Option>, + /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). #[serde(skip_serializing_if = "Option::is_none")] pub tos_acceptance: Option>, - /// The type of Stripe account to create. May be one of `custom`, `express` or `standard`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, } -impl<'a> CreateAccount<'a> { +impl<'a> UpdateAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Information about the company or business. -/// This field is available for any `business_type`. -/// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. +/// Information about the company or business. This field is available for any `business_type`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompany<'a> { +pub struct UpdateAccountBuilderCompany<'a> { /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// Whether the company's directors have been provided. /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. @@ -330,9 +217,8 @@ pub struct CreateAccountCompany<'a> { pub registration_number: Option<&'a str>, /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. - /// Pass an empty string to unset this value. #[serde(skip_serializing_if = "Option::is_none")] - pub structure: Option, + pub structure: Option, /// The business ID number of the company, as appropriate for the company’s country. /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). #[serde(skip_serializing_if = "Option::is_none")] @@ -347,14 +233,14 @@ pub struct CreateAccountCompany<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> CreateAccountCompany<'a> { +impl<'a> UpdateAccountBuilderCompany<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyAddressKana<'a> { +pub struct UpdateAccountBuilderCompanyAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -377,14 +263,14 @@ pub struct CreateAccountCompanyAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountCompanyAddressKana<'a> { +impl<'a> UpdateAccountBuilderCompanyAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyAddressKanji<'a> { +pub struct UpdateAccountBuilderCompanyAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -407,17 +293,16 @@ pub struct CreateAccountCompanyAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountCompanyAddressKanji<'a> { +impl<'a> UpdateAccountBuilderCompanyAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. -/// Pass an empty string to unset this value. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateAccountCompanyStructure { +pub enum UpdateAccountBuilderCompanyStructure { FreeZoneEstablishment, FreeZoneLlc, GovernmentInstrumentality, @@ -433,7 +318,6 @@ pub enum CreateAccountCompanyStructure { PublicCompany, PublicCorporation, PublicPartnership, - RegisteredCharity, SingleMemberLlc, SoleEstablishment, SoleProprietorship, @@ -444,9 +328,9 @@ pub enum CreateAccountCompanyStructure { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateAccountCompanyStructure { +impl UpdateAccountBuilderCompanyStructure { pub fn as_str(self) -> &'static str { - use CreateAccountCompanyStructure::*; + use UpdateAccountBuilderCompanyStructure::*; match self { FreeZoneEstablishment => "free_zone_establishment", FreeZoneLlc => "free_zone_llc", @@ -463,7 +347,6 @@ impl CreateAccountCompanyStructure { PublicCompany => "public_company", PublicCorporation => "public_corporation", PublicPartnership => "public_partnership", - RegisteredCharity => "registered_charity", SingleMemberLlc => "single_member_llc", SoleEstablishment => "sole_establishment", SoleProprietorship => "sole_proprietorship", @@ -476,10 +359,10 @@ impl CreateAccountCompanyStructure { } } -impl std::str::FromStr for CreateAccountCompanyStructure { +impl std::str::FromStr for UpdateAccountBuilderCompanyStructure { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountCompanyStructure::*; + use UpdateAccountBuilderCompanyStructure::*; match s { "free_zone_establishment" => Ok(FreeZoneEstablishment), "free_zone_llc" => Ok(FreeZoneLlc), @@ -496,7 +379,6 @@ impl std::str::FromStr for CreateAccountCompanyStructure { "public_company" => Ok(PublicCompany), "public_corporation" => Ok(PublicCorporation), "public_partnership" => Ok(PublicPartnership), - "registered_charity" => Ok(RegisteredCharity), "single_member_llc" => Ok(SingleMemberLlc), "sole_establishment" => Ok(SoleEstablishment), "sole_proprietorship" => Ok(SoleProprietorship), @@ -508,18 +390,18 @@ impl std::str::FromStr for CreateAccountCompanyStructure { } } } -impl std::fmt::Display for CreateAccountCompanyStructure { +impl std::fmt::Display for UpdateAccountBuilderCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountCompanyStructure { +impl std::fmt::Debug for UpdateAccountBuilderCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountCompanyStructure { +impl serde::Serialize for UpdateAccountBuilderCompanyStructure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -529,18 +411,17 @@ impl serde::Serialize for CreateAccountCompanyStructure { } /// Information about the person represented by the account. /// This field is null unless `business_type` is set to `individual`. -/// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividual<'a> { +pub struct UpdateAccountBuilderIndividual<'a> { /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, @@ -595,13 +476,10 @@ pub struct CreateAccountIndividual<'a> { pub phone: Option<&'a str>, /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[serde(skip_serializing_if = "Option::is_none")] - pub political_exposure: Option, + pub political_exposure: Option, /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] pub registered_address: Option>, - /// Describes the person’s relationship to the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, @@ -609,14 +487,14 @@ pub struct CreateAccountIndividual<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> CreateAccountIndividual<'a> { +impl<'a> UpdateAccountBuilderIndividual<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualAddressKana<'a> { +pub struct UpdateAccountBuilderIndividualAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -639,14 +517,14 @@ pub struct CreateAccountIndividualAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountIndividualAddressKana<'a> { +impl<'a> UpdateAccountBuilderIndividualAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualAddressKanji<'a> { +pub struct UpdateAccountBuilderIndividualAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -669,20 +547,20 @@ pub struct CreateAccountIndividualAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountIndividualAddressKanji<'a> { +impl<'a> UpdateAccountBuilderIndividualAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountIndividualPoliticalExposure { +pub enum UpdateAccountBuilderIndividualPoliticalExposure { Existing, None, } -impl CreateAccountIndividualPoliticalExposure { +impl UpdateAccountBuilderIndividualPoliticalExposure { pub fn as_str(self) -> &'static str { - use CreateAccountIndividualPoliticalExposure::*; + use UpdateAccountBuilderIndividualPoliticalExposure::*; match self { Existing => "existing", None => "none", @@ -690,10 +568,10 @@ impl CreateAccountIndividualPoliticalExposure { } } -impl std::str::FromStr for CreateAccountIndividualPoliticalExposure { +impl std::str::FromStr for UpdateAccountBuilderIndividualPoliticalExposure { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountIndividualPoliticalExposure::*; + use UpdateAccountBuilderIndividualPoliticalExposure::*; match s { "existing" => Ok(Existing), "none" => Ok(None), @@ -701,18 +579,18 @@ impl std::str::FromStr for CreateAccountIndividualPoliticalExposure { } } } -impl std::fmt::Display for CreateAccountIndividualPoliticalExposure { +impl std::fmt::Display for UpdateAccountBuilderIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountIndividualPoliticalExposure { +impl std::fmt::Debug for UpdateAccountBuilderIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountIndividualPoliticalExposure { +impl serde::Serialize for UpdateAccountBuilderIndividualPoliticalExposure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -722,8 +600,8 @@ impl serde::Serialize for CreateAccountIndividualPoliticalExposure { } /// Options for customizing how the account functions within Stripe. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettings<'a> { - /// Settings specific to Bacs Direct Debit. +pub struct UpdateAccountBuilderSettings<'a> { + /// Settings specific to Bacs Direct Debit payments. #[serde(skip_serializing_if = "Option::is_none")] pub bacs_debit_payments: Option>, /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. @@ -740,19 +618,19 @@ pub struct CreateAccountSettings<'a> { pub payments: Option>, /// Settings specific to the account's payouts. #[serde(skip_serializing_if = "Option::is_none")] - pub payouts: Option>, + pub payouts: Option>, /// Settings specific to the account's Treasury FinancialAccounts. #[serde(skip_serializing_if = "Option::is_none")] pub treasury: Option>, } -impl<'a> CreateAccountSettings<'a> { +impl<'a> UpdateAccountBuilderSettings<'a> { pub fn new() -> Self { Self::default() } } /// Settings specific to the account's payouts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsPayouts<'a> { +pub struct UpdateAccountBuilderSettingsPayouts<'a> { /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). #[serde(skip_serializing_if = "Option::is_none")] @@ -760,13 +638,13 @@ pub struct CreateAccountSettingsPayouts<'a> { /// Details on when funds from charges are available, and when they are paid out to an external account. /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[serde(skip_serializing_if = "Option::is_none")] - pub schedule: Option, + pub schedule: Option, /// The text that appears on the bank account statement for payouts. /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, } -impl<'a> CreateAccountSettingsPayouts<'a> { +impl<'a> UpdateAccountBuilderSettingsPayouts<'a> { pub fn new() -> Self { Self::default() } @@ -774,19 +652,19 @@ impl<'a> CreateAccountSettingsPayouts<'a> { /// Details on when funds from charges are available, and when they are paid out to an external account. /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsPayoutsSchedule { +pub struct UpdateAccountBuilderSettingsPayoutsSchedule { /// The number of days charge funds are held before being paid out. /// May also be set to `minimum`, representing the lowest available value for the account country. /// Default is `minimum`. /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[serde(skip_serializing_if = "Option::is_none")] - pub delay_days: Option, + pub delay_days: Option, /// How frequently available funds are paid out. /// One of: `daily`, `manual`, `weekly`, or `monthly`. /// Default is `daily`. #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, + pub interval: Option, /// The day of the month when available funds are paid out, specified as a number between 1--31. /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. /// Required and applicable only if `interval` is `monthly`. @@ -795,9 +673,9 @@ pub struct CreateAccountSettingsPayoutsSchedule { /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. /// (required and applicable only if `interval` is `weekly`.). #[serde(skip_serializing_if = "Option::is_none")] - pub weekly_anchor: Option, + pub weekly_anchor: Option, } -impl CreateAccountSettingsPayoutsSchedule { +impl UpdateAccountBuilderSettingsPayoutsSchedule { pub fn new() -> Self { Self::default() } @@ -809,7 +687,7 @@ impl CreateAccountSettingsPayoutsSchedule { /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateAccountSettingsPayoutsScheduleDelayDays { +pub enum UpdateAccountBuilderSettingsPayoutsScheduleDelayDays { Minimum, U32(u32), } @@ -817,15 +695,15 @@ pub enum CreateAccountSettingsPayoutsScheduleDelayDays { /// One of: `daily`, `manual`, `weekly`, or `monthly`. /// Default is `daily`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountSettingsPayoutsScheduleInterval { +pub enum UpdateAccountBuilderSettingsPayoutsScheduleInterval { Daily, Manual, Monthly, Weekly, } -impl CreateAccountSettingsPayoutsScheduleInterval { +impl UpdateAccountBuilderSettingsPayoutsScheduleInterval { pub fn as_str(self) -> &'static str { - use CreateAccountSettingsPayoutsScheduleInterval::*; + use UpdateAccountBuilderSettingsPayoutsScheduleInterval::*; match self { Daily => "daily", Manual => "manual", @@ -835,10 +713,10 @@ impl CreateAccountSettingsPayoutsScheduleInterval { } } -impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleInterval { +impl std::str::FromStr for UpdateAccountBuilderSettingsPayoutsScheduleInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountSettingsPayoutsScheduleInterval::*; + use UpdateAccountBuilderSettingsPayoutsScheduleInterval::*; match s { "daily" => Ok(Daily), "manual" => Ok(Manual), @@ -848,18 +726,18 @@ impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleInterval { } } } -impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleInterval { +impl std::fmt::Display for UpdateAccountBuilderSettingsPayoutsScheduleInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleInterval { +impl std::fmt::Debug for UpdateAccountBuilderSettingsPayoutsScheduleInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountSettingsPayoutsScheduleInterval { +impl serde::Serialize for UpdateAccountBuilderSettingsPayoutsScheduleInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -870,7 +748,7 @@ impl serde::Serialize for CreateAccountSettingsPayoutsScheduleInterval { /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. /// (required and applicable only if `interval` is `weekly`.). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +pub enum UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { Friday, Monday, Saturday, @@ -879,9 +757,9 @@ pub enum CreateAccountSettingsPayoutsScheduleWeeklyAnchor { Tuesday, Wednesday, } -impl CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { pub fn as_str(self) -> &'static str { - use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + use UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor::*; match self { Friday => "friday", Monday => "monday", @@ -894,10 +772,10 @@ impl CreateAccountSettingsPayoutsScheduleWeeklyAnchor { } } -impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::str::FromStr for UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + use UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor::*; match s { "friday" => Ok(Friday), "monday" => Ok(Monday), @@ -910,18 +788,18 @@ impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { } } } -impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::fmt::Display for UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::fmt::Debug for UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl serde::Serialize for UpdateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -929,20 +807,211 @@ impl serde::Serialize for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { serializer.serialize_str(self.as_str()) } } -impl<'a> CreateAccount<'a> { - /// With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. - /// To do this, you’ll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). - /// - /// If you’ve already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when. - /// creating the account. - /// Connect Onboarding won’t ask for the prefilled information during account onboarding. - /// You can prefill any information on the account. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/accounts", self, http_types::Method::Post) +/// Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. +/// Any parameters not provided are. +/// left unchanged. +/// +/// For Custom accounts, you can update any information on the account. +/// For other accounts, you can update all information until that. +/// account has started to go through Connect Onboarding. +/// Once you create an [Account Link](https://stripe.com/docs/api/account_links). +/// for a Standard or Express account, some parameters can no longer be changed. +/// These are marked as **Custom Only** or **Custom and Express**. +/// below. +/// +/// To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). +/// Refer to our. +/// [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateAccount<'a> { + inner: UpdateAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} +impl<'a> UpdateAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: UpdateAccountBuilder::new() } + } + pub fn account_token(mut self, account_token: &'a str) -> Self { + self.inner.account_token = Some(account_token); + self + } + + pub fn business_profile(mut self, business_profile: BusinessProfileSpecs<'a>) -> Self { + self.inner.business_profile = Some(business_profile); + self + } + + pub fn business_type(mut self, business_type: stripe_shared::AccountBusinessType) -> Self { + self.inner.business_type = Some(business_type); + self + } + + pub fn capabilities(mut self, capabilities: CapabilitiesParam) -> Self { + self.inner.capabilities = Some(capabilities); + self + } + + pub fn company(mut self, company: UpdateAccountBuilderCompany<'a>) -> Self { + self.inner.company = Some(company); + self + } + + pub fn default_currency(mut self, default_currency: stripe_types::Currency) -> Self { + self.inner.default_currency = Some(default_currency); + self + } + + pub fn documents(mut self, documents: DocumentsSpecs<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn external_account(mut self, external_account: &'a str) -> Self { + self.inner.external_account = Some(external_account); + self + } + + pub fn individual(mut self, individual: UpdateAccountBuilderIndividual<'a>) -> Self { + self.inner.individual = Some(individual); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn settings(mut self, settings: UpdateAccountBuilderSettings<'a>) -> Self { + self.inner.settings = Some(settings); + self + } + + pub fn tos_acceptance(mut self, tos_acceptance: TosAcceptanceSpecs<'a>) -> Self { + self.inner.tos_acceptance = Some(tos_acceptance); + self + } +} +impl UpdateAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateAccount<'_> { + type Output = stripe_shared::Account; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccount<'a> { +pub struct ListAccountBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). +/// If you’re not a platform, the list is empty. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListAccount<'a> { + inner: ListAccountBuilder<'a>, +} +impl<'a> ListAccount<'a> { + pub fn new() -> Self { + Self { inner: ListAccountBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/accounts").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateAccountBuilder<'a> { /// An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. #[serde(skip_serializing_if = "Option::is_none")] pub account_token: Option<&'a str>, @@ -950,7 +1019,6 @@ pub struct UpdateAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub business_profile: Option>, /// The business type. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] pub business_type: Option, /// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. @@ -959,11 +1027,15 @@ pub struct UpdateAccount<'a> { /// An account may have some of its requested capabilities be active and some be inactive. #[serde(skip_serializing_if = "Option::is_none")] pub capabilities: Option, - /// Information about the company or business. - /// This field is available for any `business_type`. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. + /// Information about the company or business. This field is available for any `business_type`. #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, + pub company: Option>, + /// The country in which the account holder resides, or in which the business is legally established. + /// This should be an ISO 3166-1 alpha-2 country code. + /// For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. + /// Available countries include [Stripe's global markets](https://stripe.com/global) as well as countries where [cross-border payouts](https://stripe.com/docs/connect/cross-border-payouts) are supported. + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, /// Three-letter ISO currency code representing the default currency for the account. /// This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). #[serde(skip_serializing_if = "Option::is_none")] @@ -985,14 +1057,12 @@ pub struct UpdateAccount<'a> { /// /// By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. /// To add additional external accounts without replacing the existing default for the currency, use the [bank account](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs. - /// After you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] pub external_account: Option<&'a str>, /// Information about the person represented by the account. /// This field is null unless `business_type` is set to `individual`. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, + pub individual: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -1001,30 +1071,32 @@ pub struct UpdateAccount<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Options for customizing how the account functions within Stripe. #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option>, - /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance) This property can only be updated for Custom accounts. + pub settings: Option>, + /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). #[serde(skip_serializing_if = "Option::is_none")] pub tos_acceptance: Option>, + /// The type of Stripe account to create. May be one of `custom`, `express` or `standard`. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option, } -impl<'a> UpdateAccount<'a> { +impl<'a> CreateAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Information about the company or business. -/// This field is available for any `business_type`. -/// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. +/// Information about the company or business. This field is available for any `business_type`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompany<'a> { +pub struct CreateAccountBuilderCompany<'a> { /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// Whether the company's directors have been provided. /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. @@ -1065,9 +1137,8 @@ pub struct UpdateAccountCompany<'a> { pub registration_number: Option<&'a str>, /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. - /// Pass an empty string to unset this value. #[serde(skip_serializing_if = "Option::is_none")] - pub structure: Option, + pub structure: Option, /// The business ID number of the company, as appropriate for the company’s country. /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). #[serde(skip_serializing_if = "Option::is_none")] @@ -1082,14 +1153,14 @@ pub struct UpdateAccountCompany<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> UpdateAccountCompany<'a> { +impl<'a> CreateAccountBuilderCompany<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyAddressKana<'a> { +pub struct CreateAccountBuilderCompanyAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1112,14 +1183,14 @@ pub struct UpdateAccountCompanyAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountCompanyAddressKana<'a> { +impl<'a> CreateAccountBuilderCompanyAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyAddressKanji<'a> { +pub struct CreateAccountBuilderCompanyAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1142,17 +1213,16 @@ pub struct UpdateAccountCompanyAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountCompanyAddressKanji<'a> { +impl<'a> CreateAccountBuilderCompanyAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. -/// Pass an empty string to unset this value. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateAccountCompanyStructure { +pub enum CreateAccountBuilderCompanyStructure { FreeZoneEstablishment, FreeZoneLlc, GovernmentInstrumentality, @@ -1168,7 +1238,6 @@ pub enum UpdateAccountCompanyStructure { PublicCompany, PublicCorporation, PublicPartnership, - RegisteredCharity, SingleMemberLlc, SoleEstablishment, SoleProprietorship, @@ -1179,9 +1248,9 @@ pub enum UpdateAccountCompanyStructure { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateAccountCompanyStructure { +impl CreateAccountBuilderCompanyStructure { pub fn as_str(self) -> &'static str { - use UpdateAccountCompanyStructure::*; + use CreateAccountBuilderCompanyStructure::*; match self { FreeZoneEstablishment => "free_zone_establishment", FreeZoneLlc => "free_zone_llc", @@ -1198,7 +1267,6 @@ impl UpdateAccountCompanyStructure { PublicCompany => "public_company", PublicCorporation => "public_corporation", PublicPartnership => "public_partnership", - RegisteredCharity => "registered_charity", SingleMemberLlc => "single_member_llc", SoleEstablishment => "sole_establishment", SoleProprietorship => "sole_proprietorship", @@ -1211,10 +1279,10 @@ impl UpdateAccountCompanyStructure { } } -impl std::str::FromStr for UpdateAccountCompanyStructure { +impl std::str::FromStr for CreateAccountBuilderCompanyStructure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountCompanyStructure::*; + use CreateAccountBuilderCompanyStructure::*; match s { "free_zone_establishment" => Ok(FreeZoneEstablishment), "free_zone_llc" => Ok(FreeZoneLlc), @@ -1231,7 +1299,6 @@ impl std::str::FromStr for UpdateAccountCompanyStructure { "public_company" => Ok(PublicCompany), "public_corporation" => Ok(PublicCorporation), "public_partnership" => Ok(PublicPartnership), - "registered_charity" => Ok(RegisteredCharity), "single_member_llc" => Ok(SingleMemberLlc), "sole_establishment" => Ok(SoleEstablishment), "sole_proprietorship" => Ok(SoleProprietorship), @@ -1243,18 +1310,18 @@ impl std::str::FromStr for UpdateAccountCompanyStructure { } } } -impl std::fmt::Display for UpdateAccountCompanyStructure { +impl std::fmt::Display for CreateAccountBuilderCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountCompanyStructure { +impl std::fmt::Debug for CreateAccountBuilderCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountCompanyStructure { +impl serde::Serialize for CreateAccountBuilderCompanyStructure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1264,18 +1331,17 @@ impl serde::Serialize for UpdateAccountCompanyStructure { } /// Information about the person represented by the account. /// This field is null unless `business_type` is set to `individual`. -/// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property can only be updated for Custom accounts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividual<'a> { +pub struct CreateAccountBuilderIndividual<'a> { /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, @@ -1330,13 +1396,10 @@ pub struct UpdateAccountIndividual<'a> { pub phone: Option<&'a str>, /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[serde(skip_serializing_if = "Option::is_none")] - pub political_exposure: Option, + pub political_exposure: Option, /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] pub registered_address: Option>, - /// Describes the person’s relationship to the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, @@ -1344,14 +1407,14 @@ pub struct UpdateAccountIndividual<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> UpdateAccountIndividual<'a> { +impl<'a> CreateAccountBuilderIndividual<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualAddressKana<'a> { +pub struct CreateAccountBuilderIndividualAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1374,14 +1437,14 @@ pub struct UpdateAccountIndividualAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountIndividualAddressKana<'a> { +impl<'a> CreateAccountBuilderIndividualAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualAddressKanji<'a> { +pub struct CreateAccountBuilderIndividualAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1404,20 +1467,20 @@ pub struct UpdateAccountIndividualAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountIndividualAddressKanji<'a> { +impl<'a> CreateAccountBuilderIndividualAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountIndividualPoliticalExposure { +pub enum CreateAccountBuilderIndividualPoliticalExposure { Existing, None, } -impl UpdateAccountIndividualPoliticalExposure { +impl CreateAccountBuilderIndividualPoliticalExposure { pub fn as_str(self) -> &'static str { - use UpdateAccountIndividualPoliticalExposure::*; + use CreateAccountBuilderIndividualPoliticalExposure::*; match self { Existing => "existing", None => "none", @@ -1425,10 +1488,10 @@ impl UpdateAccountIndividualPoliticalExposure { } } -impl std::str::FromStr for UpdateAccountIndividualPoliticalExposure { +impl std::str::FromStr for CreateAccountBuilderIndividualPoliticalExposure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountIndividualPoliticalExposure::*; + use CreateAccountBuilderIndividualPoliticalExposure::*; match s { "existing" => Ok(Existing), "none" => Ok(None), @@ -1436,18 +1499,18 @@ impl std::str::FromStr for UpdateAccountIndividualPoliticalExposure { } } } -impl std::fmt::Display for UpdateAccountIndividualPoliticalExposure { +impl std::fmt::Display for CreateAccountBuilderIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountIndividualPoliticalExposure { +impl std::fmt::Debug for CreateAccountBuilderIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountIndividualPoliticalExposure { +impl serde::Serialize for CreateAccountBuilderIndividualPoliticalExposure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1457,8 +1520,8 @@ impl serde::Serialize for UpdateAccountIndividualPoliticalExposure { } /// Options for customizing how the account functions within Stripe. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettings<'a> { - /// Settings specific to Bacs Direct Debit payments. +pub struct CreateAccountBuilderSettings<'a> { + /// Settings specific to Bacs Direct Debit. #[serde(skip_serializing_if = "Option::is_none")] pub bacs_debit_payments: Option>, /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. @@ -1470,40 +1533,24 @@ pub struct UpdateAccountSettings<'a> { /// Settings specific to card charging on the account. #[serde(skip_serializing_if = "Option::is_none")] pub card_payments: Option>, - /// Settings specific to the account's use of Invoices. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoices: Option>, /// Settings that apply across payment methods for charging on the account. #[serde(skip_serializing_if = "Option::is_none")] pub payments: Option>, /// Settings specific to the account's payouts. #[serde(skip_serializing_if = "Option::is_none")] - pub payouts: Option>, + pub payouts: Option>, /// Settings specific to the account's Treasury FinancialAccounts. #[serde(skip_serializing_if = "Option::is_none")] pub treasury: Option>, } -impl<'a> UpdateAccountSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to the account's use of Invoices. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsInvoices<'a> { - /// The list of default Account Tax IDs to automatically include on invoices. - /// Account Tax IDs get added when an invoice is finalized. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_account_tax_ids: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountSettingsInvoices<'a> { +impl<'a> CreateAccountBuilderSettings<'a> { pub fn new() -> Self { Self::default() } } /// Settings specific to the account's payouts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsPayouts<'a> { +pub struct CreateAccountBuilderSettingsPayouts<'a> { /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). #[serde(skip_serializing_if = "Option::is_none")] @@ -1511,13 +1558,13 @@ pub struct UpdateAccountSettingsPayouts<'a> { /// Details on when funds from charges are available, and when they are paid out to an external account. /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[serde(skip_serializing_if = "Option::is_none")] - pub schedule: Option, + pub schedule: Option, /// The text that appears on the bank account statement for payouts. /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, } -impl<'a> UpdateAccountSettingsPayouts<'a> { +impl<'a> CreateAccountBuilderSettingsPayouts<'a> { pub fn new() -> Self { Self::default() } @@ -1525,19 +1572,19 @@ impl<'a> UpdateAccountSettingsPayouts<'a> { /// Details on when funds from charges are available, and when they are paid out to an external account. /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsPayoutsSchedule { +pub struct CreateAccountBuilderSettingsPayoutsSchedule { /// The number of days charge funds are held before being paid out. /// May also be set to `minimum`, representing the lowest available value for the account country. /// Default is `minimum`. /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[serde(skip_serializing_if = "Option::is_none")] - pub delay_days: Option, + pub delay_days: Option, /// How frequently available funds are paid out. /// One of: `daily`, `manual`, `weekly`, or `monthly`. /// Default is `daily`. #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, + pub interval: Option, /// The day of the month when available funds are paid out, specified as a number between 1--31. /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. /// Required and applicable only if `interval` is `monthly`. @@ -1546,9 +1593,9 @@ pub struct UpdateAccountSettingsPayoutsSchedule { /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. /// (required and applicable only if `interval` is `weekly`.). #[serde(skip_serializing_if = "Option::is_none")] - pub weekly_anchor: Option, + pub weekly_anchor: Option, } -impl UpdateAccountSettingsPayoutsSchedule { +impl CreateAccountBuilderSettingsPayoutsSchedule { pub fn new() -> Self { Self::default() } @@ -1560,7 +1607,7 @@ impl UpdateAccountSettingsPayoutsSchedule { /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateAccountSettingsPayoutsScheduleDelayDays { +pub enum CreateAccountBuilderSettingsPayoutsScheduleDelayDays { Minimum, U32(u32), } @@ -1568,15 +1615,15 @@ pub enum UpdateAccountSettingsPayoutsScheduleDelayDays { /// One of: `daily`, `manual`, `weekly`, or `monthly`. /// Default is `daily`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountSettingsPayoutsScheduleInterval { +pub enum CreateAccountBuilderSettingsPayoutsScheduleInterval { Daily, Manual, Monthly, Weekly, } -impl UpdateAccountSettingsPayoutsScheduleInterval { +impl CreateAccountBuilderSettingsPayoutsScheduleInterval { pub fn as_str(self) -> &'static str { - use UpdateAccountSettingsPayoutsScheduleInterval::*; + use CreateAccountBuilderSettingsPayoutsScheduleInterval::*; match self { Daily => "daily", Manual => "manual", @@ -1586,10 +1633,10 @@ impl UpdateAccountSettingsPayoutsScheduleInterval { } } -impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleInterval { +impl std::str::FromStr for CreateAccountBuilderSettingsPayoutsScheduleInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountSettingsPayoutsScheduleInterval::*; + use CreateAccountBuilderSettingsPayoutsScheduleInterval::*; match s { "daily" => Ok(Daily), "manual" => Ok(Manual), @@ -1599,18 +1646,18 @@ impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleInterval { } } } -impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleInterval { +impl std::fmt::Display for CreateAccountBuilderSettingsPayoutsScheduleInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleInterval { +impl std::fmt::Debug for CreateAccountBuilderSettingsPayoutsScheduleInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleInterval { +impl serde::Serialize for CreateAccountBuilderSettingsPayoutsScheduleInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1621,7 +1668,7 @@ impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleInterval { /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. /// (required and applicable only if `interval` is `weekly`.). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +pub enum CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { Friday, Monday, Saturday, @@ -1630,9 +1677,9 @@ pub enum UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { Tuesday, Wednesday, } -impl UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { pub fn as_str(self) -> &'static str { - use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + use CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor::*; match self { Friday => "friday", Monday => "monday", @@ -1645,10 +1692,10 @@ impl UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { } } -impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::str::FromStr for CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + use CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor::*; match s { "friday" => Ok(Friday), "monday" => Ok(Monday), @@ -1661,18 +1708,18 @@ impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { } } } -impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::fmt::Display for CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl std::fmt::Debug for CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { +impl serde::Serialize for CreateAccountBuilderSettingsPayoutsScheduleWeeklyAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1680,71 +1727,386 @@ impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { serializer.serialize_str(self.as_str()) } } -impl<'a> UpdateAccount<'a> { - /// Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. - /// Any parameters not provided are. - /// left unchanged. - /// - /// For Custom accounts, you can update any information on the account. - /// For other accounts, you can update all information until that. - /// account has started to go through Connect Onboarding. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions),. - /// some properties can only be changed or updated for Custom accounts. - /// - /// To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). - /// Refer to our. - /// [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. - pub fn send( +/// With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. +/// To do this, you’ll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). +/// +/// If you’ve already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when. +/// creating the account. +/// Connect Onboarding won’t ask for the prefilled information during account onboarding. +/// You can prefill any information on the account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccount<'a> { + inner: CreateAccountBuilder<'a>, +} +impl<'a> CreateAccount<'a> { + pub fn new() -> Self { + Self { inner: CreateAccountBuilder::new() } + } + pub fn account_token(mut self, account_token: &'a str) -> Self { + self.inner.account_token = Some(account_token); + self + } + + pub fn business_profile(mut self, business_profile: BusinessProfileSpecs<'a>) -> Self { + self.inner.business_profile = Some(business_profile); + self + } + + pub fn business_type(mut self, business_type: stripe_shared::AccountBusinessType) -> Self { + self.inner.business_type = Some(business_type); + self + } + + pub fn capabilities(mut self, capabilities: CapabilitiesParam) -> Self { + self.inner.capabilities = Some(capabilities); + self + } + + pub fn company(mut self, company: CreateAccountBuilderCompany<'a>) -> Self { + self.inner.company = Some(company); + self + } + + pub fn country(mut self, country: &'a str) -> Self { + self.inner.country = Some(country); + self + } + + pub fn default_currency(mut self, default_currency: stripe_types::Currency) -> Self { + self.inner.default_currency = Some(default_currency); + self + } + + pub fn documents(mut self, documents: DocumentsSpecs<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn external_account(mut self, external_account: &'a str) -> Self { + self.inner.external_account = Some(external_account); + self + } + + pub fn individual(mut self, individual: CreateAccountBuilderIndividual<'a>) -> Self { + self.inner.individual = Some(individual); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn settings(mut self, settings: CreateAccountBuilderSettings<'a>) -> Self { + self.inner.settings = Some(settings); + self + } + + pub fn tos_acceptance(mut self, tos_acceptance: TosAcceptanceSpecs<'a>) -> Self { + self.inner.tos_acceptance = Some(tos_acceptance); + self + } + + pub fn type_(mut self, type_: stripe_shared::AccountType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl CreateAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateAccount<'_> { + type Output = stripe_shared::Account; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/accounts").form(&self.inner) + } +} +/// With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage. +/// +/// Accounts created using test-mode keys can be deleted at any time. +/// Standard accounts created using live-mode keys cannot be deleted. +/// Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero. +/// +/// If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteAccount<'a> { + account: &'a stripe_shared::AccountId, +} +impl<'a> DeleteAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account } + } +} +impl DeleteAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteAccount<'_> { + type Output = stripe_shared::DeletedAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Delete, format!("/accounts/{account}")) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct RejectAccount<'a> { +pub struct RejectAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. pub reason: &'a str, } -impl<'a> RejectAccount<'a> { +impl<'a> RejectAccountBuilder<'a> { pub fn new(reason: &'a str) -> Self { Self { expand: None, reason } } } +/// With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. +/// +/// Test-mode Custom and Express accounts can be rejected at any time. +/// Accounts created using live-mode keys may only be rejected once all balances are zero. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RejectAccount<'a> { + inner: RejectAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> RejectAccount<'a> { - /// With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. - /// - /// Test-mode Custom and Express accounts can be rejected at any time. - /// Accounts created using live-mode keys may only be rejected once all balances are zero. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, reason: &'a str) -> Self { + Self { account, inner: RejectAccountBuilder::new(reason) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RejectAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}/reject"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct AnnualRevenueSpecs<'a> { - /// A non-negative integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// The close-out date of the preceding fiscal year in ISO 8601 format. - /// E.g. - /// 2023-12-31 for the 31st of December, 2023. - pub fiscal_year_end: &'a str, + +impl StripeRequest for RejectAccount<'_> { + type Output = stripe_shared::Account; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}/reject")) + .form(&self.inner) + } } -impl<'a> AnnualRevenueSpecs<'a> { - pub fn new(amount: i64, currency: stripe_types::Currency, fiscal_year_end: &'a str) -> Self { - Self { amount, currency, fiscal_year_end } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonsAccountBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Filters on the list of people returned based on the person's relationship to the account's company. + #[serde(skip_serializing_if = "Option::is_none")] + pub relationship: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> PersonsAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Filters on the list of people returned based on the person's relationship to the account's company. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonsAccountBuilderRelationship { + /// A filter on the list of people returned based on whether these people are directors of the account's company. + #[serde(skip_serializing_if = "Option::is_none")] + pub director: Option, + /// A filter on the list of people returned based on whether these people are executives of the account's company. + #[serde(skip_serializing_if = "Option::is_none")] + pub executive: Option, + /// A filter on the list of people returned based on whether these people are legal guardians of the account's representative. + #[serde(skip_serializing_if = "Option::is_none")] + pub legal_guardian: Option, + /// A filter on the list of people returned based on whether these people are owners of the account's company. + #[serde(skip_serializing_if = "Option::is_none")] + pub owner: Option, + /// A filter on the list of people returned based on whether these people are the representative of the account's company. + #[serde(skip_serializing_if = "Option::is_none")] + pub representative: Option, +} +impl PersonsAccountBuilderRelationship { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of people associated with the account’s legal entity. +/// The people are returned sorted by creation date, with the most recent people appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PersonsAccount<'a> { + inner: PersonsAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} +impl<'a> PersonsAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: PersonsAccountBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn relationship(mut self, relationship: PersonsAccountBuilderRelationship) -> Self { + self.inner.relationship = Some(relationship); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl PersonsAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for PersonsAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/persons")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CapabilitiesAccountBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CapabilitiesAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() } } +/// Returns a list of capabilities associated with the account. +/// The capabilities are returned sorted by creation date, with the most recent capability appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CapabilitiesAccount<'a> { + inner: CapabilitiesAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} +impl<'a> CapabilitiesAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: CapabilitiesAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CapabilitiesAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CapabilitiesAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/capabilities")) + .query(&self.inner) + } +} + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct MonthlyEstimatedRevenueSpecs { /// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -1856,30 +2218,6 @@ impl DateOfBirthSpecs { } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct IndividualRelationshipSpecs<'a> { - /// Whether the person is a director of the account's legal entity. - /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. - #[serde(skip_serializing_if = "Option::is_none")] - pub director: Option, - /// Whether the person has significant responsibility to control, manage, or direct the organization. - #[serde(skip_serializing_if = "Option::is_none")] - pub executive: Option, - /// Whether the person is an owner of the account’s legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// The percent owned by the person of the account's legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub percent_ownership: Option, - /// The person's title (e.g., CEO, Support Engineer). - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option<&'a str>, -} -impl<'a> IndividualRelationshipSpecs<'a> { - pub fn new() -> Self { - Self::default() - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct PersonVerificationDocumentSpecs<'a> { /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. @@ -2006,13 +2344,6 @@ impl<'a> TosAcceptanceSpecs<'a> { } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct BusinessProfileSpecs<'a> { - /// The applicant's gross annual revenue for its preceding fiscal year. - #[serde(skip_serializing_if = "Option::is_none")] - pub annual_revenue: Option>, - /// An estimated upper bound of employees, contractors, vendors, etc. - /// currently working for the business. - #[serde(skip_serializing_if = "Option::is_none")] - pub estimated_worker_count: Option, /// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). /// MCCs are used to classify businesses based on the goods or services they provide. #[serde(skip_serializing_if = "Option::is_none")] @@ -2143,9 +2474,6 @@ pub struct CapabilitiesParam { /// The sofort_payments capability. #[serde(skip_serializing_if = "Option::is_none")] pub sofort_payments: Option, - /// The swish_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish_payments: Option, /// The tax_reporting_us_1099_k capability. #[serde(skip_serializing_if = "Option::is_none")] pub tax_reporting_us_1099_k: Option, diff --git a/generated/stripe_connect/src/account_link/requests.rs b/generated/stripe_connect/src/account_link/requests.rs index 3491c04a2..e99a4d779 100644 --- a/generated/stripe_connect/src/account_link/requests.rs +++ b/generated/stripe_connect/src/account_link/requests.rs @@ -1,13 +1,16 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountLink<'a> { +pub struct CreateAccountLinkBuilder<'a> { /// The identifier of the account to create an account link for. pub account: &'a str, - /// The collect parameter is deprecated. Use `collection_options` instead. - #[serde(skip_serializing_if = "Option::is_none")] - pub collect: Option, - /// Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow. + /// Which information the platform needs to collect from the user. + /// One of `currently_due` or `eventually_due`. + /// Default is `currently_due`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_options: Option, + pub collect: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -22,30 +25,24 @@ pub struct CreateAccountLink<'a> { /// The type of account link the user is requesting. /// Possible values are `account_onboarding` or `account_update`. #[serde(rename = "type")] - pub type_: CreateAccountLinkType, + pub type_: CreateAccountLinkBuilderType, } -impl<'a> CreateAccountLink<'a> { - pub fn new(account: &'a str, type_: CreateAccountLinkType) -> Self { - Self { - account, - collect: None, - collection_options: None, - expand: None, - refresh_url: None, - return_url: None, - type_, - } +impl<'a> CreateAccountLinkBuilder<'a> { + pub fn new(account: &'a str, type_: CreateAccountLinkBuilderType) -> Self { + Self { account, collect: None, expand: None, refresh_url: None, return_url: None, type_ } } } -/// The collect parameter is deprecated. Use `collection_options` instead. +/// Which information the platform needs to collect from the user. +/// One of `currently_due` or `eventually_due`. +/// Default is `currently_due`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountLinkCollect { +pub enum CreateAccountLinkBuilderCollect { CurrentlyDue, EventuallyDue, } -impl CreateAccountLinkCollect { +impl CreateAccountLinkBuilderCollect { pub fn as_str(self) -> &'static str { - use CreateAccountLinkCollect::*; + use CreateAccountLinkBuilderCollect::*; match self { CurrentlyDue => "currently_due", EventuallyDue => "eventually_due", @@ -53,10 +50,10 @@ impl CreateAccountLinkCollect { } } -impl std::str::FromStr for CreateAccountLinkCollect { +impl std::str::FromStr for CreateAccountLinkBuilderCollect { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountLinkCollect::*; + use CreateAccountLinkBuilderCollect::*; match s { "currently_due" => Ok(CurrentlyDue), "eventually_due" => Ok(EventuallyDue), @@ -64,18 +61,18 @@ impl std::str::FromStr for CreateAccountLinkCollect { } } } -impl std::fmt::Display for CreateAccountLinkCollect { +impl std::fmt::Display for CreateAccountLinkBuilderCollect { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountLinkCollect { +impl std::fmt::Debug for CreateAccountLinkBuilderCollect { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountLinkCollect { +impl serde::Serialize for CreateAccountLinkBuilderCollect { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -83,62 +80,46 @@ impl serde::Serialize for CreateAccountLinkCollect { serializer.serialize_str(self.as_str()) } } -/// Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountLinkCollectionOptions { - /// Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). - /// If you don't specify `collection_options`, the default value is `currently_due`. - pub fields: CreateAccountLinkCollectionOptionsFields, - /// Specifies whether the platform collects future_requirements in addition to requirements in Connect Onboarding. - /// The default value is `omit`. - #[serde(skip_serializing_if = "Option::is_none")] - pub future_requirements: Option, -} -impl CreateAccountLinkCollectionOptions { - pub fn new(fields: CreateAccountLinkCollectionOptionsFields) -> Self { - Self { fields, future_requirements: None } - } -} -/// Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). -/// If you don't specify `collection_options`, the default value is `currently_due`. +/// The type of account link the user is requesting. +/// Possible values are `account_onboarding` or `account_update`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountLinkCollectionOptionsFields { - CurrentlyDue, - EventuallyDue, +pub enum CreateAccountLinkBuilderType { + AccountOnboarding, + AccountUpdate, } -impl CreateAccountLinkCollectionOptionsFields { +impl CreateAccountLinkBuilderType { pub fn as_str(self) -> &'static str { - use CreateAccountLinkCollectionOptionsFields::*; + use CreateAccountLinkBuilderType::*; match self { - CurrentlyDue => "currently_due", - EventuallyDue => "eventually_due", + AccountOnboarding => "account_onboarding", + AccountUpdate => "account_update", } } } -impl std::str::FromStr for CreateAccountLinkCollectionOptionsFields { +impl std::str::FromStr for CreateAccountLinkBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountLinkCollectionOptionsFields::*; + use CreateAccountLinkBuilderType::*; match s { - "currently_due" => Ok(CurrentlyDue), - "eventually_due" => Ok(EventuallyDue), + "account_onboarding" => Ok(AccountOnboarding), + "account_update" => Ok(AccountUpdate), _ => Err(()), } } } -impl std::fmt::Display for CreateAccountLinkCollectionOptionsFields { +impl std::fmt::Display for CreateAccountLinkBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountLinkCollectionOptionsFields { +impl std::fmt::Debug for CreateAccountLinkBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountLinkCollectionOptionsFields { +impl serde::Serialize for CreateAccountLinkBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -146,103 +127,55 @@ impl serde::Serialize for CreateAccountLinkCollectionOptionsFields { serializer.serialize_str(self.as_str()) } } -/// Specifies whether the platform collects future_requirements in addition to requirements in Connect Onboarding. -/// The default value is `omit`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountLinkCollectionOptionsFutureRequirements { - Include, - Omit, -} -impl CreateAccountLinkCollectionOptionsFutureRequirements { - pub fn as_str(self) -> &'static str { - use CreateAccountLinkCollectionOptionsFutureRequirements::*; - match self { - Include => "include", - Omit => "omit", - } - } +/// Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccountLink<'a> { + inner: CreateAccountLinkBuilder<'a>, } - -impl std::str::FromStr for CreateAccountLinkCollectionOptionsFutureRequirements { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountLinkCollectionOptionsFutureRequirements::*; - match s { - "include" => Ok(Include), - "omit" => Ok(Omit), - _ => Err(()), - } +impl<'a> CreateAccountLink<'a> { + pub fn new(account: &'a str, type_: CreateAccountLinkBuilderType) -> Self { + Self { inner: CreateAccountLinkBuilder::new(account, type_) } } -} -impl std::fmt::Display for CreateAccountLinkCollectionOptionsFutureRequirements { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn collect(mut self, collect: CreateAccountLinkBuilderCollect) -> Self { + self.inner.collect = Some(collect); + self } -} -impl std::fmt::Debug for CreateAccountLinkCollectionOptionsFutureRequirements { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl serde::Serialize for CreateAccountLinkCollectionOptionsFutureRequirements { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The type of account link the user is requesting. -/// Possible values are `account_onboarding` or `account_update`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountLinkType { - AccountOnboarding, - AccountUpdate, -} -impl CreateAccountLinkType { - pub fn as_str(self) -> &'static str { - use CreateAccountLinkType::*; - match self { - AccountOnboarding => "account_onboarding", - AccountUpdate => "account_update", - } + + pub fn refresh_url(mut self, refresh_url: &'a str) -> Self { + self.inner.refresh_url = Some(refresh_url); + self } -} -impl std::str::FromStr for CreateAccountLinkType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountLinkType::*; - match s { - "account_onboarding" => Ok(AccountOnboarding), - "account_update" => Ok(AccountUpdate), - _ => Err(()), - } + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self } } -impl std::fmt::Display for CreateAccountLinkType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl CreateAccountLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::fmt::Debug for CreateAccountLinkType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize for CreateAccountLinkType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> CreateAccountLink<'a> { - /// Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/account_links", self, http_types::Method::Post) + +impl StripeRequest for CreateAccountLink<'_> { + type Output = stripe_connect::AccountLink; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/account_links").form(&self.inner) } } diff --git a/generated/stripe_connect/src/account_session/requests.rs b/generated/stripe_connect/src/account_session/requests.rs index 1cee91316..b96271c1a 100644 --- a/generated/stripe_connect/src/account_session/requests.rs +++ b/generated/stripe_connect/src/account_session/requests.rs @@ -1,127 +1,81 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountSession<'a> { +pub struct CreateAccountSessionBuilder<'a> { /// The identifier of the account to create an Account Session for. pub account: &'a str, /// Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. /// whether it has been enabled or not). - pub components: CreateAccountSessionComponents<'a>, + pub components: CreateAccountSessionBuilderComponents, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CreateAccountSession<'a> { - pub fn new(account: &'a str, components: CreateAccountSessionComponents<'a>) -> Self { +impl<'a> CreateAccountSessionBuilder<'a> { + pub fn new(account: &'a str, components: CreateAccountSessionBuilderComponents) -> Self { Self { account, components, expand: None } } } /// Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. /// whether it has been enabled or not). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSessionComponents<'a> { +pub struct CreateAccountSessionBuilderComponents { /// Configuration for the account onboarding embedded component. #[serde(skip_serializing_if = "Option::is_none")] - pub account_onboarding: Option>, - /// Configuration for the payment details embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_details: Option, - /// Configuration for the payments embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub payments: Option, - /// Configuration for the payouts embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub payouts: Option, + pub account_onboarding: Option, } -impl<'a> CreateAccountSessionComponents<'a> { +impl CreateAccountSessionBuilderComponents { pub fn new() -> Self { Self::default() } } /// Configuration for the account onboarding embedded component. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountSessionComponentsAccountOnboarding<'a> { +pub struct CreateAccountSessionBuilderComponentsAccountOnboarding { /// Whether the embedded component is enabled. pub enabled: bool, - /// The list of features enabled in the embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option<&'a serde_json::Value>, } -impl<'a> CreateAccountSessionComponentsAccountOnboarding<'a> { +impl CreateAccountSessionBuilderComponentsAccountOnboarding { pub fn new(enabled: bool) -> Self { - Self { enabled, features: None } + Self { enabled } } } -/// Configuration for the payouts embedded component. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountSessionComponentsPayouts { - /// Whether the embedded component is enabled. - pub enabled: bool, - /// The list of features enabled in the embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option, +/// Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccountSession<'a> { + inner: CreateAccountSessionBuilder<'a>, } -impl CreateAccountSessionComponentsPayouts { - pub fn new(enabled: bool) -> Self { - Self { enabled, features: None } +impl<'a> CreateAccountSession<'a> { + pub fn new(account: &'a str, components: CreateAccountSessionBuilderComponents) -> Self { + Self { inner: CreateAccountSessionBuilder::new(account, components) } } -} -/// The list of features enabled in the embedded component. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSessionComponentsPayoutsFeatures { - /// Whether to allow payout schedule to be changed. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - #[serde(skip_serializing_if = "Option::is_none")] - pub edit_payout_schedule: Option, - /// Whether to allow creation of instant payouts. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - #[serde(skip_serializing_if = "Option::is_none")] - pub instant_payouts: Option, - /// Whether to allow creation of standard payouts. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - #[serde(skip_serializing_if = "Option::is_none")] - pub standard_payouts: Option, -} -impl CreateAccountSessionComponentsPayoutsFeatures { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> CreateAccountSession<'a> { - /// Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access. - pub fn send( +impl CreateAccountSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/account_sessions", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PaymentsFeaturesParam { - /// Whether to allow capturing and cancelling payment intents. This is `true` by default. - #[serde(skip_serializing_if = "Option::is_none")] - pub capture_payments: Option, - /// Whether to allow responding to disputes, including submitting evidence and accepting disputes. - /// This is `true` by default. - #[serde(skip_serializing_if = "Option::is_none")] - pub dispute_management: Option, - /// Whether to allow sending refunds. This is `true` by default. - #[serde(skip_serializing_if = "Option::is_none")] - pub refund_management: Option, -} -impl PaymentsFeaturesParam { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PaymentsConfigParam { - /// Whether the embedded component is enabled. - pub enabled: bool, - /// The list of features enabled in the embedded component. - #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option, -} -impl PaymentsConfigParam { - pub fn new(enabled: bool) -> Self { - Self { enabled, features: None } + +impl StripeRequest for CreateAccountSession<'_> { + type Output = stripe_connect::AccountSession; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/account_sessions").form(&self.inner) } } diff --git a/generated/stripe_connect/src/application_fee/requests.rs b/generated/stripe_connect/src/application_fee/requests.rs index fd0430123..7ac714f89 100644 --- a/generated/stripe_connect/src/application_fee/requests.rs +++ b/generated/stripe_connect/src/application_fee/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListApplicationFee<'a> { +pub struct ListApplicationFeeBuilder<'a> { /// Only return application fees for the charge specified by this charge ID. #[serde(skip_serializing_if = "Option::is_none")] pub charge: Option<&'a str>, @@ -23,45 +27,122 @@ pub struct ListApplicationFee<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListApplicationFee<'a> { +impl<'a> ListApplicationFeeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of application fees you’ve previously collected. +/// The application fees are returned in sorted order, with the most recent fees appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListApplicationFee<'a> { + inner: ListApplicationFeeBuilder<'a>, +} impl<'a> ListApplicationFee<'a> { - /// Returns a list of application fees you’ve previously collected. - /// The application fees are returned in sorted order, with the most recent fees appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListApplicationFeeBuilder::new() } + } + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListApplicationFee<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/application_fees", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/application_fees", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListApplicationFee<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/application_fees").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveApplicationFee<'a> { +pub struct RetrieveApplicationFeeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveApplicationFee<'a> { +impl<'a> RetrieveApplicationFeeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an application fee that your account has collected. +/// The same information is returned when refunding the application fee. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveApplicationFee<'a> { + inner: RetrieveApplicationFeeBuilder<'a>, + id: &'a stripe_shared::ApplicationFeeId, +} impl<'a> RetrieveApplicationFee<'a> { - /// Retrieves the details of an application fee that your account has collected. - /// The same information is returned when refunding the application fee. - pub fn send( + pub fn new(id: &'a stripe_shared::ApplicationFeeId) -> Self { + Self { id, inner: RetrieveApplicationFeeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveApplicationFee<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_shared::ApplicationFeeId, - ) -> stripe::Response { - client.get_query(&format!("/application_fees/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveApplicationFee<'_> { + type Output = stripe_shared::ApplicationFee; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/application_fees/{id}")).query(&self.inner) } } diff --git a/generated/stripe_connect/src/application_fee_refund/requests.rs b/generated/stripe_connect/src/application_fee_refund/requests.rs index 116188b58..324664d6b 100644 --- a/generated/stripe_connect/src/application_fee_refund/requests.rs +++ b/generated/stripe_connect/src/application_fee_refund/requests.rs @@ -1,27 +1,88 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveApplicationFeeRefund<'a> { +pub struct CreateIdApplicationFeeRefundBuilder<'a> { + /// A positive integer, in _cents (or local equivalent)_, representing how much of this fee to refund. + /// Can refund only up to the remaining unrefunded amount of the fee. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> RetrieveApplicationFeeRefund<'a> { +impl<'a> CreateIdApplicationFeeRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveApplicationFeeRefund<'a> { - /// By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee. - pub fn send( +/// Refunds an application fee that has previously been collected but not yet refunded. +/// Funds will be refunded to the Stripe account from which the fee was originally collected. +/// +/// You can optionally refund only part of an application fee. +/// You can do so multiple times, until the entire fee has been refunded. +/// +/// Once entirely refunded, an application fee can’t be refunded again. +/// This method will raise an error when called on an already-refunded application fee, +/// or when trying to refund more money than is left on an application fee. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIdApplicationFeeRefund<'a> { + inner: CreateIdApplicationFeeRefundBuilder<'a>, + id: &'a stripe_shared::ApplicationFeeId, +} +impl<'a> CreateIdApplicationFeeRefund<'a> { + pub fn new(id: &'a stripe_shared::ApplicationFeeId) -> Self { + Self { id, inner: CreateIdApplicationFeeRefundBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateIdApplicationFeeRefund<'_> { + pub async fn send( &self, - client: &stripe::Client, - fee: &stripe_shared::ApplicationFeeId, - id: &str, - ) -> stripe::Response { - client.get_query(&format!("/application_fees/{fee}/refunds/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIdApplicationFeeRefund<'_> { + type Output = stripe_shared::ApplicationFeeRefund; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/application_fees/{id}/refunds")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIdApplicationFeeRefund<'a> { +pub struct ListIdApplicationFeeRefundBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -40,70 +101,123 @@ pub struct ListIdApplicationFeeRefund<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListIdApplicationFeeRefund<'a> { +impl<'a> ListIdApplicationFeeRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// You can see a list of the refunds belonging to a specific application fee. +/// Note that the 10 most recent refunds are always available by default on the application fee object. +/// If you need more than those 10, you can use this API method and the `limit` and `starting_after` parameters to page through additional refunds. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIdApplicationFeeRefund<'a> { + inner: ListIdApplicationFeeRefundBuilder<'a>, + id: &'a stripe_shared::ApplicationFeeId, +} impl<'a> ListIdApplicationFeeRefund<'a> { - /// You can see a list of the refunds belonging to a specific application fee. - /// Note that the 10 most recent refunds are always available by default on the application fee object. - /// If you need more than those 10, you can use this API method and the `limit` and `starting_after` parameters to page through additional refunds. - pub fn send( + pub fn new(id: &'a stripe_shared::ApplicationFeeId) -> Self { + Self { id, inner: ListIdApplicationFeeRefundBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListIdApplicationFeeRefund<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_shared::ApplicationFeeId, - ) -> stripe::Response> { - client.get_query(&format!("/application_fees/{id}/refunds"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - id: &stripe_shared::ApplicationFeeId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/application_fees/{id}/refunds"), self) +} + +impl StripeRequest for ListIdApplicationFeeRefund<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/application_fees/{id}/refunds")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateApplicationFeeRefund<'a> { +pub struct RetrieveApplicationFeeRefundBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateApplicationFeeRefund<'a> { +impl<'a> RetrieveApplicationFeeRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdateApplicationFeeRefund<'a> { - /// Updates the specified application fee refund by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// - /// This request only accepts metadata as an argument. - pub fn send( +/// By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveApplicationFeeRefund<'a> { + inner: RetrieveApplicationFeeRefundBuilder<'a>, + fee: &'a stripe_shared::ApplicationFeeId, + id: &'a str, +} +impl<'a> RetrieveApplicationFeeRefund<'a> { + pub fn new(fee: &'a stripe_shared::ApplicationFeeId, id: &'a str) -> Self { + Self { fee, id, inner: RetrieveApplicationFeeRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveApplicationFeeRefund<'_> { + pub async fn send( &self, - client: &stripe::Client, - fee: &stripe_shared::ApplicationFeeId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/application_fees/{fee}/refunds/{id}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveApplicationFeeRefund<'_> { + type Output = stripe_shared::ApplicationFeeRefund; + + fn build(&self) -> RequestBuilder { + let fee = self.fee; + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/application_fees/{fee}/refunds/{id}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIdApplicationFeeRefund<'a> { - /// A positive integer, in _cents (or local equivalent)_, representing how much of this fee to refund. - /// Can refund only up to the remaining unrefunded amount of the fee. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, +pub struct UpdateApplicationFeeRefundBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -114,26 +228,58 @@ pub struct CreateIdApplicationFeeRefund<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateIdApplicationFeeRefund<'a> { +impl<'a> UpdateApplicationFeeRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CreateIdApplicationFeeRefund<'a> { - /// Refunds an application fee that has previously been collected but not yet refunded. - /// Funds will be refunded to the Stripe account from which the fee was originally collected. - /// - /// You can optionally refund only part of an application fee. - /// You can do so multiple times, until the entire fee has been refunded. - /// - /// Once entirely refunded, an application fee can’t be refunded again. - /// This method will raise an error when called on an already-refunded application fee, - /// or when trying to refund more money than is left on an application fee. - pub fn send( +/// Updates the specified application fee refund by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// +/// This request only accepts metadata as an argument. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateApplicationFeeRefund<'a> { + inner: UpdateApplicationFeeRefundBuilder<'a>, + fee: &'a stripe_shared::ApplicationFeeId, + id: &'a str, +} +impl<'a> UpdateApplicationFeeRefund<'a> { + pub fn new(fee: &'a stripe_shared::ApplicationFeeId, id: &'a str) -> Self { + Self { fee, id, inner: UpdateApplicationFeeRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateApplicationFeeRefund<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_shared::ApplicationFeeId, - ) -> stripe::Response { - client.send_form(&format!("/application_fees/{id}/refunds"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateApplicationFeeRefund<'_> { + type Output = stripe_shared::ApplicationFeeRefund; + + fn build(&self) -> RequestBuilder { + let fee = self.fee; + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/application_fees/{fee}/refunds/{id}")) + .form(&self.inner) } } diff --git a/generated/stripe_connect/src/apps_secret/requests.rs b/generated/stripe_connect/src/apps_secret/requests.rs index b07f8cc58..43e8f4442 100644 --- a/generated/stripe_connect/src/apps_secret/requests.rs +++ b/generated/stripe_connect/src/apps_secret/requests.rs @@ -1,57 +1,49 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListAppsSecret<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct FindAppsSecretBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + /// A name for the secret that's unique within the scope. + pub name: &'a str, /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. - pub scope: ListAppsSecretScope<'a>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, + pub scope: FindAppsSecretBuilderScope<'a>, } -impl<'a> ListAppsSecret<'a> { - pub fn new(scope: ListAppsSecretScope<'a>) -> Self { - Self { ending_before: None, expand: None, limit: None, scope, starting_after: None } +impl<'a> FindAppsSecretBuilder<'a> { + pub fn new(name: &'a str, scope: FindAppsSecretBuilderScope<'a>) -> Self { + Self { expand: None, name, scope } } } /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListAppsSecretScope<'a> { +pub struct FindAppsSecretBuilderScope<'a> { /// The secret scope type. #[serde(rename = "type")] - pub type_: ListAppsSecretScopeType, + pub type_: FindAppsSecretBuilderScopeType, /// The user ID. /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`. #[serde(skip_serializing_if = "Option::is_none")] pub user: Option<&'a str>, } -impl<'a> ListAppsSecretScope<'a> { - pub fn new(type_: ListAppsSecretScopeType) -> Self { +impl<'a> FindAppsSecretBuilderScope<'a> { + pub fn new(type_: FindAppsSecretBuilderScopeType) -> Self { Self { type_, user: None } } } /// The secret scope type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListAppsSecretScopeType { +pub enum FindAppsSecretBuilderScopeType { Account, User, } -impl ListAppsSecretScopeType { +impl FindAppsSecretBuilderScopeType { pub fn as_str(self) -> &'static str { - use ListAppsSecretScopeType::*; + use FindAppsSecretBuilderScopeType::*; match self { Account => "account", User => "user", @@ -59,10 +51,10 @@ impl ListAppsSecretScopeType { } } -impl std::str::FromStr for ListAppsSecretScopeType { +impl std::str::FromStr for FindAppsSecretBuilderScopeType { type Err = (); fn from_str(s: &str) -> Result { - use ListAppsSecretScopeType::*; + use FindAppsSecretBuilderScopeType::*; match s { "account" => Ok(Account), "user" => Ok(User), @@ -70,18 +62,18 @@ impl std::str::FromStr for ListAppsSecretScopeType { } } } -impl std::fmt::Display for ListAppsSecretScopeType { +impl std::fmt::Display for FindAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListAppsSecretScopeType { +impl std::fmt::Debug for FindAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListAppsSecretScopeType { +impl serde::Serialize for FindAppsSecretBuilderScopeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -89,60 +81,90 @@ impl serde::Serialize for ListAppsSecretScopeType { serializer.serialize_str(self.as_str()) } } -impl<'a> ListAppsSecret<'a> { - /// List all secrets stored on the given scope. - pub fn send( +/// Finds a secret in the secret store by name and scope. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FindAppsSecret<'a> { + inner: FindAppsSecretBuilder<'a>, +} +impl<'a> FindAppsSecret<'a> { + pub fn new(name: &'a str, scope: FindAppsSecretBuilderScope<'a>) -> Self { + Self { inner: FindAppsSecretBuilder::new(name, scope) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl FindAppsSecret<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/apps/secrets", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/apps/secrets", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FindAppsSecret<'_> { + type Output = stripe_connect::AppsSecret; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/apps/secrets/find").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct FindAppsSecret<'a> { +pub struct CreateAppsSecretBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// The Unix timestamp for the expiry time of the secret, after which the secret deletes. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_at: Option, /// A name for the secret that's unique within the scope. pub name: &'a str, + /// The plaintext secret value to be stored. + pub payload: &'a str, /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. - pub scope: FindAppsSecretScope<'a>, + pub scope: CreateAppsSecretBuilderScope<'a>, } -impl<'a> FindAppsSecret<'a> { - pub fn new(name: &'a str, scope: FindAppsSecretScope<'a>) -> Self { - Self { expand: None, name, scope } +impl<'a> CreateAppsSecretBuilder<'a> { + pub fn new(name: &'a str, payload: &'a str, scope: CreateAppsSecretBuilderScope<'a>) -> Self { + Self { expand: None, expires_at: None, name, payload, scope } } } /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct FindAppsSecretScope<'a> { +pub struct CreateAppsSecretBuilderScope<'a> { /// The secret scope type. #[serde(rename = "type")] - pub type_: FindAppsSecretScopeType, + pub type_: CreateAppsSecretBuilderScopeType, /// The user ID. /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`. #[serde(skip_serializing_if = "Option::is_none")] pub user: Option<&'a str>, } -impl<'a> FindAppsSecretScope<'a> { - pub fn new(type_: FindAppsSecretScopeType) -> Self { +impl<'a> CreateAppsSecretBuilderScope<'a> { + pub fn new(type_: CreateAppsSecretBuilderScopeType) -> Self { Self { type_, user: None } } } /// The secret scope type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum FindAppsSecretScopeType { +pub enum CreateAppsSecretBuilderScopeType { Account, User, } -impl FindAppsSecretScopeType { +impl CreateAppsSecretBuilderScopeType { pub fn as_str(self) -> &'static str { - use FindAppsSecretScopeType::*; + use CreateAppsSecretBuilderScopeType::*; match self { Account => "account", User => "user", @@ -150,10 +172,10 @@ impl FindAppsSecretScopeType { } } -impl std::str::FromStr for FindAppsSecretScopeType { +impl std::str::FromStr for CreateAppsSecretBuilderScopeType { type Err = (); fn from_str(s: &str) -> Result { - use FindAppsSecretScopeType::*; + use CreateAppsSecretBuilderScopeType::*; match s { "account" => Ok(Account), "user" => Ok(User), @@ -161,18 +183,18 @@ impl std::str::FromStr for FindAppsSecretScopeType { } } } -impl std::fmt::Display for FindAppsSecretScopeType { +impl std::fmt::Display for CreateAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for FindAppsSecretScopeType { +impl std::fmt::Debug for CreateAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for FindAppsSecretScopeType { +impl serde::Serialize for CreateAppsSecretBuilderScopeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -180,59 +202,90 @@ impl serde::Serialize for FindAppsSecretScopeType { serializer.serialize_str(self.as_str()) } } -impl<'a> FindAppsSecret<'a> { - /// Finds a secret in the secret store by name and scope. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/apps/secrets/find", self) +/// Create or replace a secret in the secret store. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAppsSecret<'a> { + inner: CreateAppsSecretBuilder<'a>, +} +impl<'a> CreateAppsSecret<'a> { + pub fn new(name: &'a str, payload: &'a str, scope: CreateAppsSecretBuilderScope<'a>) -> Self { + Self { inner: CreateAppsSecretBuilder::new(name, payload, scope) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } +} +impl CreateAppsSecret<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateAppsSecret<'_> { + type Output = stripe_connect::AppsSecret; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/apps/secrets").form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAppsSecret<'a> { +pub struct DeleteWhereAppsSecretBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The Unix timestamp for the expiry time of the secret, after which the secret deletes. - #[serde(skip_serializing_if = "Option::is_none")] - pub expires_at: Option, /// A name for the secret that's unique within the scope. pub name: &'a str, - /// The plaintext secret value to be stored. - pub payload: &'a str, /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. - pub scope: CreateAppsSecretScope<'a>, + pub scope: DeleteWhereAppsSecretBuilderScope<'a>, } -impl<'a> CreateAppsSecret<'a> { - pub fn new(name: &'a str, payload: &'a str, scope: CreateAppsSecretScope<'a>) -> Self { - Self { expand: None, expires_at: None, name, payload, scope } +impl<'a> DeleteWhereAppsSecretBuilder<'a> { + pub fn new(name: &'a str, scope: DeleteWhereAppsSecretBuilderScope<'a>) -> Self { + Self { expand: None, name, scope } } } /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAppsSecretScope<'a> { +pub struct DeleteWhereAppsSecretBuilderScope<'a> { /// The secret scope type. #[serde(rename = "type")] - pub type_: CreateAppsSecretScopeType, + pub type_: DeleteWhereAppsSecretBuilderScopeType, /// The user ID. /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`. #[serde(skip_serializing_if = "Option::is_none")] pub user: Option<&'a str>, } -impl<'a> CreateAppsSecretScope<'a> { - pub fn new(type_: CreateAppsSecretScopeType) -> Self { +impl<'a> DeleteWhereAppsSecretBuilderScope<'a> { + pub fn new(type_: DeleteWhereAppsSecretBuilderScopeType) -> Self { Self { type_, user: None } } } /// The secret scope type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAppsSecretScopeType { +pub enum DeleteWhereAppsSecretBuilderScopeType { Account, User, } -impl CreateAppsSecretScopeType { +impl DeleteWhereAppsSecretBuilderScopeType { pub fn as_str(self) -> &'static str { - use CreateAppsSecretScopeType::*; + use DeleteWhereAppsSecretBuilderScopeType::*; match self { Account => "account", User => "user", @@ -240,10 +293,10 @@ impl CreateAppsSecretScopeType { } } -impl std::str::FromStr for CreateAppsSecretScopeType { +impl std::str::FromStr for DeleteWhereAppsSecretBuilderScopeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateAppsSecretScopeType::*; + use DeleteWhereAppsSecretBuilderScopeType::*; match s { "account" => Ok(Account), "user" => Ok(User), @@ -251,18 +304,18 @@ impl std::str::FromStr for CreateAppsSecretScopeType { } } } -impl std::fmt::Display for CreateAppsSecretScopeType { +impl std::fmt::Display for DeleteWhereAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAppsSecretScopeType { +impl std::fmt::Debug for DeleteWhereAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAppsSecretScopeType { +impl serde::Serialize for DeleteWhereAppsSecretBuilderScopeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -270,54 +323,97 @@ impl serde::Serialize for CreateAppsSecretScopeType { serializer.serialize_str(self.as_str()) } } -impl<'a> CreateAppsSecret<'a> { - /// Create or replace a secret in the secret store. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/apps/secrets", self, http_types::Method::Post) +/// Deletes a secret from the secret store by name and scope. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteWhereAppsSecret<'a> { + inner: DeleteWhereAppsSecretBuilder<'a>, +} +impl<'a> DeleteWhereAppsSecret<'a> { + pub fn new(name: &'a str, scope: DeleteWhereAppsSecretBuilderScope<'a>) -> Self { + Self { inner: DeleteWhereAppsSecretBuilder::new(name, scope) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DeleteWhereAppsSecret<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteWhereAppsSecret<'_> { + type Output = stripe_connect::AppsSecret; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/apps/secrets/delete").form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct DeleteWhereAppsSecret<'a> { +pub struct ListAppsSecretBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A name for the secret that's unique within the scope. - pub name: &'a str, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. - pub scope: DeleteWhereAppsSecretScope<'a>, + pub scope: ListAppsSecretBuilderScope<'a>, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, } -impl<'a> DeleteWhereAppsSecret<'a> { - pub fn new(name: &'a str, scope: DeleteWhereAppsSecretScope<'a>) -> Self { - Self { expand: None, name, scope } +impl<'a> ListAppsSecretBuilder<'a> { + pub fn new(scope: ListAppsSecretBuilderScope<'a>) -> Self { + Self { ending_before: None, expand: None, limit: None, scope, starting_after: None } } } /// Specifies the scoping of the secret. /// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct DeleteWhereAppsSecretScope<'a> { +pub struct ListAppsSecretBuilderScope<'a> { /// The secret scope type. #[serde(rename = "type")] - pub type_: DeleteWhereAppsSecretScopeType, + pub type_: ListAppsSecretBuilderScopeType, /// The user ID. /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`. #[serde(skip_serializing_if = "Option::is_none")] pub user: Option<&'a str>, } -impl<'a> DeleteWhereAppsSecretScope<'a> { - pub fn new(type_: DeleteWhereAppsSecretScopeType) -> Self { +impl<'a> ListAppsSecretBuilderScope<'a> { + pub fn new(type_: ListAppsSecretBuilderScopeType) -> Self { Self { type_, user: None } } } /// The secret scope type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum DeleteWhereAppsSecretScopeType { +pub enum ListAppsSecretBuilderScopeType { Account, User, } -impl DeleteWhereAppsSecretScopeType { +impl ListAppsSecretBuilderScopeType { pub fn as_str(self) -> &'static str { - use DeleteWhereAppsSecretScopeType::*; + use ListAppsSecretBuilderScopeType::*; match self { Account => "account", User => "user", @@ -325,10 +421,10 @@ impl DeleteWhereAppsSecretScopeType { } } -impl std::str::FromStr for DeleteWhereAppsSecretScopeType { +impl std::str::FromStr for ListAppsSecretBuilderScopeType { type Err = (); fn from_str(s: &str) -> Result { - use DeleteWhereAppsSecretScopeType::*; + use ListAppsSecretBuilderScopeType::*; match s { "account" => Ok(Account), "user" => Ok(User), @@ -336,18 +432,18 @@ impl std::str::FromStr for DeleteWhereAppsSecretScopeType { } } } -impl std::fmt::Display for DeleteWhereAppsSecretScopeType { +impl std::fmt::Display for ListAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for DeleteWhereAppsSecretScopeType { +impl std::fmt::Debug for ListAppsSecretBuilderScopeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for DeleteWhereAppsSecretScopeType { +impl serde::Serialize for ListAppsSecretBuilderScopeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -355,9 +451,55 @@ impl serde::Serialize for DeleteWhereAppsSecretScopeType { serializer.serialize_str(self.as_str()) } } -impl<'a> DeleteWhereAppsSecret<'a> { - /// Deletes a secret from the secret store by name and scope. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/apps/secrets/delete", self, http_types::Method::Post) +/// List all secrets stored on the given scope. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListAppsSecret<'a> { + inner: ListAppsSecretBuilder<'a>, +} +impl<'a> ListAppsSecret<'a> { + pub fn new(scope: ListAppsSecretBuilderScope<'a>) -> Self { + Self { inner: ListAppsSecretBuilder::new(scope) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListAppsSecret<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListAppsSecret<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/apps/secrets").query(&self.inner) } } diff --git a/generated/stripe_connect/src/capability/requests.rs b/generated/stripe_connect/src/capability/requests.rs index f7e1496d2..e999e9278 100644 --- a/generated/stripe_connect/src/capability/requests.rs +++ b/generated/stripe_connect/src/capability/requests.rs @@ -1,55 +1,117 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccountCapability<'a> { +pub struct ListAccountCapabilityBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ListAccountCapability<'a> { +impl<'a> ListAccountCapabilityBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of capabilities associated with the account. +/// The capabilities are returned sorted by creation date, with the most recent capability appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListAccountCapability<'a> { + inner: ListAccountCapabilityBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> ListAccountCapability<'a> { - /// Returns a list of capabilities associated with the account. - /// The capabilities are returned sorted by creation date, with the most recent capability appearing first. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: ListAccountCapabilityBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ListAccountCapability<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/capabilities"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/capabilities"), self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListAccountCapability<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/capabilities")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCapability<'a> { +pub struct RetrieveCapabilityBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveCapability<'a> { +impl<'a> RetrieveCapabilityBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves information about the specified Account Capability. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCapability<'a> { + inner: RetrieveCapabilityBuilder<'a>, + account: &'a stripe_shared::AccountId, + capability: &'a str, +} impl<'a> RetrieveCapability<'a> { - /// Retrieves information about the specified Account Capability. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, capability: &'a str) -> Self { + Self { account, capability, inner: RetrieveCapabilityBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCapability<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - capability: &str, - ) -> stripe::Response { - client.get_query(&format!("/accounts/{account}/capabilities/{capability}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCapability<'_> { + type Output = stripe_shared::Capability; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let capability = self.capability; + RequestBuilder::new( + StripeMethod::Get, + format!("/accounts/{account}/capabilities/{capability}"), + ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCapability<'a> { +pub struct UpdateCapabilityBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -63,24 +125,59 @@ pub struct UpdateCapability<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub requested: Option, } -impl<'a> UpdateCapability<'a> { +impl<'a> UpdateCapabilityBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates an existing Account Capability. +/// Request or remove a capability by updating its `requested` parameter. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCapability<'a> { + inner: UpdateCapabilityBuilder<'a>, + account: &'a stripe_shared::AccountId, + capability: &'a str, +} impl<'a> UpdateCapability<'a> { - /// Updates an existing Account Capability. - /// Request or remove a capability by updating its `requested` parameter. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, capability: &'a str) -> Self { + Self { account, capability, inner: UpdateCapabilityBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn requested(mut self, requested: bool) -> Self { + self.inner.requested = Some(requested); + self + } +} +impl UpdateCapability<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - capability: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/capabilities/{capability}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCapability<'_> { + type Output = stripe_shared::Capability; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let capability = self.capability; + RequestBuilder::new( + StripeMethod::Post, + format!("/accounts/{account}/capabilities/{capability}"), ) + .form(&self.inner) } } diff --git a/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs b/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs index ff3f3181d..de67ac2fd 100644 --- a/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs +++ b/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs @@ -1,7 +1,4 @@ #[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct ConnectEmbeddedAccountSessionCreateComponents { pub account_onboarding: stripe_connect::ConnectEmbeddedBaseConfigClaim, - pub payment_details: stripe_connect::ConnectEmbeddedPaymentsConfig, - pub payments: stripe_connect::ConnectEmbeddedPaymentsConfig, - pub payouts: stripe_connect::ConnectEmbeddedPayoutsConfig, } diff --git a/generated/stripe_connect/src/connect_embedded_base_config_claim.rs b/generated/stripe_connect/src/connect_embedded_base_config_claim.rs index 19818fc01..ce4ea0f44 100644 --- a/generated/stripe_connect/src/connect_embedded_base_config_claim.rs +++ b/generated/stripe_connect/src/connect_embedded_base_config_claim.rs @@ -2,5 +2,4 @@ pub struct ConnectEmbeddedBaseConfigClaim { /// Whether the embedded component is enabled. pub enabled: bool, - pub features: stripe_connect::ConnectEmbeddedBaseFeatures, } diff --git a/generated/stripe_connect/src/connect_embedded_base_features.rs b/generated/stripe_connect/src/connect_embedded_base_features.rs deleted file mode 100644 index ed9dae237..000000000 --- a/generated/stripe_connect/src/connect_embedded_base_features.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct ConnectEmbeddedBaseFeatures {} diff --git a/generated/stripe_connect/src/connect_embedded_payments_config.rs b/generated/stripe_connect/src/connect_embedded_payments_config.rs deleted file mode 100644 index 9279b697d..000000000 --- a/generated/stripe_connect/src/connect_embedded_payments_config.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ConnectEmbeddedPaymentsConfig { - /// Whether the embedded component is enabled. - pub enabled: bool, - pub features: stripe_connect::ConnectEmbeddedPaymentsFeatures, -} diff --git a/generated/stripe_connect/src/connect_embedded_payments_features.rs b/generated/stripe_connect/src/connect_embedded_payments_features.rs deleted file mode 100644 index 7f5bc6721..000000000 --- a/generated/stripe_connect/src/connect_embedded_payments_features.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ConnectEmbeddedPaymentsFeatures { - /// Whether to allow capturing and cancelling payment intents. This is `true` by default. - pub capture_payments: bool, - /// Whether to allow responding to disputes, including submitting evidence and accepting disputes. - /// This is `true` by default. - pub dispute_management: bool, - /// Whether to allow sending refunds. This is `true` by default. - pub refund_management: bool, -} diff --git a/generated/stripe_connect/src/connect_embedded_payouts_config.rs b/generated/stripe_connect/src/connect_embedded_payouts_config.rs deleted file mode 100644 index 7d4856264..000000000 --- a/generated/stripe_connect/src/connect_embedded_payouts_config.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ConnectEmbeddedPayoutsConfig { - /// Whether the embedded component is enabled. - pub enabled: bool, - pub features: stripe_connect::ConnectEmbeddedPayoutsFeatures, -} diff --git a/generated/stripe_connect/src/connect_embedded_payouts_features.rs b/generated/stripe_connect/src/connect_embedded_payouts_features.rs deleted file mode 100644 index 0384aa102..000000000 --- a/generated/stripe_connect/src/connect_embedded_payouts_features.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ConnectEmbeddedPayoutsFeatures { - /// Whether to allow payout schedule to be changed. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - pub edit_payout_schedule: bool, - /// Whether to allow creation of instant payouts. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - pub instant_payouts: bool, - /// Whether to allow creation of standard payouts. - /// Default `true` when Stripe owns Loss Liability, default `false` otherwise. - pub standard_payouts: bool, -} diff --git a/generated/stripe_connect/src/country_spec/requests.rs b/generated/stripe_connect/src/country_spec/requests.rs index 2bf2b8251..66f95e2fe 100644 --- a/generated/stripe_connect/src/country_spec/requests.rs +++ b/generated/stripe_connect/src/country_spec/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCountrySpec<'a> { +pub struct ListCountrySpecBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,43 +22,111 @@ pub struct ListCountrySpec<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCountrySpec<'a> { +impl<'a> ListCountrySpecBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Lists all Country Spec objects available in the API. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCountrySpec<'a> { + inner: ListCountrySpecBuilder<'a>, +} impl<'a> ListCountrySpec<'a> { - /// Lists all Country Spec objects available in the API. - pub fn send( + pub fn new() -> Self { + Self { inner: ListCountrySpecBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListCountrySpec<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/country_specs", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/country_specs", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCountrySpec<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/country_specs").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCountrySpec<'a> { +pub struct RetrieveCountrySpecBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveCountrySpec<'a> { +impl<'a> RetrieveCountrySpecBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a Country Spec for a given Country code. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCountrySpec<'a> { + inner: RetrieveCountrySpecBuilder<'a>, + country: &'a stripe_connect::CountrySpecId, +} impl<'a> RetrieveCountrySpec<'a> { - /// Returns a Country Spec for a given Country code. - pub fn send( + pub fn new(country: &'a stripe_connect::CountrySpecId) -> Self { + Self { country, inner: RetrieveCountrySpecBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCountrySpec<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - country: &stripe_connect::CountrySpecId, - ) -> stripe::Response { - client.get_query(&format!("/country_specs/{country}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCountrySpec<'_> { + type Output = stripe_connect::CountrySpec; + + fn build(&self) -> RequestBuilder { + let country = self.country; + RequestBuilder::new(StripeMethod::Get, format!("/country_specs/{country}")) + .query(&self.inner) } } diff --git a/generated/stripe_connect/src/external_account/requests.rs b/generated/stripe_connect/src/external_account/requests.rs index b11194fdd..a54598ae9 100644 --- a/generated/stripe_connect/src/external_account/requests.rs +++ b/generated/stripe_connect/src/external_account/requests.rs @@ -1,27 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteExternalAccount {} -impl DeleteExternalAccount { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteExternalAccount { - /// Delete a specified external account for a given account. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccountExternalAccount<'a> { +pub struct ListAccountExternalAccountBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -36,27 +18,27 @@ pub struct ListAccountExternalAccount<'a> { pub limit: Option, /// Filter external accounts according to a particular object type. #[serde(skip_serializing_if = "Option::is_none")] - pub object: Option, + pub object: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListAccountExternalAccount<'a> { +impl<'a> ListAccountExternalAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Filter external accounts according to a particular object type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListAccountExternalAccountObject { +pub enum ListAccountExternalAccountBuilderObject { BankAccount, Card, } -impl ListAccountExternalAccountObject { +impl ListAccountExternalAccountBuilderObject { pub fn as_str(self) -> &'static str { - use ListAccountExternalAccountObject::*; + use ListAccountExternalAccountBuilderObject::*; match self { BankAccount => "bank_account", Card => "card", @@ -64,10 +46,10 @@ impl ListAccountExternalAccountObject { } } -impl std::str::FromStr for ListAccountExternalAccountObject { +impl std::str::FromStr for ListAccountExternalAccountBuilderObject { type Err = (); fn from_str(s: &str) -> Result { - use ListAccountExternalAccountObject::*; + use ListAccountExternalAccountBuilderObject::*; match s { "bank_account" => Ok(BankAccount), "card" => Ok(Card), @@ -75,18 +57,18 @@ impl std::str::FromStr for ListAccountExternalAccountObject { } } } -impl std::fmt::Display for ListAccountExternalAccountObject { +impl std::fmt::Display for ListAccountExternalAccountBuilderObject { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListAccountExternalAccountObject { +impl std::fmt::Debug for ListAccountExternalAccountBuilderObject { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListAccountExternalAccountObject { +impl serde::Serialize for ListAccountExternalAccountBuilderObject { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -94,49 +76,124 @@ impl serde::Serialize for ListAccountExternalAccountObject { serializer.serialize_str(self.as_str()) } } +/// List external accounts for an account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListAccountExternalAccount<'a> { + inner: ListAccountExternalAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> ListAccountExternalAccount<'a> { - /// List external accounts for an account. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: ListAccountExternalAccountBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn object(mut self, object: ListAccountExternalAccountBuilderObject) -> Self { + self.inner.object = Some(object); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListAccountExternalAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/external_accounts"), self) - } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/accounts/{account}/external_accounts"), - self, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListAccountExternalAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/external_accounts")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveExternalAccount<'a> { +pub struct RetrieveExternalAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveExternalAccount<'a> { +impl<'a> RetrieveExternalAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieve a specified external account for a given account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveExternalAccount<'a> { + inner: RetrieveExternalAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, + id: &'a str, +} impl<'a> RetrieveExternalAccount<'a> { - /// Retrieve a specified external account for a given account. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id, inner: RetrieveExternalAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveExternalAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.get_query(&format!("/accounts/{account}/external_accounts/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveExternalAccount<'_> { + type Output = stripe_shared::ExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Get, + format!("/accounts/{account}/external_accounts/{id}"), + ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountExternalAccount<'a> { +pub struct CreateAccountExternalAccountBuilder<'a> { /// When set to true, or if this is the first external account added in this currency, this account becomes the default external account for its currency. #[serde(skip_serializing_if = "Option::is_none")] pub default_for_currency: Option, @@ -152,38 +209,74 @@ pub struct CreateAccountExternalAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateAccountExternalAccount<'a> { +impl<'a> CreateAccountExternalAccountBuilder<'a> { pub fn new(external_account: &'a str) -> Self { Self { default_for_currency: None, expand: None, external_account, metadata: None } } } +/// Create an external account for a given account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccountExternalAccount<'a> { + inner: CreateAccountExternalAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> CreateAccountExternalAccount<'a> { - /// Create an external account for a given account. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, external_account: &'a str) -> Self { + Self { account, inner: CreateAccountExternalAccountBuilder::new(external_account) } + } + pub fn default_for_currency(mut self, default_for_currency: bool) -> Self { + self.inner.default_for_currency = Some(default_for_currency); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateAccountExternalAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateAccountExternalAccount<'_> { + type Output = stripe_shared::ExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}/external_accounts")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateExternalAccount<'a> { +pub struct UpdateExternalAccountBuilder<'a> { /// The name of the person or business that owns the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, /// The type of entity that holds the account. This can be either `individual` or `company`. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// 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, + pub account_type: Option, /// City/District/Suburb/Town/Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -207,7 +300,7 @@ pub struct UpdateExternalAccount<'a> { pub default_for_currency: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, + pub documents: Option>, /// Two digit number representing the card’s expiration month. #[serde(skip_serializing_if = "Option::is_none")] pub exp_month: Option<&'a str>, @@ -227,20 +320,20 @@ pub struct UpdateExternalAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, } -impl<'a> UpdateExternalAccount<'a> { +impl<'a> UpdateExternalAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The type of entity that holds the account. This can be either `individual` or `company`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateExternalAccountAccountHolderType { +pub enum UpdateExternalAccountBuilderAccountHolderType { Company, Individual, } -impl UpdateExternalAccountAccountHolderType { +impl UpdateExternalAccountBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateExternalAccountAccountHolderType::*; + use UpdateExternalAccountBuilderAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -248,10 +341,10 @@ impl UpdateExternalAccountAccountHolderType { } } -impl std::str::FromStr for UpdateExternalAccountAccountHolderType { +impl std::str::FromStr for UpdateExternalAccountBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateExternalAccountAccountHolderType::*; + use UpdateExternalAccountBuilderAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -259,18 +352,18 @@ impl std::str::FromStr for UpdateExternalAccountAccountHolderType { } } } -impl std::fmt::Display for UpdateExternalAccountAccountHolderType { +impl std::fmt::Display for UpdateExternalAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateExternalAccountAccountHolderType { +impl std::fmt::Debug for UpdateExternalAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateExternalAccountAccountHolderType { +impl serde::Serialize for UpdateExternalAccountBuilderAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -282,15 +375,15 @@ impl serde::Serialize for UpdateExternalAccountAccountHolderType { /// This can only be `checking` or `savings` in most countries. /// In Japan, this can only be `futsu` or `toza`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateExternalAccountAccountType { +pub enum UpdateExternalAccountBuilderAccountType { Checking, Futsu, Savings, Toza, } -impl UpdateExternalAccountAccountType { +impl UpdateExternalAccountBuilderAccountType { pub fn as_str(self) -> &'static str { - use UpdateExternalAccountAccountType::*; + use UpdateExternalAccountBuilderAccountType::*; match self { Checking => "checking", Futsu => "futsu", @@ -300,10 +393,10 @@ impl UpdateExternalAccountAccountType { } } -impl std::str::FromStr for UpdateExternalAccountAccountType { +impl std::str::FromStr for UpdateExternalAccountBuilderAccountType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateExternalAccountAccountType::*; + use UpdateExternalAccountBuilderAccountType::*; match s { "checking" => Ok(Checking), "futsu" => Ok(Futsu), @@ -313,18 +406,18 @@ impl std::str::FromStr for UpdateExternalAccountAccountType { } } } -impl std::fmt::Display for UpdateExternalAccountAccountType { +impl std::fmt::Display for UpdateExternalAccountBuilderAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateExternalAccountAccountType { +impl std::fmt::Debug for UpdateExternalAccountBuilderAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateExternalAccountAccountType { +impl serde::Serialize for UpdateExternalAccountBuilderAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -334,14 +427,14 @@ impl serde::Serialize for UpdateExternalAccountAccountType { } /// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateExternalAccountDocuments<'a> { +pub struct UpdateExternalAccountBuilderDocuments<'a> { /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[serde(skip_serializing_if = "Option::is_none")] pub bank_account_ownership_verification: - Option>, + Option>, } -impl<'a> UpdateExternalAccountDocuments<'a> { +impl<'a> UpdateExternalAccountBuilderDocuments<'a> { pub fn new() -> Self { Self::default() } @@ -349,31 +442,178 @@ impl<'a> UpdateExternalAccountDocuments<'a> { /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateExternalAccountDocumentsBankAccountOwnershipVerification<'a> { +pub struct UpdateExternalAccountBuilderDocumentsBankAccountOwnershipVerification<'a> { /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. #[serde(skip_serializing_if = "Option::is_none")] pub files: Option<&'a [&'a str]>, } -impl<'a> UpdateExternalAccountDocumentsBankAccountOwnershipVerification<'a> { +impl<'a> UpdateExternalAccountBuilderDocumentsBankAccountOwnershipVerification<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. +/// Other bank account details are not editable by design. +/// +/// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateExternalAccount<'a> { + inner: UpdateExternalAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, + id: &'a str, +} impl<'a> UpdateExternalAccount<'a> { - /// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. - /// Other bank account details are not editable by design. - /// - /// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id, inner: UpdateExternalAccountBuilder::new() } + } + pub fn account_holder_name(mut self, account_holder_name: &'a str) -> Self { + self.inner.account_holder_name = Some(account_holder_name); + self + } + + pub fn account_holder_type( + mut self, + account_holder_type: UpdateExternalAccountBuilderAccountHolderType, + ) -> Self { + self.inner.account_holder_type = Some(account_holder_type); + self + } + + pub fn account_type(mut self, account_type: UpdateExternalAccountBuilderAccountType) -> Self { + self.inner.account_type = Some(account_type); + self + } + + pub fn address_city(mut self, address_city: &'a str) -> Self { + self.inner.address_city = Some(address_city); + self + } + + pub fn address_country(mut self, address_country: &'a str) -> Self { + self.inner.address_country = Some(address_country); + self + } + + pub fn address_line1(mut self, address_line1: &'a str) -> Self { + self.inner.address_line1 = Some(address_line1); + self + } + + pub fn address_line2(mut self, address_line2: &'a str) -> Self { + self.inner.address_line2 = Some(address_line2); + self + } + + pub fn address_state(mut self, address_state: &'a str) -> Self { + self.inner.address_state = Some(address_state); + self + } + + pub fn address_zip(mut self, address_zip: &'a str) -> Self { + self.inner.address_zip = Some(address_zip); + self + } + + pub fn default_for_currency(mut self, default_for_currency: bool) -> Self { + self.inner.default_for_currency = Some(default_for_currency); + self + } + + pub fn documents(mut self, documents: UpdateExternalAccountBuilderDocuments<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn exp_month(mut self, exp_month: &'a str) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: &'a str) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl UpdateExternalAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateExternalAccount<'_> { + type Output = stripe_shared::ExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/accounts/{account}/external_accounts/{id}"), + ) + .form(&self.inner) + } +} +/// Delete a specified external account for a given account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteExternalAccount<'a> { + account: &'a stripe_shared::AccountId, + id: &'a str, +} +impl<'a> DeleteExternalAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id } + } +} +impl DeleteExternalAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteExternalAccount<'_> { + type Output = stripe_shared::DeletedExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Delete, + format!("/accounts/{account}/external_accounts/{id}"), ) } } diff --git a/generated/stripe_connect/src/login_link/requests.rs b/generated/stripe_connect/src/login_link/requests.rs index 25eb26fac..2ee12755f 100644 --- a/generated/stripe_connect/src/login_link/requests.rs +++ b/generated/stripe_connect/src/login_link/requests.rs @@ -1,27 +1,57 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountLoginLink<'a> { +pub struct CreateAccountLoginLinkBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CreateAccountLoginLink<'a> { +impl<'a> CreateAccountLoginLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Creates a single-use login link for an Express account to access their Stripe dashboard. +/// +/// **You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform**. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccountLoginLink<'a> { + inner: CreateAccountLoginLinkBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> CreateAccountLoginLink<'a> { - /// Creates a single-use login link for an Express account to access their Stripe dashboard. - /// - /// **You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform**. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: CreateAccountLoginLinkBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreateAccountLoginLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/login_links"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateAccountLoginLink<'_> { + type Output = stripe_connect::LoginLink; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}/login_links")) + .form(&self.inner) } } diff --git a/generated/stripe_connect/src/mod.rs b/generated/stripe_connect/src/mod.rs index 0a0cc93b8..ab509d759 100644 --- a/generated/stripe_connect/src/mod.rs +++ b/generated/stripe_connect/src/mod.rs @@ -10,7 +10,6 @@ extern crate self as stripe_connect; pub mod account; pub use account_link::types::*; pub use stripe_shared::account::*; -pub use stripe_shared::account_annual_revenue::*; pub use stripe_shared::account_bacs_debit_payments_settings::*; pub use stripe_shared::account_branding_settings::*; pub use stripe_shared::account_business_profile::*; @@ -22,7 +21,6 @@ pub use stripe_shared::account_card_payments_settings::*; pub use stripe_shared::account_dashboard_settings::*; pub use stripe_shared::account_decline_charge_on::*; pub use stripe_shared::account_future_requirements::*; -pub use stripe_shared::account_invoices_settings::*; pub mod account_link; pub use account_session::types::*; pub use stripe_shared::account_monthly_estimated_revenue::*; @@ -45,7 +43,6 @@ pub use stripe_shared::application_fee::*; pub mod apps_secret; pub mod capability; pub use stripe_shared::capability::*; -pub use stripe_shared::connect_account_reference::*; #[doc(hidden)] pub mod connect_embedded_account_session_create_components; #[doc(inline)] @@ -54,26 +51,6 @@ pub use connect_embedded_account_session_create_components::*; pub mod connect_embedded_base_config_claim; #[doc(inline)] pub use connect_embedded_base_config_claim::*; -#[doc(hidden)] -pub mod connect_embedded_base_features; -#[doc(inline)] -pub use connect_embedded_base_features::*; -#[doc(hidden)] -pub mod connect_embedded_payments_config; -#[doc(inline)] -pub use connect_embedded_payments_config::*; -#[doc(hidden)] -pub mod connect_embedded_payments_features; -#[doc(inline)] -pub use connect_embedded_payments_features::*; -#[doc(hidden)] -pub mod connect_embedded_payouts_config; -#[doc(inline)] -pub use connect_embedded_payouts_config::*; -#[doc(hidden)] -pub mod connect_embedded_payouts_features; -#[doc(inline)] -pub use connect_embedded_payouts_features::*; pub use country_spec::types::*; pub mod country_spec; #[doc(hidden)] diff --git a/generated/stripe_connect/src/person/requests.rs b/generated/stripe_connect/src/person/requests.rs index a55101d6e..87f4a4c87 100644 --- a/generated/stripe_connect/src/person/requests.rs +++ b/generated/stripe_connect/src/person/requests.rs @@ -1,29 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeletePerson {} -impl DeletePerson { - pub fn new() -> Self { - Self::default() - } -} -impl DeletePerson { - /// Deletes an existing person’s relationship to the account’s legal entity. - /// Any person with a relationship for an account can be deleted through the API, except if the person is the `account_opener`. - /// If your integration is using the `executive` parameter, you cannot delete the only verified `executive` on file. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - person: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/persons/{person}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccountPerson<'a> { +pub struct ListAccountPersonBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -38,21 +18,21 @@ pub struct ListAccountPerson<'a> { pub limit: Option, /// Filters on the list of people returned based on the person's relationship to the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option, + pub relationship: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListAccountPerson<'a> { +impl<'a> ListAccountPersonBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Filters on the list of people returned based on the person's relationship to the account's company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccountPersonRelationship { +pub struct ListAccountPersonBuilderRelationship { /// A filter on the list of people returned based on whether these people are directors of the account's company. #[serde(skip_serializing_if = "Option::is_none")] pub director: Option, @@ -69,52 +49,127 @@ pub struct ListAccountPersonRelationship { #[serde(skip_serializing_if = "Option::is_none")] pub representative: Option, } -impl ListAccountPersonRelationship { +impl ListAccountPersonBuilderRelationship { pub fn new() -> Self { Self::default() } } +/// Returns a list of people associated with the account’s legal entity. +/// The people are returned sorted by creation date, with the most recent people appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListAccountPerson<'a> { + inner: ListAccountPersonBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> ListAccountPerson<'a> { - /// Returns a list of people associated with the account’s legal entity. - /// The people are returned sorted by creation date, with the most recent people appearing first. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: ListAccountPersonBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn relationship(mut self, relationship: ListAccountPersonBuilderRelationship) -> Self { + self.inner.relationship = Some(relationship); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListAccountPerson<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/persons"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/persons"), self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListAccountPerson<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/persons")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePerson<'a> { +pub struct RetrievePersonBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrievePerson<'a> { +impl<'a> RetrievePersonBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves an existing person. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePerson<'a> { + inner: RetrievePersonBuilder<'a>, + account: &'a stripe_shared::AccountId, + person: &'a str, +} impl<'a> RetrievePerson<'a> { - /// Retrieves an existing person. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, person: &'a str) -> Self { + Self { account, person, inner: RetrievePersonBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePerson<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - person: &str, - ) -> stripe::Response { - client.get_query(&format!("/accounts/{account}/persons/{person}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePerson<'_> { + type Output = stripe_shared::Person; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let person = self.person; + RequestBuilder::new(StripeMethod::Get, format!("/accounts/{account}/persons/{person}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountPerson<'a> { +pub struct CreateAccountPersonBuilder<'a> { /// Details on the legal guardian's acceptance of the required Stripe agreements. #[serde(skip_serializing_if = "Option::is_none")] pub additional_tos_acceptances: Option>, @@ -123,10 +178,10 @@ pub struct CreateAccountPerson<'a> { pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, @@ -208,14 +263,14 @@ pub struct CreateAccountPerson<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> CreateAccountPerson<'a> { +impl<'a> CreateAccountPersonBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountPersonAddressKana<'a> { +pub struct CreateAccountPersonBuilderAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -238,14 +293,14 @@ pub struct CreateAccountPersonAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountPersonAddressKana<'a> { +impl<'a> CreateAccountPersonBuilderAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountPersonAddressKanji<'a> { +pub struct CreateAccountPersonBuilderAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -268,23 +323,194 @@ pub struct CreateAccountPersonAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateAccountPersonAddressKanji<'a> { +impl<'a> CreateAccountPersonBuilderAddressKanji<'a> { pub fn new() -> Self { Self::default() } } +/// Creates a new person. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateAccountPerson<'a> { + inner: CreateAccountPersonBuilder<'a>, + account: &'a stripe_shared::AccountId, +} impl<'a> CreateAccountPerson<'a> { - /// Creates a new person. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId) -> Self { + Self { account, inner: CreateAccountPersonBuilder::new() } + } + pub fn additional_tos_acceptances( + mut self, + additional_tos_acceptances: PersonAdditionalTosAcceptancesSpecs<'a>, + ) -> Self { + self.inner.additional_tos_acceptances = Some(additional_tos_acceptances); + self + } + + pub fn address(mut self, address: AddressSpecs<'a>) -> Self { + self.inner.address = Some(address); + self + } + + pub fn address_kana(mut self, address_kana: CreateAccountPersonBuilderAddressKana<'a>) -> Self { + self.inner.address_kana = Some(address_kana); + self + } + + pub fn address_kanji( + mut self, + address_kanji: CreateAccountPersonBuilderAddressKanji<'a>, + ) -> Self { + self.inner.address_kanji = Some(address_kanji); + self + } + + pub fn dob(mut self, dob: DateOfBirthSpecs) -> Self { + self.inner.dob = Some(dob); + self + } + + pub fn documents(mut self, documents: PersonDocumentsSpecs<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn first_name(mut self, first_name: &'a str) -> Self { + self.inner.first_name = Some(first_name); + self + } + + pub fn first_name_kana(mut self, first_name_kana: &'a str) -> Self { + self.inner.first_name_kana = Some(first_name_kana); + self + } + + pub fn first_name_kanji(mut self, first_name_kanji: &'a str) -> Self { + self.inner.first_name_kanji = Some(first_name_kanji); + self + } + + pub fn full_name_aliases(mut self, full_name_aliases: &'a [&'a str]) -> Self { + self.inner.full_name_aliases = Some(full_name_aliases); + self + } + + pub fn gender(mut self, gender: &'a str) -> Self { + self.inner.gender = Some(gender); + self + } + + pub fn id_number(mut self, id_number: &'a str) -> Self { + self.inner.id_number = Some(id_number); + self + } + + pub fn id_number_secondary(mut self, id_number_secondary: &'a str) -> Self { + self.inner.id_number_secondary = Some(id_number_secondary); + self + } + + pub fn last_name(mut self, last_name: &'a str) -> Self { + self.inner.last_name = Some(last_name); + self + } + + pub fn last_name_kana(mut self, last_name_kana: &'a str) -> Self { + self.inner.last_name_kana = Some(last_name_kana); + self + } + + pub fn last_name_kanji(mut self, last_name_kanji: &'a str) -> Self { + self.inner.last_name_kanji = Some(last_name_kanji); + self + } + + pub fn maiden_name(mut self, maiden_name: &'a str) -> Self { + self.inner.maiden_name = Some(maiden_name); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nationality(mut self, nationality: &'a str) -> Self { + self.inner.nationality = Some(nationality); + self + } + + pub fn person_token(mut self, person_token: &'a str) -> Self { + self.inner.person_token = Some(person_token); + self + } + + pub fn phone(mut self, phone: &'a str) -> Self { + self.inner.phone = Some(phone); + self + } + + pub fn political_exposure(mut self, political_exposure: &'a str) -> Self { + self.inner.political_exposure = Some(political_exposure); + self + } + + pub fn registered_address(mut self, registered_address: AddressSpecs<'a>) -> Self { + self.inner.registered_address = Some(registered_address); + self + } + + pub fn relationship(mut self, relationship: RelationshipSpecs<'a>) -> Self { + self.inner.relationship = Some(relationship); + self + } + + pub fn ssn_last_4(mut self, ssn_last_4: &'a str) -> Self { + self.inner.ssn_last_4 = Some(ssn_last_4); + self + } + + pub fn verification(mut self, verification: PersonVerificationSpecs<'a>) -> Self { + self.inner.verification = Some(verification); + self + } +} +impl CreateAccountPerson<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}/persons"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateAccountPerson<'_> { + type Output = stripe_shared::Person; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}/persons")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePerson<'a> { +pub struct UpdatePersonBuilder<'a> { /// Details on the legal guardian's acceptance of the required Stripe agreements. #[serde(skip_serializing_if = "Option::is_none")] pub additional_tos_acceptances: Option>, @@ -293,10 +519,10 @@ pub struct UpdatePerson<'a> { pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, @@ -378,14 +604,14 @@ pub struct UpdatePerson<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> UpdatePerson<'a> { +impl<'a> UpdatePersonBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonAddressKana<'a> { +pub struct UpdatePersonBuilderAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -408,14 +634,14 @@ pub struct UpdatePersonAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdatePersonAddressKana<'a> { +impl<'a> UpdatePersonBuilderAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonAddressKanji<'a> { +pub struct UpdatePersonBuilderAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -438,26 +664,230 @@ pub struct UpdatePersonAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdatePersonAddressKanji<'a> { +impl<'a> UpdatePersonBuilderAddressKanji<'a> { pub fn new() -> Self { Self::default() } } +/// Updates an existing person. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePerson<'a> { + inner: UpdatePersonBuilder<'a>, + account: &'a stripe_shared::AccountId, + person: &'a str, +} impl<'a> UpdatePerson<'a> { - /// Updates an existing person. - pub fn send( + pub fn new(account: &'a stripe_shared::AccountId, person: &'a str) -> Self { + Self { account, person, inner: UpdatePersonBuilder::new() } + } + pub fn additional_tos_acceptances( + mut self, + additional_tos_acceptances: PersonAdditionalTosAcceptancesSpecs<'a>, + ) -> Self { + self.inner.additional_tos_acceptances = Some(additional_tos_acceptances); + self + } + + pub fn address(mut self, address: AddressSpecs<'a>) -> Self { + self.inner.address = Some(address); + self + } + + pub fn address_kana(mut self, address_kana: UpdatePersonBuilderAddressKana<'a>) -> Self { + self.inner.address_kana = Some(address_kana); + self + } + + pub fn address_kanji(mut self, address_kanji: UpdatePersonBuilderAddressKanji<'a>) -> Self { + self.inner.address_kanji = Some(address_kanji); + self + } + + pub fn dob(mut self, dob: DateOfBirthSpecs) -> Self { + self.inner.dob = Some(dob); + self + } + + pub fn documents(mut self, documents: PersonDocumentsSpecs<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn first_name(mut self, first_name: &'a str) -> Self { + self.inner.first_name = Some(first_name); + self + } + + pub fn first_name_kana(mut self, first_name_kana: &'a str) -> Self { + self.inner.first_name_kana = Some(first_name_kana); + self + } + + pub fn first_name_kanji(mut self, first_name_kanji: &'a str) -> Self { + self.inner.first_name_kanji = Some(first_name_kanji); + self + } + + pub fn full_name_aliases(mut self, full_name_aliases: &'a [&'a str]) -> Self { + self.inner.full_name_aliases = Some(full_name_aliases); + self + } + + pub fn gender(mut self, gender: &'a str) -> Self { + self.inner.gender = Some(gender); + self + } + + pub fn id_number(mut self, id_number: &'a str) -> Self { + self.inner.id_number = Some(id_number); + self + } + + pub fn id_number_secondary(mut self, id_number_secondary: &'a str) -> Self { + self.inner.id_number_secondary = Some(id_number_secondary); + self + } + + pub fn last_name(mut self, last_name: &'a str) -> Self { + self.inner.last_name = Some(last_name); + self + } + + pub fn last_name_kana(mut self, last_name_kana: &'a str) -> Self { + self.inner.last_name_kana = Some(last_name_kana); + self + } + + pub fn last_name_kanji(mut self, last_name_kanji: &'a str) -> Self { + self.inner.last_name_kanji = Some(last_name_kanji); + self + } + + pub fn maiden_name(mut self, maiden_name: &'a str) -> Self { + self.inner.maiden_name = Some(maiden_name); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nationality(mut self, nationality: &'a str) -> Self { + self.inner.nationality = Some(nationality); + self + } + + pub fn person_token(mut self, person_token: &'a str) -> Self { + self.inner.person_token = Some(person_token); + self + } + + pub fn phone(mut self, phone: &'a str) -> Self { + self.inner.phone = Some(phone); + self + } + + pub fn political_exposure(mut self, political_exposure: &'a str) -> Self { + self.inner.political_exposure = Some(political_exposure); + self + } + + pub fn registered_address(mut self, registered_address: AddressSpecs<'a>) -> Self { + self.inner.registered_address = Some(registered_address); + self + } + + pub fn relationship(mut self, relationship: RelationshipSpecs<'a>) -> Self { + self.inner.relationship = Some(relationship); + self + } + + pub fn ssn_last_4(mut self, ssn_last_4: &'a str) -> Self { + self.inner.ssn_last_4 = Some(ssn_last_4); + self + } + + pub fn verification(mut self, verification: PersonVerificationSpecs<'a>) -> Self { + self.inner.verification = Some(verification); + self + } +} +impl UpdatePerson<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - person: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/persons/{person}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePerson<'_> { + type Output = stripe_shared::Person; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let person = self.person; + RequestBuilder::new(StripeMethod::Post, format!("/accounts/{account}/persons/{person}")) + .form(&self.inner) + } +} +/// Deletes an existing person’s relationship to the account’s legal entity. +/// Any person with a relationship for an account can be deleted through the API, except if the person is the `account_opener`. +/// If your integration is using the `executive` parameter, you cannot delete the only verified `executive` on file. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeletePerson<'a> { + account: &'a stripe_shared::AccountId, + person: &'a str, +} +impl<'a> DeletePerson<'a> { + pub fn new(account: &'a stripe_shared::AccountId, person: &'a str) -> Self { + Self { account, person } + } +} +impl DeletePerson<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeletePerson<'_> { + type Output = stripe_shared::DeletedPerson; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let person = self.person; + RequestBuilder::new(StripeMethod::Delete, format!("/accounts/{account}/persons/{person}")) } } + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct SettingsTermsOfServiceSpecs<'a> { /// The Unix timestamp marking when the account representative accepted the service agreement. diff --git a/generated/stripe_connect/src/topup/requests.rs b/generated/stripe_connect/src/topup/requests.rs index 03f9763fc..db21c07bc 100644 --- a/generated/stripe_connect/src/topup/requests.rs +++ b/generated/stripe_connect/src/topup/requests.rs @@ -1,5 +1,116 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreateTopupBuilder<'a> { + /// A positive integer representing how much to transfer. + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// An arbitrary string attached to the object. Often useful for displaying to users. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The ID of a source to transfer funds from. + /// For most users, this should be left unspecified which will use the bank account that was set up in the dashboard for the specified currency. + /// In test mode, this can be a test bank token (see [Testing Top-ups](https://stripe.com/docs/connect/testing#testing-top-ups)). + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option<&'a str>, + /// Extra information about a top-up for the source's bank statement. Limited to 15 ASCII characters. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor: Option<&'a str>, + /// A string that identifies this top-up as part of a group. + #[serde(skip_serializing_if = "Option::is_none")] + pub transfer_group: Option<&'a str>, +} +impl<'a> CreateTopupBuilder<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { + amount, + currency, + description: None, + expand: None, + metadata: None, + source: None, + statement_descriptor: None, + transfer_group: None, + } + } +} +/// Top up the balance of an account +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTopup<'a> { + inner: CreateTopupBuilder<'a>, +} +impl<'a> CreateTopup<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { inner: CreateTopupBuilder::new(amount, currency) } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl CreateTopup<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTopup<'_> { + type Output = stripe_shared::Topup; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/topups").form(&self.inner) + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTopup<'a> { +pub struct ListTopupBuilder<'a> { /// A positive integer representing how much to transfer. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -27,9 +138,9 @@ pub struct ListTopup<'a> { /// Only return top-ups that have the given status. /// One of `canceled`, `failed`, `pending` or `succeeded`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } -impl<'a> ListTopup<'a> { +impl<'a> ListTopupBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -37,15 +148,15 @@ impl<'a> ListTopup<'a> { /// Only return top-ups that have the given status. /// One of `canceled`, `failed`, `pending` or `succeeded`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTopupStatus { +pub enum ListTopupBuilderStatus { Canceled, Failed, Pending, Succeeded, } -impl ListTopupStatus { +impl ListTopupBuilderStatus { pub fn as_str(self) -> &'static str { - use ListTopupStatus::*; + use ListTopupBuilderStatus::*; match self { Canceled => "canceled", Failed => "failed", @@ -55,10 +166,10 @@ impl ListTopupStatus { } } -impl std::str::FromStr for ListTopupStatus { +impl std::str::FromStr for ListTopupBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use ListTopupStatus::*; + use ListTopupBuilderStatus::*; match s { "canceled" => Ok(Canceled), "failed" => Ok(Failed), @@ -68,18 +179,18 @@ impl std::str::FromStr for ListTopupStatus { } } } -impl std::fmt::Display for ListTopupStatus { +impl std::fmt::Display for ListTopupBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTopupStatus { +impl std::fmt::Debug for ListTopupBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTopupStatus { +impl serde::Serialize for ListTopupBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -87,93 +198,126 @@ impl serde::Serialize for ListTopupStatus { serializer.serialize_str(self.as_str()) } } +/// Returns a list of top-ups. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTopup<'a> { + inner: ListTopupBuilder<'a>, +} impl<'a> ListTopup<'a> { - /// Returns a list of top-ups. - pub fn send( + pub fn new() -> Self { + Self { inner: ListTopupBuilder::new() } + } + pub fn amount(mut self, amount: stripe_types::RangeQueryTs) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: ListTopupBuilderStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTopup<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/topups", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/topups", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTopup<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/topups").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTopup<'a> { +pub struct RetrieveTopupBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTopup<'a> { +impl<'a> RetrieveTopupBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of a top-up that has previously been created. +/// Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTopup<'a> { + inner: RetrieveTopupBuilder<'a>, + topup: &'a stripe_shared::TopupId, +} impl<'a> RetrieveTopup<'a> { - /// Retrieves the details of a top-up that has previously been created. - /// Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information. - pub fn send( - &self, - client: &stripe::Client, - topup: &stripe_shared::TopupId, - ) -> stripe::Response { - client.get_query(&format!("/topups/{topup}"), self) + pub fn new(topup: &'a stripe_shared::TopupId) -> Self { + Self { topup, inner: RetrieveTopupBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTopup<'a> { - /// A positive integer representing how much to transfer. - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// An arbitrary string attached to the object. Often useful for displaying to users. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The ID of a source to transfer funds from. - /// For most users, this should be left unspecified which will use the bank account that was set up in the dashboard for the specified currency. - /// In test mode, this can be a test bank token (see [Testing Top-ups](https://stripe.com/docs/connect/testing#testing-top-ups)). - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option<&'a str>, - /// Extra information about a top-up for the source's bank statement. Limited to 15 ASCII characters. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, - /// A string that identifies this top-up as part of a group. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_group: Option<&'a str>, -} -impl<'a> CreateTopup<'a> { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { - amount, - currency, - description: None, - expand: None, - metadata: None, - source: None, - statement_descriptor: None, - transfer_group: None, - } +impl RetrieveTopup<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateTopup<'a> { - /// Top up the balance of an account - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/topups", self, http_types::Method::Post) + +impl StripeRequest for RetrieveTopup<'_> { + type Output = stripe_shared::Topup; + + fn build(&self) -> RequestBuilder { + let topup = self.topup; + RequestBuilder::new(StripeMethod::Get, format!("/topups/{topup}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTopup<'a> { +pub struct UpdateTopupBuilder<'a> { /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -187,39 +331,107 @@ pub struct UpdateTopup<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateTopup<'a> { +impl<'a> UpdateTopupBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the metadata of a top-up. Other top-up details are not editable by design. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTopup<'a> { + inner: UpdateTopupBuilder<'a>, + topup: &'a stripe_shared::TopupId, +} impl<'a> UpdateTopup<'a> { - /// Updates the metadata of a top-up. Other top-up details are not editable by design. - pub fn send( + pub fn new(topup: &'a stripe_shared::TopupId) -> Self { + Self { topup, inner: UpdateTopupBuilder::new() } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateTopup<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - topup: &stripe_shared::TopupId, - ) -> stripe::Response { - client.send_form(&format!("/topups/{topup}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTopup<'_> { + type Output = stripe_shared::Topup; + + fn build(&self) -> RequestBuilder { + let topup = self.topup; + RequestBuilder::new(StripeMethod::Post, format!("/topups/{topup}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelTopup<'a> { +pub struct CancelTopupBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CancelTopup<'a> { +impl<'a> CancelTopupBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Cancels a top-up. Only pending top-ups can be canceled. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelTopup<'a> { + inner: CancelTopupBuilder<'a>, + topup: &'a stripe_shared::TopupId, +} impl<'a> CancelTopup<'a> { - /// Cancels a top-up. Only pending top-ups can be canceled. - pub fn send( + pub fn new(topup: &'a stripe_shared::TopupId) -> Self { + Self { topup, inner: CancelTopupBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelTopup<'_> { + pub async fn send( &self, - client: &stripe::Client, - topup: &stripe_shared::TopupId, - ) -> stripe::Response { - client.send_form(&format!("/topups/{topup}/cancel"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelTopup<'_> { + type Output = stripe_shared::Topup; + + fn build(&self) -> RequestBuilder { + let topup = self.topup; + RequestBuilder::new(StripeMethod::Post, format!("/topups/{topup}/cancel")).form(&self.inner) } } diff --git a/generated/stripe_connect/src/transfer/requests.rs b/generated/stripe_connect/src/transfer/requests.rs index 876c3fb8c..7372286e8 100644 --- a/generated/stripe_connect/src/transfer/requests.rs +++ b/generated/stripe_connect/src/transfer/requests.rs @@ -1,73 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTransfer<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// Only return transfers for the destination specified by this account ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub destination: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// Only return transfers with the specified transfer group. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_group: Option<&'a str>, -} -impl<'a> ListTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListTransfer<'a> { - /// Returns a list of existing transfers sent to connected accounts. - /// The transfers are returned in sorted order, with the most recently created transfers appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/transfers", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/transfers", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTransfer<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveTransfer<'a> { - /// Retrieves the details of an existing transfer. - /// Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information. - pub fn send( - &self, - client: &stripe::Client, - transfer: &stripe_shared::TransferId, - ) -> stripe::Response { - client.get_query(&format!("/transfers/{transfer}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTransfer<'a> { +pub struct CreateTransferBuilder<'a> { /// A positive integer in cents (or local equivalent) representing how much to transfer. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -97,13 +33,13 @@ pub struct CreateTransfer<'a> { /// One of `bank_account`, `card`, or `fpx`. /// For most users, this will default to `card`. #[serde(skip_serializing_if = "Option::is_none")] - pub source_type: Option, + pub source_type: Option, /// A string that identifies this transaction as part of a group. /// See the [Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) for details. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> CreateTransfer<'a> { +impl<'a> CreateTransferBuilder<'a> { pub fn new(currency: stripe_types::Currency, destination: &'a str) -> Self { Self { amount: None, @@ -122,14 +58,14 @@ impl<'a> CreateTransfer<'a> { /// One of `bank_account`, `card`, or `fpx`. /// For most users, this will default to `card`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTransferSourceType { +pub enum CreateTransferBuilderSourceType { BankAccount, Card, Fpx, } -impl CreateTransferSourceType { +impl CreateTransferBuilderSourceType { pub fn as_str(self) -> &'static str { - use CreateTransferSourceType::*; + use CreateTransferBuilderSourceType::*; match self { BankAccount => "bank_account", Card => "card", @@ -138,10 +74,10 @@ impl CreateTransferSourceType { } } -impl std::str::FromStr for CreateTransferSourceType { +impl std::str::FromStr for CreateTransferBuilderSourceType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTransferSourceType::*; + use CreateTransferBuilderSourceType::*; match s { "bank_account" => Ok(BankAccount), "card" => Ok(Card), @@ -150,18 +86,18 @@ impl std::str::FromStr for CreateTransferSourceType { } } } -impl std::fmt::Display for CreateTransferSourceType { +impl std::fmt::Display for CreateTransferBuilderSourceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTransferSourceType { +impl std::fmt::Debug for CreateTransferBuilderSourceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTransferSourceType { +impl serde::Serialize for CreateTransferBuilderSourceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -169,15 +105,228 @@ impl serde::Serialize for CreateTransferSourceType { serializer.serialize_str(self.as_str()) } } +/// To send funds from your Stripe account to a connected account, you create a new transfer object. +/// Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTransfer<'a> { + inner: CreateTransferBuilder<'a>, +} impl<'a> CreateTransfer<'a> { - /// To send funds from your Stripe account to a connected account, you create a new transfer object. - /// Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/transfers", self, http_types::Method::Post) + pub fn new(currency: stripe_types::Currency, destination: &'a str) -> Self { + Self { inner: CreateTransferBuilder::new(currency, destination) } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn source_transaction(mut self, source_transaction: &'a str) -> Self { + self.inner.source_transaction = Some(source_transaction); + self + } + + pub fn source_type(mut self, source_type: CreateTransferBuilderSourceType) -> Self { + self.inner.source_type = Some(source_type); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl CreateTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTransfer<'_> { + type Output = stripe_shared::Transfer; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/transfers").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTransfer<'a> { +pub struct ListTransferBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// Only return transfers for the destination specified by this account ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub destination: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// Only return transfers with the specified transfer group. + #[serde(skip_serializing_if = "Option::is_none")] + pub transfer_group: Option<&'a str>, +} +impl<'a> ListTransferBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of existing transfers sent to connected accounts. +/// The transfers are returned in sorted order, with the most recently created transfers appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTransfer<'a> { + inner: ListTransferBuilder<'a>, +} +impl<'a> ListTransfer<'a> { + pub fn new() -> Self { + Self { inner: ListTransferBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn destination(mut self, destination: &'a str) -> Self { + self.inner.destination = Some(destination); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl ListTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTransfer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/transfers").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTransferBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTransferBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing transfer. +/// Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTransfer<'a> { + inner: RetrieveTransferBuilder<'a>, + transfer: &'a stripe_shared::TransferId, +} +impl<'a> RetrieveTransfer<'a> { + pub fn new(transfer: &'a stripe_shared::TransferId) -> Self { + Self { transfer, inner: RetrieveTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTransfer<'_> { + type Output = stripe_shared::Transfer; + + fn build(&self) -> RequestBuilder { + let transfer = self.transfer; + RequestBuilder::new(StripeMethod::Get, format!("/transfers/{transfer}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateTransferBuilder<'a> { /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -191,21 +340,60 @@ pub struct UpdateTransfer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateTransfer<'a> { +impl<'a> UpdateTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified transfer by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// +/// This request accepts only metadata as an argument. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTransfer<'a> { + inner: UpdateTransferBuilder<'a>, + transfer: &'a stripe_shared::TransferId, +} impl<'a> UpdateTransfer<'a> { - /// Updates the specified transfer by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// - /// This request accepts only metadata as an argument. - pub fn send( + pub fn new(transfer: &'a stripe_shared::TransferId) -> Self { + Self { transfer, inner: UpdateTransferBuilder::new() } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateTransfer<'_> { + pub async fn send( &self, - client: &stripe::Client, - transfer: &stripe_shared::TransferId, - ) -> stripe::Response { - client.send_form(&format!("/transfers/{transfer}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTransfer<'_> { + type Output = stripe_shared::Transfer; + + fn build(&self) -> RequestBuilder { + let transfer = self.transfer; + RequestBuilder::new(StripeMethod::Post, format!("/transfers/{transfer}")).form(&self.inner) } } diff --git a/generated/stripe_connect/src/transfer_reversal/requests.rs b/generated/stripe_connect/src/transfer_reversal/requests.rs index 66e84e731..0cb405647 100644 --- a/generated/stripe_connect/src/transfer_reversal/requests.rs +++ b/generated/stripe_connect/src/transfer_reversal/requests.rs @@ -1,5 +1,108 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIdTransferReversal<'a> { +pub struct CreateIdTransferReversalBuilder<'a> { + /// A positive integer in cents (or local equivalent) representing how much of this transfer to reverse. + /// Can only reverse up to the unreversed amount remaining of the transfer. + /// Partial transfer reversals are only allowed for transfers to Stripe Accounts. + /// Defaults to the entire transfer amount. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// An arbitrary string which you can attach to a reversal object. + /// It is displayed alongside the reversal in the Dashboard. + /// This will be unset if you POST an empty value. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// Boolean indicating whether the application fee should be refunded when reversing this transfer. + /// If a full transfer reversal is given, the full application fee will be refunded. + /// Otherwise, the application fee will be refunded with an amount proportional to the amount of the transfer reversed. + #[serde(skip_serializing_if = "Option::is_none")] + pub refund_application_fee: Option, +} +impl<'a> CreateIdTransferReversalBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// When you create a new reversal, you must specify a transfer to create it on. +/// +/// When reversing transfers, you can optionally reverse part of the transfer. +/// You can do so as many times as you wish until the entire transfer has been reversed. +/// +/// Once entirely reversed, a transfer can’t be reversed again. +/// This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIdTransferReversal<'a> { + inner: CreateIdTransferReversalBuilder<'a>, + id: &'a stripe_shared::TransferId, +} +impl<'a> CreateIdTransferReversal<'a> { + pub fn new(id: &'a stripe_shared::TransferId) -> Self { + Self { id, inner: CreateIdTransferReversalBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn refund_application_fee(mut self, refund_application_fee: bool) -> Self { + self.inner.refund_application_fee = Some(refund_application_fee); + self + } +} +impl CreateIdTransferReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIdTransferReversal<'_> { + type Output = stripe_shared::TransferReversal; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/transfers/{id}/reversals")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListIdTransferReversalBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,64 +121,123 @@ pub struct ListIdTransferReversal<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListIdTransferReversal<'a> { +impl<'a> ListIdTransferReversalBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// You can see a list of the reversals belonging to a specific transfer. +/// Note that the 10 most recent reversals are always available by default on the transfer object. +/// If you need more than those 10, you can use this API method and the `limit` and `starting_after` parameters to page through additional reversals. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIdTransferReversal<'a> { + inner: ListIdTransferReversalBuilder<'a>, + id: &'a stripe_shared::TransferId, +} impl<'a> ListIdTransferReversal<'a> { - /// You can see a list of the reversals belonging to a specific transfer. - /// Note that the 10 most recent reversals are always available by default on the transfer object. - /// If you need more than those 10, you can use this API method and the `limit` and `starting_after` parameters to page through additional reversals. - pub fn send( + pub fn new(id: &'a stripe_shared::TransferId) -> Self { + Self { id, inner: ListIdTransferReversalBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListIdTransferReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_shared::TransferId, - ) -> stripe::Response> { - client.get_query(&format!("/transfers/{id}/reversals"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - id: &stripe_shared::TransferId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/transfers/{id}/reversals"), self) +} + +impl StripeRequest for ListIdTransferReversal<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/transfers/{id}/reversals")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTransferReversal<'a> { +pub struct RetrieveTransferReversalBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTransferReversal<'a> { +impl<'a> RetrieveTransferReversalBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTransferReversal<'a> { + inner: RetrieveTransferReversalBuilder<'a>, + id: &'a str, + transfer: &'a stripe_shared::TransferId, +} impl<'a> RetrieveTransferReversal<'a> { - /// By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. - pub fn send( + pub fn new(id: &'a str, transfer: &'a stripe_shared::TransferId) -> Self { + Self { id, transfer, inner: RetrieveTransferReversalBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTransferReversal<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &str, - transfer: &stripe_shared::TransferId, - ) -> stripe::Response { - client.get_query(&format!("/transfers/{transfer}/reversals/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTransferReversal<'_> { + type Output = stripe_shared::TransferReversal; + + fn build(&self) -> RequestBuilder { + let id = self.id; + let transfer = self.transfer; + RequestBuilder::new(StripeMethod::Get, format!("/transfers/{transfer}/reversals/{id}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIdTransferReversal<'a> { - /// A positive integer in cents (or local equivalent) representing how much of this transfer to reverse. - /// Can only reverse up to the unreversed amount remaining of the transfer. - /// Partial transfer reversals are only allowed for transfers to Stripe Accounts. - /// Defaults to the entire transfer amount. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// An arbitrary string which you can attach to a reversal object. - /// It is displayed alongside the reversal in the Dashboard. - /// This will be unset if you POST an empty value. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, +pub struct UpdateTransferReversalBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -85,65 +247,59 @@ pub struct CreateIdTransferReversal<'a> { /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, - /// Boolean indicating whether the application fee should be refunded when reversing this transfer. - /// If a full transfer reversal is given, the full application fee will be refunded. - /// Otherwise, the application fee will be refunded with an amount proportional to the amount of the transfer reversed. - #[serde(skip_serializing_if = "Option::is_none")] - pub refund_application_fee: Option, } -impl<'a> CreateIdTransferReversal<'a> { +impl<'a> UpdateTransferReversalBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CreateIdTransferReversal<'a> { - /// When you create a new reversal, you must specify a transfer to create it on. - /// - /// When reversing transfers, you can optionally reverse part of the transfer. - /// You can do so as many times as you wish until the entire transfer has been reversed. - /// - /// Once entirely reversed, a transfer can’t be reversed again. - /// This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::TransferId, - ) -> stripe::Response { - client.send_form(&format!("/transfers/{id}/reversals"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Updates the specified reversal by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// +/// This request only accepts metadata and description as arguments. +#[derive(Clone, Debug, serde::Serialize)] pub struct UpdateTransferReversal<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, + inner: UpdateTransferReversalBuilder<'a>, + id: &'a str, + transfer: &'a stripe_shared::TransferId, } impl<'a> UpdateTransferReversal<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(id: &'a str, transfer: &'a stripe_shared::TransferId) -> Self { + Self { id, transfer, inner: UpdateTransferReversalBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self } } -impl<'a> UpdateTransferReversal<'a> { - /// Updates the specified reversal by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// - /// This request only accepts metadata and description as arguments. - pub fn send( +impl UpdateTransferReversal<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &str, - transfer: &stripe_shared::TransferId, - ) -> stripe::Response { - client.send_form( - &format!("/transfers/{transfer}/reversals/{id}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTransferReversal<'_> { + type Output = stripe_shared::TransferReversal; + + fn build(&self) -> RequestBuilder { + let id = self.id; + let transfer = self.transfer; + RequestBuilder::new(StripeMethod::Post, format!("/transfers/{transfer}/reversals/{id}")) + .form(&self.inner) } } diff --git a/generated/stripe_core/Cargo.toml b/generated/stripe_core/Cargo.toml index 0a810ddff..ebf31c621 100644 --- a/generated/stripe_core/Cargo.toml +++ b/generated/stripe_core/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - balance = [] balance_transaction = [] cash_balance = [] @@ -43,7 +32,6 @@ charge = [] customer = [] customer_balance_transaction = [] customer_cash_balance_transaction = [] -customer_session = [] dispute = [] event = [] file = [] @@ -64,7 +52,6 @@ full = ["balance", "customer", "customer_balance_transaction", "customer_cash_balance_transaction", -"customer_session", "dispute", "event", "file", @@ -80,5 +67,5 @@ full = ["balance", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_core/src/balance/requests.rs b/generated/stripe_core/src/balance/requests.rs index 8b355f04a..60be3b303 100644 --- a/generated/stripe_core/src/balance/requests.rs +++ b/generated/stripe_core/src/balance/requests.rs @@ -1,18 +1,53 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveForMyAccountBalance<'a> { +pub struct RetrieveForMyAccountBalanceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveForMyAccountBalance<'a> { +impl<'a> RetrieveForMyAccountBalanceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the current account balance, based on the authentication that was used to make the request. +/// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveForMyAccountBalance<'a> { + inner: RetrieveForMyAccountBalanceBuilder<'a>, +} impl<'a> RetrieveForMyAccountBalance<'a> { - /// Retrieves the current account balance, based on the authentication that was used to make the request. - /// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances). - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/balance", self) + pub fn new() -> Self { + Self { inner: RetrieveForMyAccountBalanceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveForMyAccountBalance<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveForMyAccountBalance<'_> { + type Output = stripe_core::Balance; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/balance").query(&self.inner) } } diff --git a/generated/stripe_core/src/balance_transaction/requests.rs b/generated/stripe_core/src/balance_transaction/requests.rs index ecdda4709..9c60b1f3a 100644 --- a/generated/stripe_core/src/balance_transaction/requests.rs +++ b/generated/stripe_core/src/balance_transaction/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListBalanceTransaction<'a> { +pub struct ListBalanceTransactionBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// Only return transactions in a certain currency. @@ -31,53 +35,146 @@ pub struct ListBalanceTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, /// 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_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`. + /// One of: `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`, `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>, } -impl<'a> ListBalanceTransaction<'a> { +impl<'a> ListBalanceTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). +/// The transactions are returned in sorted order, with the most recent transactions appearing first. +/// +/// Note that this endpoint was previously called “Balance history” and used the path `/v1/balance/history`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListBalanceTransaction<'a> { + inner: ListBalanceTransactionBuilder<'a>, +} impl<'a> ListBalanceTransaction<'a> { - /// Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). - /// The transactions are returned in sorted order, with the most recent transactions appearing first. - /// - /// Note that this endpoint was previously called “Balance history” and used the path `/v1/balance/history`. - pub fn send( + pub fn new() -> Self { + Self { inner: ListBalanceTransactionBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payout(mut self, payout: &'a str) -> Self { + self.inner.payout = Some(payout); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: &'a str) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl ListBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/balance_transactions", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/balance_transactions", self) +} + +impl StripeRequest for ListBalanceTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/balance_transactions").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveBalanceTransaction<'a> { +pub struct RetrieveBalanceTransactionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveBalanceTransaction<'a> { +impl<'a> RetrieveBalanceTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the balance transaction with the given ID. +/// +/// Note that this endpoint previously used the path `/v1/balance/history/:id`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveBalanceTransaction<'a> { + inner: RetrieveBalanceTransactionBuilder<'a>, + id: &'a stripe_shared::BalanceTransactionId, +} impl<'a> RetrieveBalanceTransaction<'a> { - /// Retrieves the balance transaction with the given ID. - /// - /// Note that this endpoint previously used the path `/v1/balance/history/:id`. - pub fn send( + pub fn new(id: &'a stripe_shared::BalanceTransactionId) -> Self { + Self { id, inner: RetrieveBalanceTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveBalanceTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_shared::BalanceTransactionId, - ) -> stripe::Response { - client.get_query(&format!("/balance_transactions/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveBalanceTransaction<'_> { + type Output = stripe_shared::BalanceTransaction; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/balance_transactions/{id}")) + .query(&self.inner) } } diff --git a/generated/stripe_core/src/cash_balance/requests.rs b/generated/stripe_core/src/cash_balance/requests.rs index 48acee1ca..fd1c79ff4 100644 --- a/generated/stripe_core/src/cash_balance/requests.rs +++ b/generated/stripe_core/src/cash_balance/requests.rs @@ -1,48 +1,82 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCashBalance<'a> { +pub struct RetrieveCashBalanceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveCashBalance<'a> { +impl<'a> RetrieveCashBalanceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a customer’s cash balance. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCashBalance<'a> { + inner: RetrieveCashBalanceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> RetrieveCashBalance<'a> { - /// Retrieves a customer’s cash balance. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: RetrieveCashBalanceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCashBalance<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}/cash_balance"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCashBalance<'_> { + type Output = stripe_shared::CashBalance; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/cash_balance")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCashBalance<'a> { +pub struct UpdateCashBalanceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// A hash of settings for this cash balance. #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option, + pub settings: Option, } -impl<'a> UpdateCashBalance<'a> { +impl<'a> UpdateCashBalanceBuilder<'a> { pub fn new() -> Self { Self::default() } } /// A hash of settings for this cash balance. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCashBalanceSettings { +pub struct UpdateCashBalanceBuilderSettings { /// Controls how funds transferred by the customer are applied to payment intents and invoices. /// Valid options are `automatic`, `manual`, or `merchant_default`. /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). #[serde(skip_serializing_if = "Option::is_none")] - pub reconciliation_mode: Option, + pub reconciliation_mode: Option, } -impl UpdateCashBalanceSettings { +impl UpdateCashBalanceBuilderSettings { pub fn new() -> Self { Self::default() } @@ -51,14 +85,14 @@ impl UpdateCashBalanceSettings { /// Valid options are `automatic`, `manual`, or `merchant_default`. /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCashBalanceSettingsReconciliationMode { +pub enum UpdateCashBalanceBuilderSettingsReconciliationMode { Automatic, Manual, MerchantDefault, } -impl UpdateCashBalanceSettingsReconciliationMode { +impl UpdateCashBalanceBuilderSettingsReconciliationMode { pub fn as_str(self) -> &'static str { - use UpdateCashBalanceSettingsReconciliationMode::*; + use UpdateCashBalanceBuilderSettingsReconciliationMode::*; match self { Automatic => "automatic", Manual => "manual", @@ -67,10 +101,10 @@ impl UpdateCashBalanceSettingsReconciliationMode { } } -impl std::str::FromStr for UpdateCashBalanceSettingsReconciliationMode { +impl std::str::FromStr for UpdateCashBalanceBuilderSettingsReconciliationMode { type Err = (); fn from_str(s: &str) -> Result { - use UpdateCashBalanceSettingsReconciliationMode::*; + use UpdateCashBalanceBuilderSettingsReconciliationMode::*; match s { "automatic" => Ok(Automatic), "manual" => Ok(Manual), @@ -79,18 +113,18 @@ impl std::str::FromStr for UpdateCashBalanceSettingsReconciliationMode { } } } -impl std::fmt::Display for UpdateCashBalanceSettingsReconciliationMode { +impl std::fmt::Display for UpdateCashBalanceBuilderSettingsReconciliationMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateCashBalanceSettingsReconciliationMode { +impl std::fmt::Debug for UpdateCashBalanceBuilderSettingsReconciliationMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateCashBalanceSettingsReconciliationMode { +impl serde::Serialize for UpdateCashBalanceBuilderSettingsReconciliationMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -98,17 +132,48 @@ impl serde::Serialize for UpdateCashBalanceSettingsReconciliationMode { serializer.serialize_str(self.as_str()) } } +/// Changes the settings on a customer’s cash balance. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCashBalance<'a> { + inner: UpdateCashBalanceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> UpdateCashBalance<'a> { - /// Changes the settings on a customer’s cash balance. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: UpdateCashBalanceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn settings(mut self, settings: UpdateCashBalanceBuilderSettings) -> Self { + self.inner.settings = Some(settings); + self + } +} +impl UpdateCashBalance<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/cash_balance"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCashBalance<'_> { + type Output = stripe_shared::CashBalance; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}/cash_balance")) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/charge/requests.rs b/generated/stripe_core/src/charge/requests.rs index cf495c77b..bfe634441 100644 --- a/generated/stripe_core/src/charge/requests.rs +++ b/generated/stripe_core/src/charge/requests.rs @@ -1,5 +1,84 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct SearchChargeBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for pagination across multiple pages of results. + /// Don't include this parameter on the first call. + /// Use the next_page value returned in a previous response to request subsequent results. + #[serde(skip_serializing_if = "Option::is_none")] + pub page: Option<&'a str>, + /// The search query string. + /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for charges](https://stripe.com/docs/search#query-fields-for-charges). + pub query: &'a str, +} +impl<'a> SearchChargeBuilder<'a> { + pub fn new(query: &'a str) -> Self { + Self { expand: None, limit: None, page: None, query } + } +} +/// Search for charges you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchCharge<'a> { + inner: SearchChargeBuilder<'a>, +} +impl<'a> SearchCharge<'a> { + pub fn new(query: &'a str) -> Self { + Self { inner: SearchChargeBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self + } +} +impl SearchCharge<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SearchCharge<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/charges/search").query(&self.inner) + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCharge<'a> { +pub struct ListChargeBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// Only return charges for the customer specified by this customer ID. @@ -29,91 +108,86 @@ pub struct ListCharge<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> ListCharge<'a> { +impl<'a> ListChargeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of charges you’ve previously created. +/// The charges are returned in sorted order, with the most recent charges appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCharge<'a> { + inner: ListChargeBuilder<'a>, +} impl<'a> ListCharge<'a> { - /// Returns a list of charges you’ve previously created. - /// The charges are returned in sorted order, with the most recent charges appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/charges", self) + pub fn new() -> Self { + Self { inner: ListChargeBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/charges", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCharge<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCharge<'a> { - pub fn new() -> Self { - Self::default() + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self } -} -impl<'a> RetrieveCharge<'a> { - /// Retrieves the details of a charge that has previously been created. - /// Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. - /// The same information is returned when creating or refunding the charge. - pub fn send( - &self, - client: &stripe::Client, - charge: &stripe_shared::ChargeId, - ) -> stripe::Response { - client.get_query(&format!("/charges/{charge}"), self) + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchCharge<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for pagination across multiple pages of results. - /// Don't include this parameter on the first call. - /// Use the next_page value returned in a previous response to request subsequent results. - #[serde(skip_serializing_if = "Option::is_none")] - pub page: Option<&'a str>, - /// The search query string. - /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for charges](https://stripe.com/docs/search#query-fields-for-charges). - pub query: &'a str, -} -impl<'a> SearchCharge<'a> { - pub fn new(query: &'a str) -> Self { - Self { expand: None, limit: None, page: None, query } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self } } -impl<'a> SearchCharge<'a> { - /// Search for charges you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( +impl ListCharge<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/charges/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/charges/search", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCharge<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/charges").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCharge<'a> { +pub struct CreateChargeBuilder<'a> { /// Amount intended to be collected by this payment. /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). @@ -147,7 +221,7 @@ pub struct CreateCharge<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] - pub destination: Option>, + pub destination: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -165,7 +239,7 @@ pub struct CreateCharge<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// The email address to which this charge's [receipt](https://stripe.com/docs/dashboard/receipts) will be sent. /// The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. /// If this charge is for a [Customer](https://stripe.com/docs/api/customers/object), the email address specified here will override the customer's email address. @@ -193,19 +267,19 @@ pub struct CreateCharge<'a> { /// An optional dictionary including the account to automatically transfer to as part of a destination charge. /// [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// A string that identifies this transaction as part of a group. /// For details, see [Grouping transactions](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options). #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> CreateCharge<'a> { +impl<'a> CreateChargeBuilder<'a> { pub fn new() -> Self { Self::default() } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateChargeDestination<'a> { +pub struct CreateChargeBuilderDestination<'a> { /// ID of an existing, connected Stripe account. pub account: &'a str, /// The amount to transfer to the destination account without creating an `Application Fee` object. @@ -214,7 +288,7 @@ pub struct CreateChargeDestination<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, } -impl<'a> CreateChargeDestination<'a> { +impl<'a> CreateChargeBuilderDestination<'a> { pub fn new(account: &'a str) -> Self { Self { account, amount: None } } @@ -222,12 +296,12 @@ impl<'a> CreateChargeDestination<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateChargeRadarOptions<'a> { +pub struct CreateChargeBuilderRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> CreateChargeRadarOptions<'a> { +impl<'a> CreateChargeBuilderRadarOptions<'a> { pub fn new() -> Self { Self::default() } @@ -235,7 +309,7 @@ impl<'a> CreateChargeRadarOptions<'a> { /// An optional dictionary including the account to automatically transfer to as part of a destination charge. /// [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateChargeTransferData<'a> { +pub struct CreateChargeBuilderTransferData<'a> { /// The amount transferred to the destination account, if specified. /// By default, the entire charge amount is transferred to the destination account. #[serde(skip_serializing_if = "Option::is_none")] @@ -243,21 +317,194 @@ pub struct CreateChargeTransferData<'a> { /// ID of an existing, connected Stripe account. pub destination: &'a str, } -impl<'a> CreateChargeTransferData<'a> { +impl<'a> CreateChargeBuilderTransferData<'a> { pub fn new(destination: &'a str) -> Self { Self { amount: None, destination } } } +/// Use the [Payment Intents API](https://stripe.com/docs/api/payment_intents) to initiate a new payment instead. +/// of using this method. Confirmation of the PaymentIntent creates the `Charge` +/// object used to request payment, so this method is limited to legacy integrations. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCharge<'a> { + inner: CreateChargeBuilder<'a>, +} impl<'a> CreateCharge<'a> { - /// This method is no longer recommended—use the [Payment Intents API](https://stripe.com/docs/api/payment_intents). - /// to initiate a new payment instead. Confirmation of the PaymentIntent creates the `Charge` - /// object used to request payment. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/charges", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateChargeBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn application_fee(mut self, application_fee: i64) -> Self { + self.inner.application_fee = Some(application_fee); + self + } + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn capture(mut self, capture: bool) -> Self { + self.inner.capture = Some(capture); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn destination(mut self, destination: CreateChargeBuilderDestination<'a>) -> Self { + self.inner.destination = Some(destination); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn radar_options(mut self, radar_options: CreateChargeBuilderRadarOptions<'a>) -> Self { + self.inner.radar_options = Some(radar_options); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn shipping(mut self, shipping: OptionalFieldsShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn statement_descriptor_suffix(mut self, statement_descriptor_suffix: &'a str) -> Self { + self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix); + self + } + + pub fn transfer_data(mut self, transfer_data: CreateChargeBuilderTransferData<'a>) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl CreateCharge<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCharge<'_> { + type Output = stripe_shared::Charge; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/charges").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCharge<'a> { +pub struct RetrieveChargeBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveChargeBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of a charge that has previously been created. +/// Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. +/// The same information is returned when creating or refunding the charge. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCharge<'a> { + inner: RetrieveChargeBuilder<'a>, + charge: &'a stripe_shared::ChargeId, +} +impl<'a> RetrieveCharge<'a> { + pub fn new(charge: &'a stripe_shared::ChargeId) -> Self { + Self { charge, inner: RetrieveChargeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCharge<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCharge<'_> { + type Output = stripe_shared::Charge; + + fn build(&self) -> RequestBuilder { + let charge = self.charge; + RequestBuilder::new(StripeMethod::Get, format!("/charges/{charge}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateChargeBuilder<'a> { /// The ID of an existing customer that will be associated with this request. /// This field may only be updated if there is no existing associated customer with this charge. #[serde(skip_serializing_if = "Option::is_none")] @@ -275,7 +522,7 @@ pub struct UpdateCharge<'a> { /// If you believe a charge is safe, include a `user_report` key with a value of `safe`. /// Stripe will use the information you send to improve our fraud detection algorithms. #[serde(skip_serializing_if = "Option::is_none")] - pub fraud_details: Option, + pub fraud_details: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -295,7 +542,7 @@ pub struct UpdateCharge<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> UpdateCharge<'a> { +impl<'a> UpdateChargeBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -305,24 +552,24 @@ impl<'a> UpdateCharge<'a> { /// If you believe a charge is safe, include a `user_report` key with a value of `safe`. /// Stripe will use the information you send to improve our fraud detection algorithms. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateChargeFraudDetails { +pub struct UpdateChargeBuilderFraudDetails { /// Either `safe` or `fraudulent`. - pub user_report: UpdateChargeFraudDetailsUserReport, + pub user_report: UpdateChargeBuilderFraudDetailsUserReport, } -impl UpdateChargeFraudDetails { - pub fn new(user_report: UpdateChargeFraudDetailsUserReport) -> Self { +impl UpdateChargeBuilderFraudDetails { + pub fn new(user_report: UpdateChargeBuilderFraudDetailsUserReport) -> Self { Self { user_report } } } /// Either `safe` or `fraudulent`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateChargeFraudDetailsUserReport { +pub enum UpdateChargeBuilderFraudDetailsUserReport { Fraudulent, Safe, } -impl UpdateChargeFraudDetailsUserReport { +impl UpdateChargeBuilderFraudDetailsUserReport { pub fn as_str(self) -> &'static str { - use UpdateChargeFraudDetailsUserReport::*; + use UpdateChargeBuilderFraudDetailsUserReport::*; match self { Fraudulent => "fraudulent", Safe => "safe", @@ -330,10 +577,10 @@ impl UpdateChargeFraudDetailsUserReport { } } -impl std::str::FromStr for UpdateChargeFraudDetailsUserReport { +impl std::str::FromStr for UpdateChargeBuilderFraudDetailsUserReport { type Err = (); fn from_str(s: &str) -> Result { - use UpdateChargeFraudDetailsUserReport::*; + use UpdateChargeBuilderFraudDetailsUserReport::*; match s { "fraudulent" => Ok(Fraudulent), "safe" => Ok(Safe), @@ -341,18 +588,18 @@ impl std::str::FromStr for UpdateChargeFraudDetailsUserReport { } } } -impl std::fmt::Display for UpdateChargeFraudDetailsUserReport { +impl std::fmt::Display for UpdateChargeBuilderFraudDetailsUserReport { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateChargeFraudDetailsUserReport { +impl std::fmt::Debug for UpdateChargeBuilderFraudDetailsUserReport { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateChargeFraudDetailsUserReport { +impl serde::Serialize for UpdateChargeBuilderFraudDetailsUserReport { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -360,19 +607,83 @@ impl serde::Serialize for UpdateChargeFraudDetailsUserReport { serializer.serialize_str(self.as_str()) } } +/// Updates the specified charge by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCharge<'a> { + inner: UpdateChargeBuilder<'a>, + charge: &'a stripe_shared::ChargeId, +} impl<'a> UpdateCharge<'a> { - /// Updates the specified charge by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(charge: &'a stripe_shared::ChargeId) -> Self { + Self { charge, inner: UpdateChargeBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fraud_details(mut self, fraud_details: UpdateChargeBuilderFraudDetails) -> Self { + self.inner.fraud_details = Some(fraud_details); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn shipping(mut self, shipping: OptionalFieldsShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl UpdateCharge<'_> { + pub async fn send( &self, - client: &stripe::Client, - charge: &stripe_shared::ChargeId, - ) -> stripe::Response { - client.send_form(&format!("/charges/{charge}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCharge<'_> { + type Output = stripe_shared::Charge; + + fn build(&self) -> RequestBuilder { + let charge = self.charge; + RequestBuilder::new(StripeMethod::Post, format!("/charges/{charge}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureCharge<'a> { +pub struct CaptureChargeBuilder<'a> { /// The amount to capture, which must be less than or equal to the original amount. /// Any additional amount will be automatically refunded. #[serde(skip_serializing_if = "Option::is_none")] @@ -404,14 +715,14 @@ pub struct CaptureCharge<'a> { /// An optional dictionary including the account to automatically transfer to as part of a destination charge. /// [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option, + pub transfer_data: Option, /// A string that identifies this transaction as part of a group. /// `transfer_group` may only be provided if it has not been set. /// See the [Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) for details. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> CaptureCharge<'a> { +impl<'a> CaptureChargeBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -419,32 +730,103 @@ impl<'a> CaptureCharge<'a> { /// An optional dictionary including the account to automatically transfer to as part of a destination charge. /// [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureChargeTransferData { +pub struct CaptureChargeBuilderTransferData { /// The amount transferred to the destination account, if specified. /// By default, the entire charge amount is transferred to the destination account. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, } -impl CaptureChargeTransferData { +impl CaptureChargeBuilderTransferData { pub fn new() -> Self { Self::default() } } +/// Capture the payment of an existing, uncaptured charge that was created with the `capture` option set to false. +/// +/// Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail. +/// +/// Don’t use this method to capture a PaymentIntent-initiated charge. +/// Use [Capture a PaymentIntent](https://stripe.com/docs/api/payment_intents/capture). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CaptureCharge<'a> { + inner: CaptureChargeBuilder<'a>, + charge: &'a stripe_shared::ChargeId, +} impl<'a> CaptureCharge<'a> { - /// Capture the payment of an existing, uncaptured charge that was created with the `capture` option set to false. - /// - /// Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail. - /// - /// Don’t use this method to capture a PaymentIntent-initiated charge. - /// Use [Capture a PaymentIntent](https://stripe.com/docs/api/payment_intents/capture). - pub fn send( + pub fn new(charge: &'a stripe_shared::ChargeId) -> Self { + Self { charge, inner: CaptureChargeBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn application_fee(mut self, application_fee: i64) -> Self { + self.inner.application_fee = Some(application_fee); + self + } + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn statement_descriptor_suffix(mut self, statement_descriptor_suffix: &'a str) -> Self { + self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix); + self + } + + pub fn transfer_data(mut self, transfer_data: CaptureChargeBuilderTransferData) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } +} +impl CaptureCharge<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - charge: &stripe_shared::ChargeId, - ) -> stripe::Response { - client.send_form(&format!("/charges/{charge}/capture"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for CaptureCharge<'_> { + type Output = stripe_shared::Charge; + + fn build(&self) -> RequestBuilder { + let charge = self.charge; + RequestBuilder::new(StripeMethod::Post, format!("/charges/{charge}/capture")) + .form(&self.inner) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct OptionalFieldsAddress<'a> { /// City, district, suburb, town, or village. diff --git a/generated/stripe_core/src/customer/requests.rs b/generated/stripe_core/src/customer/requests.rs index f6917085a..87ec2f3e6 100644 --- a/generated/stripe_core/src/customer/requests.rs +++ b/generated/stripe_core/src/customer/requests.rs @@ -1,45 +1,84 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteCustomer {} -impl DeleteCustomer { - pub fn new() -> Self { - Self::default() - } +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct SearchCustomerBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for pagination across multiple pages of results. + /// Don't include this parameter on the first call. + /// Use the next_page value returned in a previous response to request subsequent results. + #[serde(skip_serializing_if = "Option::is_none")] + pub page: Option<&'a str>, + /// The search query string. + /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers). + pub query: &'a str, } -impl DeleteCustomer { - /// Permanently deletes a customer. - /// It cannot be undone. - /// Also immediately cancels any active subscriptions on the customer. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form(&format!("/customers/{customer}"), self, http_types::Method::Delete) +impl<'a> SearchCustomerBuilder<'a> { + pub fn new(query: &'a str) -> Self { + Self { expand: None, limit: None, page: None, query } } } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteDiscountCustomer {} -impl DeleteDiscountCustomer { - pub fn new() -> Self { - Self::default() +/// Search for customers you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchCustomer<'a> { + inner: SearchCustomerBuilder<'a>, +} +impl<'a> SearchCustomer<'a> { + pub fn new(query: &'a str) -> Self { + Self { inner: SearchCustomerBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self } } -impl DeleteDiscountCustomer { - /// Removes the currently applied discount on a customer. - pub fn send( +impl SearchCustomer<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/discount"), - self, - http_types::Method::Delete, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SearchCustomer<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/customers/search").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCustomer<'a> { +pub struct ListCustomerBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A case-sensitive filter on the list based on the customer's `email` field. @@ -68,264 +107,577 @@ pub struct ListCustomer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub test_clock: Option<&'a str>, } -impl<'a> ListCustomer<'a> { +impl<'a> ListCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your customers. +/// The customers are returned sorted by creation date, with the most recent customers appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCustomer<'a> { + inner: ListCustomerBuilder<'a>, +} impl<'a> ListCustomer<'a> { - /// Returns a list of your customers. - /// The customers are returned sorted by creation date, with the most recent customers appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListCustomerBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn test_clock(mut self, test_clock: &'a str) -> Self { + self.inner.test_clock = Some(test_clock); + self + } +} +impl ListCustomer<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/customers", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/customers", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCustomer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/customers").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCustomer<'a> { +pub struct CreateCustomerBuilder<'a> { + /// The customer's address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. + /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. + #[serde(skip_serializing_if = "Option::is_none")] + pub balance: Option, + /// Balance information and default balance settings for this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub cash_balance: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// An arbitrary string that you can attach to a customer object. + /// It is displayed alongside the customer in the dashboard. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// Customer's email address. + /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. + /// This may be up to *512 characters*. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, + /// The prefix for the customer used to generate unique invoice numbers. + /// Must be 3–12 uppercase letters or numbers. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_prefix: Option<&'a str>, + /// Default invoice settings for this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_settings: Option>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The customer's full name or business name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// The sequence to be used on the customer's next invoice. Defaults to 1. + #[serde(skip_serializing_if = "Option::is_none")] + pub next_invoice_sequence: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method: Option<&'a str>, + /// The customer's phone number. + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, + /// Customer's preferred languages, ordered by preference. + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_locales: Option<&'a [&'a str]>, + /// The API ID of a promotion code to apply to the customer. + /// The customer will have a discount applied on all recurring payments. + /// Charges you create through the API will not have the discount. + #[serde(skip_serializing_if = "Option::is_none")] + pub promotion_code: Option<&'a str>, + /// The customer's shipping information. Appears on invoices emailed to this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option<&'a str>, + /// Tax details about the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax: Option>, + /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_exempt: Option, + /// The customer's tax IDs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id_data: Option<&'a [CreateCustomerBuilderTaxIdData<'a>]>, + /// ID of the test clock to attach to the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub test_clock: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub validate: Option, } -impl<'a> RetrieveCustomer<'a> { +impl<'a> CreateCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveCustomer<'a> { - /// Retrieves a Customer object. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}"), self) - } +/// Balance information and default balance settings for this customer. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateCustomerBuilderCashBalance { + /// Settings controlling the behavior of the customer's cash balance, + /// such as reconciliation of funds received. + #[serde(skip_serializing_if = "Option::is_none")] + pub settings: Option, } -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(untagged)] -pub enum RetrieveCustomerReturned { - Customer(stripe_shared::Customer), - DeletedCustomer(stripe_shared::DeletedCustomer), +impl CreateCustomerBuilderCashBalance { + pub fn new() -> Self { + Self::default() + } } +/// Settings controlling the behavior of the customer's cash balance, +/// such as reconciliation of funds received. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct BalanceTransactionsCustomer<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. +pub struct CreateCustomerBuilderCashBalanceSettings { + /// Controls how funds transferred by the customer are applied to payment intents and invoices. + /// Valid options are `automatic`, `manual`, or `merchant_default`. + /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, + pub reconciliation_mode: Option, } -impl<'a> BalanceTransactionsCustomer<'a> { +impl CreateCustomerBuilderCashBalanceSettings { pub fn new() -> Self { Self::default() } } -impl<'a> BalanceTransactionsCustomer<'a> { - /// Returns a list of transactions that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/balance_transactions"), self) - } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/customers/{customer}/balance_transactions"), - self, - ) +/// Controls how funds transferred by the customer are applied to payment intents and invoices. +/// Valid options are `automatic`, `manual`, or `merchant_default`. +/// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + Automatic, + Manual, + MerchantDefault, +} +impl CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + pub fn as_str(self) -> &'static str { + use CreateCustomerBuilderCashBalanceSettingsReconciliationMode::*; + match self { + Automatic => "automatic", + Manual => "manual", + MerchantDefault => "merchant_default", + } + } +} + +impl std::str::FromStr for CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateCustomerBuilderCashBalanceSettingsReconciliationMode::*; + match s { + "automatic" => Ok(Automatic), + "manual" => Ok(Manual), + "merchant_default" => Ok(MerchantDefault), + _ => Err(()), + } + } +} +impl std::fmt::Display for CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } +impl serde::Serialize for CreateCustomerBuilderCashBalanceSettingsReconciliationMode { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Default invoice settings for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentMethodsCustomer<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. +pub struct CreateCustomerBuilderInvoiceSettings<'a> { + /// Default custom fields to be displayed on invoices for this customer. + /// When updating, pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, + /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + pub default_payment_method: Option<&'a str>, + /// Default footer to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// An optional filter on the list, based on the object `type` field. - /// Without the filter, the list includes all current and future payment method types. - /// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. - #[serde(rename = "type")] + pub footer: Option<&'a str>, + /// Default options for invoice PDF rendering for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub rendering_options: Option, } -impl<'a> ListPaymentMethodsCustomer<'a> { +impl<'a> CreateCustomerBuilderInvoiceSettings<'a> { pub fn new() -> Self { Self::default() } } -/// An optional filter on the list, based on the object `type` field. -/// Without the filter, the list includes all current and future payment method types. -/// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum ListPaymentMethodsCustomerType { - AcssDebit, - Affirm, - AfterpayClearpay, - Alipay, - AuBecsDebit, - BacsDebit, - Bancontact, - Blik, - Boleto, - Card, - Cashapp, - CustomerBalance, - Eps, - Fpx, - Giropay, - Grabpay, - Ideal, - Klarna, - Konbini, - Link, - Oxxo, - P24, - Paynow, - Paypal, - Pix, - Promptpay, - RevolutPay, - SepaDebit, - Sofort, - Swish, - UsBankAccount, - WechatPay, - Zip, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, +/// Default options for invoice PDF rendering for this customer. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateCustomerBuilderInvoiceSettingsRenderingOptions { + /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + /// One of `exclude_tax` or `include_inclusive_tax`. + /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. + /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_tax_display: + Option, +} +impl CreateCustomerBuilderInvoiceSettingsRenderingOptions { + pub fn new() -> Self { + Self::default() + } +} +/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. +/// One of `exclude_tax` or `include_inclusive_tax`. +/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. +/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { + ExcludeTax, + IncludeInclusiveTax, } -impl ListPaymentMethodsCustomerType { +impl CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use ListPaymentMethodsCustomerType::*; + use CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; match self { - AcssDebit => "acss_debit", - Affirm => "affirm", - AfterpayClearpay => "afterpay_clearpay", - Alipay => "alipay", - AuBecsDebit => "au_becs_debit", - BacsDebit => "bacs_debit", - Bancontact => "bancontact", - Blik => "blik", - Boleto => "boleto", - Card => "card", - Cashapp => "cashapp", - CustomerBalance => "customer_balance", - Eps => "eps", - Fpx => "fpx", - Giropay => "giropay", - Grabpay => "grabpay", - Ideal => "ideal", - Klarna => "klarna", - Konbini => "konbini", - Link => "link", - Oxxo => "oxxo", - P24 => "p24", - Paynow => "paynow", - Paypal => "paypal", - Pix => "pix", - Promptpay => "promptpay", - RevolutPay => "revolut_pay", - SepaDebit => "sepa_debit", - Sofort => "sofort", - Swish => "swish", - UsBankAccount => "us_bank_account", - WechatPay => "wechat_pay", - Zip => "zip", - Unknown => "unknown", + ExcludeTax => "exclude_tax", + IncludeInclusiveTax => "include_inclusive_tax", } } } -impl std::str::FromStr for ListPaymentMethodsCustomerType { +impl std::str::FromStr for CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use ListPaymentMethodsCustomerType::*; + use CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; match s { - "acss_debit" => Ok(AcssDebit), - "affirm" => Ok(Affirm), - "afterpay_clearpay" => Ok(AfterpayClearpay), - "alipay" => Ok(Alipay), - "au_becs_debit" => Ok(AuBecsDebit), - "bacs_debit" => Ok(BacsDebit), - "bancontact" => Ok(Bancontact), - "blik" => Ok(Blik), - "boleto" => Ok(Boleto), - "card" => Ok(Card), - "cashapp" => Ok(Cashapp), - "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), - "fpx" => Ok(Fpx), - "giropay" => Ok(Giropay), - "grabpay" => Ok(Grabpay), - "ideal" => Ok(Ideal), - "klarna" => Ok(Klarna), - "konbini" => Ok(Konbini), - "link" => Ok(Link), - "oxxo" => Ok(Oxxo), - "p24" => Ok(P24), - "paynow" => Ok(Paynow), - "paypal" => Ok(Paypal), - "pix" => Ok(Pix), - "promptpay" => Ok(Promptpay), - "revolut_pay" => Ok(RevolutPay), - "sepa_debit" => Ok(SepaDebit), - "sofort" => Ok(Sofort), - "swish" => Ok(Swish), - "us_bank_account" => Ok(UsBankAccount), - "wechat_pay" => Ok(WechatPay), - "zip" => Ok(Zip), + "exclude_tax" => Ok(ExcludeTax), + "include_inclusive_tax" => Ok(IncludeInclusiveTax), + _ => Err(()), + } + } +} +impl std::fmt::Display for CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// The customer's tax IDs. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreateCustomerBuilderTaxIdData<'a> { + /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. + #[serde(rename = "type")] + pub type_: CreateCustomerBuilderTaxIdDataType, + /// Value of the tax ID. + pub value: &'a str, +} +impl<'a> CreateCustomerBuilderTaxIdData<'a> { + pub fn new(type_: CreateCustomerBuilderTaxIdDataType, value: &'a str) -> Self { + Self { type_, value } + } +} +/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. +#[derive(Copy, Clone, Eq, PartialEq)] +#[non_exhaustive] +pub enum CreateCustomerBuilderTaxIdDataType { + AdNrt, + AeTrn, + ArCuit, + AuAbn, + AuArn, + BgUic, + BoTin, + BrCnpj, + BrCpf, + CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, + CaQst, + ChVat, + ClTin, + CnTin, + CoNit, + CrTin, + DoRcn, + EcRuc, + EgTin, + EsCif, + EuOssVat, + EuVat, + GbVat, + GeVat, + HkBr, + HuTin, + IdNpwp, + IlVat, + InGst, + IsVat, + JpCn, + JpRn, + JpTrn, + KePin, + KrBrn, + LiUid, + MxRfc, + MyFrp, + MyItn, + MySst, + NoVat, + NzGst, + PeRuc, + PhTin, + RoTin, + RsPib, + RuInn, + RuKpp, + SaVat, + SgGst, + SgUen, + SiTin, + SvNit, + ThVat, + TrTin, + TwVat, + UaVat, + UsEin, + UyRuc, + VeRif, + VnTin, + ZaVat, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, +} +impl CreateCustomerBuilderTaxIdDataType { + pub fn as_str(self) -> &'static str { + use CreateCustomerBuilderTaxIdDataType::*; + match self { + AdNrt => "ad_nrt", + AeTrn => "ae_trn", + ArCuit => "ar_cuit", + AuAbn => "au_abn", + AuArn => "au_arn", + BgUic => "bg_uic", + BoTin => "bo_tin", + BrCnpj => "br_cnpj", + BrCpf => "br_cpf", + CaBn => "ca_bn", + CaGstHst => "ca_gst_hst", + CaPstBc => "ca_pst_bc", + CaPstMb => "ca_pst_mb", + CaPstSk => "ca_pst_sk", + CaQst => "ca_qst", + ChVat => "ch_vat", + ClTin => "cl_tin", + CnTin => "cn_tin", + CoNit => "co_nit", + CrTin => "cr_tin", + DoRcn => "do_rcn", + EcRuc => "ec_ruc", + EgTin => "eg_tin", + EsCif => "es_cif", + EuOssVat => "eu_oss_vat", + EuVat => "eu_vat", + GbVat => "gb_vat", + GeVat => "ge_vat", + HkBr => "hk_br", + HuTin => "hu_tin", + IdNpwp => "id_npwp", + IlVat => "il_vat", + InGst => "in_gst", + IsVat => "is_vat", + JpCn => "jp_cn", + JpRn => "jp_rn", + JpTrn => "jp_trn", + KePin => "ke_pin", + KrBrn => "kr_brn", + LiUid => "li_uid", + MxRfc => "mx_rfc", + MyFrp => "my_frp", + MyItn => "my_itn", + MySst => "my_sst", + NoVat => "no_vat", + NzGst => "nz_gst", + PeRuc => "pe_ruc", + PhTin => "ph_tin", + RoTin => "ro_tin", + RsPib => "rs_pib", + RuInn => "ru_inn", + RuKpp => "ru_kpp", + SaVat => "sa_vat", + SgGst => "sg_gst", + SgUen => "sg_uen", + SiTin => "si_tin", + SvNit => "sv_nit", + ThVat => "th_vat", + TrTin => "tr_tin", + TwVat => "tw_vat", + UaVat => "ua_vat", + UsEin => "us_ein", + UyRuc => "uy_ruc", + VeRif => "ve_rif", + VnTin => "vn_tin", + ZaVat => "za_vat", + Unknown => "unknown", + } + } +} + +impl std::str::FromStr for CreateCustomerBuilderTaxIdDataType { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateCustomerBuilderTaxIdDataType::*; + match s { + "ad_nrt" => Ok(AdNrt), + "ae_trn" => Ok(AeTrn), + "ar_cuit" => Ok(ArCuit), + "au_abn" => Ok(AuAbn), + "au_arn" => Ok(AuArn), + "bg_uic" => Ok(BgUic), + "bo_tin" => Ok(BoTin), + "br_cnpj" => Ok(BrCnpj), + "br_cpf" => Ok(BrCpf), + "ca_bn" => Ok(CaBn), + "ca_gst_hst" => Ok(CaGstHst), + "ca_pst_bc" => Ok(CaPstBc), + "ca_pst_mb" => Ok(CaPstMb), + "ca_pst_sk" => Ok(CaPstSk), + "ca_qst" => Ok(CaQst), + "ch_vat" => Ok(ChVat), + "cl_tin" => Ok(ClTin), + "cn_tin" => Ok(CnTin), + "co_nit" => Ok(CoNit), + "cr_tin" => Ok(CrTin), + "do_rcn" => Ok(DoRcn), + "ec_ruc" => Ok(EcRuc), + "eg_tin" => Ok(EgTin), + "es_cif" => Ok(EsCif), + "eu_oss_vat" => Ok(EuOssVat), + "eu_vat" => Ok(EuVat), + "gb_vat" => Ok(GbVat), + "ge_vat" => Ok(GeVat), + "hk_br" => Ok(HkBr), + "hu_tin" => Ok(HuTin), + "id_npwp" => Ok(IdNpwp), + "il_vat" => Ok(IlVat), + "in_gst" => Ok(InGst), + "is_vat" => Ok(IsVat), + "jp_cn" => Ok(JpCn), + "jp_rn" => Ok(JpRn), + "jp_trn" => Ok(JpTrn), + "ke_pin" => Ok(KePin), + "kr_brn" => Ok(KrBrn), + "li_uid" => Ok(LiUid), + "mx_rfc" => Ok(MxRfc), + "my_frp" => Ok(MyFrp), + "my_itn" => Ok(MyItn), + "my_sst" => Ok(MySst), + "no_vat" => Ok(NoVat), + "nz_gst" => Ok(NzGst), + "pe_ruc" => Ok(PeRuc), + "ph_tin" => Ok(PhTin), + "ro_tin" => Ok(RoTin), + "rs_pib" => Ok(RsPib), + "ru_inn" => Ok(RuInn), + "ru_kpp" => Ok(RuKpp), + "sa_vat" => Ok(SaVat), + "sg_gst" => Ok(SgGst), + "sg_uen" => Ok(SgUen), + "si_tin" => Ok(SiTin), + "sv_nit" => Ok(SvNit), + "th_vat" => Ok(ThVat), + "tr_tin" => Ok(TrTin), + "tw_vat" => Ok(TwVat), + "ua_vat" => Ok(UaVat), + "us_ein" => Ok(UsEin), + "uy_ruc" => Ok(UyRuc), + "ve_rif" => Ok(VeRif), + "vn_tin" => Ok(VnTin), + "za_vat" => Ok(ZaVat), _ => Err(()), } } } -impl std::fmt::Display for ListPaymentMethodsCustomerType { +impl std::fmt::Display for CreateCustomerBuilderTaxIdDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListPaymentMethodsCustomerType { +impl std::fmt::Debug for CreateCustomerBuilderTaxIdDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListPaymentMethodsCustomerType { +impl serde::Serialize for CreateCustomerBuilderTaxIdDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -333,91 +685,214 @@ impl serde::Serialize for ListPaymentMethodsCustomerType { serializer.serialize_str(self.as_str()) } } -impl<'a> ListPaymentMethodsCustomer<'a> { - /// Returns a list of PaymentMethods for a given Customer - pub fn send( +/// Creates a new customer object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCustomer<'a> { + inner: CreateCustomerBuilder<'a>, +} +impl<'a> CreateCustomer<'a> { + pub fn new() -> Self { + Self { inner: CreateCustomerBuilder::new() } + } + pub fn address(mut self, address: OptionalFieldsAddress<'a>) -> Self { + self.inner.address = Some(address); + self + } + + pub fn balance(mut self, balance: i64) -> Self { + self.inner.balance = Some(balance); + self + } + + pub fn cash_balance(mut self, cash_balance: CreateCustomerBuilderCashBalance) -> Self { + self.inner.cash_balance = Some(cash_balance); + self + } + + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_prefix(mut self, invoice_prefix: &'a str) -> Self { + self.inner.invoice_prefix = Some(invoice_prefix); + self + } + + pub fn invoice_settings( + mut self, + invoice_settings: CreateCustomerBuilderInvoiceSettings<'a>, + ) -> Self { + self.inner.invoice_settings = Some(invoice_settings); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn next_invoice_sequence(mut self, next_invoice_sequence: i64) -> Self { + self.inner.next_invoice_sequence = Some(next_invoice_sequence); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn phone(mut self, phone: &'a str) -> Self { + self.inner.phone = Some(phone); + self + } + + pub fn preferred_locales(mut self, preferred_locales: &'a [&'a str]) -> Self { + self.inner.preferred_locales = Some(preferred_locales); + self + } + + pub fn promotion_code(mut self, promotion_code: &'a str) -> Self { + self.inner.promotion_code = Some(promotion_code); + self + } + + pub fn shipping(mut self, shipping: CustomerShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self + } + + pub fn tax(mut self, tax: TaxParam<'a>) -> Self { + self.inner.tax = Some(tax); + self + } + + pub fn tax_exempt(mut self, tax_exempt: stripe_shared::CustomerTaxExempt) -> Self { + self.inner.tax_exempt = Some(tax_exempt); + self + } + + pub fn tax_id_data(mut self, tax_id_data: &'a [CreateCustomerBuilderTaxIdData<'a>]) -> Self { + self.inner.tax_id_data = Some(tax_id_data); + self + } + + pub fn test_clock(mut self, test_clock: &'a str) -> Self { + self.inner.test_clock = Some(test_clock); + self + } + + pub fn validate(mut self, validate: bool) -> Self { + self.inner.validate = Some(validate); + self + } +} +impl CreateCustomer<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/payment_methods"), self) - } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/customers/{customer}/payment_methods"), - self, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCustomer<'_> { + type Output = stripe_shared::Customer; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/customers").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentMethodCustomer<'a> { +pub struct RetrieveCustomerBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrievePaymentMethodCustomer<'a> { +impl<'a> RetrieveCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrievePaymentMethodCustomer<'a> { - /// Retrieves a PaymentMethod object for a given Customer. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - payment_method: &str, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}/payment_methods/{payment_method}"), self) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchCustomer<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for pagination across multiple pages of results. - /// Don't include this parameter on the first call. - /// Use the next_page value returned in a previous response to request subsequent results. - #[serde(skip_serializing_if = "Option::is_none")] - pub page: Option<&'a str>, - /// The search query string. - /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers). - pub query: &'a str, +/// Retrieves a Customer object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCustomer<'a> { + inner: RetrieveCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, } -impl<'a> SearchCustomer<'a> { - pub fn new(query: &'a str) -> Self { - Self { expand: None, limit: None, page: None, query } +impl<'a> RetrieveCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: RetrieveCustomerBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> SearchCustomer<'a> { - /// Search for customers you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( +impl RetrieveCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/customers/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/customers/search", self) +} + +impl StripeRequest for RetrieveCustomer<'_> { + type Output = RetrieveCustomerReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}")).query(&self.inner) } } +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum RetrieveCustomerReturned { + Customer(stripe_shared::Customer), + DeletedCustomer(stripe_shared::DeletedCustomer), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomer<'a> { +pub struct UpdateCustomerBuilder<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, @@ -427,9 +902,16 @@ pub struct CreateCustomer<'a> { pub balance: Option, /// Balance information and default balance settings for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub cash_balance: Option, + pub cash_balance: Option, #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<&'a str>, + /// If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter. + /// + /// Provide the ID of a payment source already attached to this customer to make it this customer's default payment source. + /// + /// If you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_source: Option<&'a str>, /// An arbitrary string that you can attach to a customer object. /// It is displayed alongside the customer in the dashboard. #[serde(skip_serializing_if = "Option::is_none")] @@ -448,7 +930,7 @@ pub struct CreateCustomer<'a> { pub invoice_prefix: Option<&'a str>, /// Default invoice settings for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, + pub invoice_settings: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -461,8 +943,6 @@ pub struct CreateCustomer<'a> { /// The sequence to be used on the customer's next invoice. Defaults to 1. #[serde(skip_serializing_if = "Option::is_none")] pub next_invoice_sequence: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method: Option<&'a str>, /// The customer's phone number. #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, @@ -481,33 +961,27 @@ pub struct CreateCustomer<'a> { pub source: Option<&'a str>, /// Tax details about the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, + pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option, - /// The customer's tax IDs. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id_data: Option<&'a [CreateCustomerTaxIdData<'a>]>, - /// ID of the test clock to attach to the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub test_clock: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, } -impl<'a> CreateCustomer<'a> { +impl<'a> UpdateCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Balance information and default balance settings for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerCashBalance { +pub struct UpdateCustomerBuilderCashBalance { /// Settings controlling the behavior of the customer's cash balance, /// such as reconciliation of funds received. #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option, + pub settings: Option, } -impl CreateCustomerCashBalance { +impl UpdateCustomerBuilderCashBalance { pub fn new() -> Self { Self::default() } @@ -515,14 +989,14 @@ impl CreateCustomerCashBalance { /// Settings controlling the behavior of the customer's cash balance, /// such as reconciliation of funds received. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerCashBalanceSettings { +pub struct UpdateCustomerBuilderCashBalanceSettings { /// Controls how funds transferred by the customer are applied to payment intents and invoices. /// Valid options are `automatic`, `manual`, or `merchant_default`. /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). #[serde(skip_serializing_if = "Option::is_none")] - pub reconciliation_mode: Option, + pub reconciliation_mode: Option, } -impl CreateCustomerCashBalanceSettings { +impl UpdateCustomerBuilderCashBalanceSettings { pub fn new() -> Self { Self::default() } @@ -531,14 +1005,14 @@ impl CreateCustomerCashBalanceSettings { /// Valid options are `automatic`, `manual`, or `merchant_default`. /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCustomerCashBalanceSettingsReconciliationMode { +pub enum UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { Automatic, Manual, MerchantDefault, } -impl CreateCustomerCashBalanceSettingsReconciliationMode { +impl UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { pub fn as_str(self) -> &'static str { - use CreateCustomerCashBalanceSettingsReconciliationMode::*; + use UpdateCustomerBuilderCashBalanceSettingsReconciliationMode::*; match self { Automatic => "automatic", Manual => "manual", @@ -547,10 +1021,10 @@ impl CreateCustomerCashBalanceSettingsReconciliationMode { } } -impl std::str::FromStr for CreateCustomerCashBalanceSettingsReconciliationMode { +impl std::str::FromStr for UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { type Err = (); fn from_str(s: &str) -> Result { - use CreateCustomerCashBalanceSettingsReconciliationMode::*; + use UpdateCustomerBuilderCashBalanceSettingsReconciliationMode::*; match s { "automatic" => Ok(Automatic), "manual" => Ok(Manual), @@ -559,18 +1033,18 @@ impl std::str::FromStr for CreateCustomerCashBalanceSettingsReconciliationMode { } } } -impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode { +impl std::fmt::Display for UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCustomerCashBalanceSettingsReconciliationMode { +impl std::fmt::Debug for UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCustomerCashBalanceSettingsReconciliationMode { +impl serde::Serialize for UpdateCustomerBuilderCashBalanceSettingsReconciliationMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -580,8 +1054,8 @@ impl serde::Serialize for CreateCustomerCashBalanceSettingsReconciliationMode { } /// Default invoice settings for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerInvoiceSettings<'a> { - /// The list of up to 4 default custom fields to be displayed on invoices for this customer. +pub struct UpdateCustomerBuilderInvoiceSettings<'a> { + /// Default custom fields to be displayed on invoices for this customer. /// When updating, pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, @@ -592,136 +1066,72 @@ pub struct CreateCustomerInvoiceSettings<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<&'a str>, /// Default options for invoice PDF rendering for this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, -} -impl<'a> CreateCustomerInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Default options for invoice PDF rendering for this customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerInvoiceSettingsRenderingOptions { - /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. - /// One of `exclude_tax` or `include_inclusive_tax`. - /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. - /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, -} -impl CreateCustomerInvoiceSettingsRenderingOptions { - pub fn new() -> Self { - Self::default() - } -} -/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. -/// One of `exclude_tax` or `include_inclusive_tax`. -/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. -/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - ExcludeTax, - IncludeInclusiveTax, -} -impl CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - pub fn as_str(self) -> &'static str { - use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; - match self { - ExcludeTax => "exclude_tax", - IncludeInclusiveTax => "include_inclusive_tax", - } - } -} - -impl std::str::FromStr for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; - match s { - "exclude_tax" => Ok(ExcludeTax), - "include_inclusive_tax" => Ok(IncludeInclusiveTax), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } + #[serde(skip_serializing_if = "Option::is_none")] + pub rendering_options: Option, } -impl serde::Serialize for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +impl<'a> UpdateCustomerBuilderInvoiceSettings<'a> { + pub fn new() -> Self { + Self::default() } } -/// Tax details about the customer. +/// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, - /// A flag that indicates when Stripe should validate the customer tax location. - /// Defaults to `deferred`. +pub struct UpdateCustomerBuilderInvoiceSettingsRenderingOptions { + /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + /// One of `exclude_tax` or `include_inclusive_tax`. + /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. + /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] - pub validate_location: Option, + pub amount_tax_display: + Option, } -impl<'a> CreateCustomerTax<'a> { +impl UpdateCustomerBuilderInvoiceSettingsRenderingOptions { pub fn new() -> Self { Self::default() } } -/// A flag that indicates when Stripe should validate the customer tax location. -/// Defaults to `deferred`. +/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. +/// One of `exclude_tax` or `include_inclusive_tax`. +/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. +/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCustomerTaxValidateLocation { - Deferred, - Immediately, +pub enum UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { + ExcludeTax, + IncludeInclusiveTax, } -impl CreateCustomerTaxValidateLocation { +impl UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use CreateCustomerTaxValidateLocation::*; + use UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; match self { - Deferred => "deferred", - Immediately => "immediately", + ExcludeTax => "exclude_tax", + IncludeInclusiveTax => "include_inclusive_tax", } } } -impl std::str::FromStr for CreateCustomerTaxValidateLocation { +impl std::str::FromStr for UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use CreateCustomerTaxValidateLocation::*; + use UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; match s { - "deferred" => Ok(Deferred), - "immediately" => Ok(Immediately), + "exclude_tax" => Ok(ExcludeTax), + "include_inclusive_tax" => Ok(IncludeInclusiveTax), _ => Err(()), } } } -impl std::fmt::Display for CreateCustomerTaxValidateLocation { +impl std::fmt::Display for UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateCustomerTaxValidateLocation { +impl std::fmt::Debug for UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateCustomerTaxValidateLocation { +impl serde::Serialize for UpdateCustomerBuilderInvoiceSettingsRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -729,422 +1139,357 @@ impl serde::Serialize for CreateCustomerTaxValidateLocation { serializer.serialize_str(self.as_str()) } } -/// The customer's tax IDs. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerTaxIdData<'a> { - /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. - #[serde(rename = "type")] - pub type_: CreateCustomerTaxIdDataType, - /// Value of the tax ID. - pub value: &'a str, -} -impl<'a> CreateCustomerTaxIdData<'a> { - pub fn new(type_: CreateCustomerTaxIdDataType, value: &'a str) -> Self { - Self { type_, value } - } -} -/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateCustomerTaxIdDataType { - AdNrt, - AeTrn, - ArCuit, - AuAbn, - AuArn, - BgUic, - BoTin, - BrCnpj, - BrCpf, - CaBn, - CaGstHst, - CaPstBc, - CaPstMb, - CaPstSk, - CaQst, - ChVat, - ClTin, - CnTin, - CoNit, - CrTin, - DoRcn, - EcRuc, - EgTin, - EsCif, - EuOssVat, - EuVat, - GbVat, - GeVat, - HkBr, - HuTin, - IdNpwp, - IlVat, - InGst, - IsVat, - JpCn, - JpRn, - JpTrn, - KePin, - KrBrn, - LiUid, - MxRfc, - MyFrp, - MyItn, - MySst, - NoVat, - NzGst, - PeRuc, - PhTin, - RoTin, - RsPib, - RuInn, - RuKpp, - SaVat, - SgGst, - SgUen, - SiTin, - SvNit, - ThVat, - TrTin, - TwVat, - UaVat, - UsEin, - UyRuc, - VeRif, - VnTin, - ZaVat, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl CreateCustomerTaxIdDataType { - pub fn as_str(self) -> &'static str { - use CreateCustomerTaxIdDataType::*; - match self { - AdNrt => "ad_nrt", - AeTrn => "ae_trn", - ArCuit => "ar_cuit", - AuAbn => "au_abn", - AuArn => "au_arn", - BgUic => "bg_uic", - BoTin => "bo_tin", - BrCnpj => "br_cnpj", - BrCpf => "br_cpf", - CaBn => "ca_bn", - CaGstHst => "ca_gst_hst", - CaPstBc => "ca_pst_bc", - CaPstMb => "ca_pst_mb", - CaPstSk => "ca_pst_sk", - CaQst => "ca_qst", - ChVat => "ch_vat", - ClTin => "cl_tin", - CnTin => "cn_tin", - CoNit => "co_nit", - CrTin => "cr_tin", - DoRcn => "do_rcn", - EcRuc => "ec_ruc", - EgTin => "eg_tin", - EsCif => "es_cif", - EuOssVat => "eu_oss_vat", - EuVat => "eu_vat", - GbVat => "gb_vat", - GeVat => "ge_vat", - HkBr => "hk_br", - HuTin => "hu_tin", - IdNpwp => "id_npwp", - IlVat => "il_vat", - InGst => "in_gst", - IsVat => "is_vat", - JpCn => "jp_cn", - JpRn => "jp_rn", - JpTrn => "jp_trn", - KePin => "ke_pin", - KrBrn => "kr_brn", - LiUid => "li_uid", - MxRfc => "mx_rfc", - MyFrp => "my_frp", - MyItn => "my_itn", - MySst => "my_sst", - NoVat => "no_vat", - NzGst => "nz_gst", - PeRuc => "pe_ruc", - PhTin => "ph_tin", - RoTin => "ro_tin", - RsPib => "rs_pib", - RuInn => "ru_inn", - RuKpp => "ru_kpp", - SaVat => "sa_vat", - SgGst => "sg_gst", - SgUen => "sg_uen", - SiTin => "si_tin", - SvNit => "sv_nit", - ThVat => "th_vat", - TrTin => "tr_tin", - TwVat => "tw_vat", - UaVat => "ua_vat", - UsEin => "us_ein", - UyRuc => "uy_ruc", - VeRif => "ve_rif", - VnTin => "vn_tin", - ZaVat => "za_vat", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for CreateCustomerTaxIdDataType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCustomerTaxIdDataType::*; - match s { - "ad_nrt" => Ok(AdNrt), - "ae_trn" => Ok(AeTrn), - "ar_cuit" => Ok(ArCuit), - "au_abn" => Ok(AuAbn), - "au_arn" => Ok(AuArn), - "bg_uic" => Ok(BgUic), - "bo_tin" => Ok(BoTin), - "br_cnpj" => Ok(BrCnpj), - "br_cpf" => Ok(BrCpf), - "ca_bn" => Ok(CaBn), - "ca_gst_hst" => Ok(CaGstHst), - "ca_pst_bc" => Ok(CaPstBc), - "ca_pst_mb" => Ok(CaPstMb), - "ca_pst_sk" => Ok(CaPstSk), - "ca_qst" => Ok(CaQst), - "ch_vat" => Ok(ChVat), - "cl_tin" => Ok(ClTin), - "cn_tin" => Ok(CnTin), - "co_nit" => Ok(CoNit), - "cr_tin" => Ok(CrTin), - "do_rcn" => Ok(DoRcn), - "ec_ruc" => Ok(EcRuc), - "eg_tin" => Ok(EgTin), - "es_cif" => Ok(EsCif), - "eu_oss_vat" => Ok(EuOssVat), - "eu_vat" => Ok(EuVat), - "gb_vat" => Ok(GbVat), - "ge_vat" => Ok(GeVat), - "hk_br" => Ok(HkBr), - "hu_tin" => Ok(HuTin), - "id_npwp" => Ok(IdNpwp), - "il_vat" => Ok(IlVat), - "in_gst" => Ok(InGst), - "is_vat" => Ok(IsVat), - "jp_cn" => Ok(JpCn), - "jp_rn" => Ok(JpRn), - "jp_trn" => Ok(JpTrn), - "ke_pin" => Ok(KePin), - "kr_brn" => Ok(KrBrn), - "li_uid" => Ok(LiUid), - "mx_rfc" => Ok(MxRfc), - "my_frp" => Ok(MyFrp), - "my_itn" => Ok(MyItn), - "my_sst" => Ok(MySst), - "no_vat" => Ok(NoVat), - "nz_gst" => Ok(NzGst), - "pe_ruc" => Ok(PeRuc), - "ph_tin" => Ok(PhTin), - "ro_tin" => Ok(RoTin), - "rs_pib" => Ok(RsPib), - "ru_inn" => Ok(RuInn), - "ru_kpp" => Ok(RuKpp), - "sa_vat" => Ok(SaVat), - "sg_gst" => Ok(SgGst), - "sg_uen" => Ok(SgUen), - "si_tin" => Ok(SiTin), - "sv_nit" => Ok(SvNit), - "th_vat" => Ok(ThVat), - "tr_tin" => Ok(TrTin), - "tw_vat" => Ok(TwVat), - "ua_vat" => Ok(UaVat), - "us_ein" => Ok(UsEin), - "uy_ruc" => Ok(UyRuc), - "ve_rif" => Ok(VeRif), - "vn_tin" => Ok(VnTin), - "za_vat" => Ok(ZaVat), - _ => Err(()), - } +/// Updates the specified customer by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// For example, if you pass the **source** parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. +/// When you update a customer to a new valid card source by passing the **source** parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the `past_due` state, then the latest open invoice for the subscription with automatic collection enabled will be retried. +/// This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. +/// Changing the **default_source** for a customer will not trigger this behavior. +/// +/// This request accepts mostly the same arguments as the customer creation call. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCustomer<'a> { + inner: UpdateCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} +impl<'a> UpdateCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: UpdateCustomerBuilder::new() } + } + pub fn address(mut self, address: OptionalFieldsAddress<'a>) -> Self { + self.inner.address = Some(address); + self + } + + pub fn balance(mut self, balance: i64) -> Self { + self.inner.balance = Some(balance); + self + } + + pub fn cash_balance(mut self, cash_balance: UpdateCustomerBuilderCashBalance) -> Self { + self.inner.cash_balance = Some(cash_balance); + self + } + + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self + } + + pub fn default_source(mut self, default_source: &'a str) -> Self { + self.inner.default_source = Some(default_source); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn invoice_prefix(mut self, invoice_prefix: &'a str) -> Self { + self.inner.invoice_prefix = Some(invoice_prefix); + self + } + + pub fn invoice_settings( + mut self, + invoice_settings: UpdateCustomerBuilderInvoiceSettings<'a>, + ) -> Self { + self.inner.invoice_settings = Some(invoice_settings); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn next_invoice_sequence(mut self, next_invoice_sequence: i64) -> Self { + self.inner.next_invoice_sequence = Some(next_invoice_sequence); + self + } + + pub fn phone(mut self, phone: &'a str) -> Self { + self.inner.phone = Some(phone); + self + } + + pub fn preferred_locales(mut self, preferred_locales: &'a [&'a str]) -> Self { + self.inner.preferred_locales = Some(preferred_locales); + self + } + + pub fn promotion_code(mut self, promotion_code: &'a str) -> Self { + self.inner.promotion_code = Some(promotion_code); + self + } + + pub fn shipping(mut self, shipping: CustomerShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn source(mut self, source: &'a str) -> Self { + self.inner.source = Some(source); + self + } + + pub fn tax(mut self, tax: TaxParam<'a>) -> Self { + self.inner.tax = Some(tax); + self + } + + pub fn tax_exempt(mut self, tax_exempt: stripe_shared::CustomerTaxExempt) -> Self { + self.inner.tax_exempt = Some(tax_exempt); + self + } + + pub fn validate(mut self, validate: bool) -> Self { + self.inner.validate = Some(validate); + self } } -impl std::fmt::Display for CreateCustomerTaxIdDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl UpdateCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for CreateCustomerTaxIdDataType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for UpdateCustomer<'_> { + type Output = stripe_shared::Customer; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}")).form(&self.inner) } } -impl serde::Serialize for CreateCustomerTaxIdDataType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +/// Permanently deletes a customer. +/// It cannot be undone. +/// Also immediately cancels any active subscriptions on the customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteCustomer<'a> { + customer: &'a stripe_shared::CustomerId, +} +impl<'a> DeleteCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer } } } -impl<'a> CreateCustomer<'a> { - /// Creates a new customer object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/customers", self, http_types::Method::Post) +impl DeleteCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteCustomer<'_> { + type Output = stripe_shared::DeletedCustomer; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}")) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomer<'a> { - /// The customer's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. - /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. - #[serde(skip_serializing_if = "Option::is_none")] - pub balance: Option, - /// Balance information and default balance settings for this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub cash_balance: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter. - /// - /// Provide the ID of a payment source already attached to this customer to make it this customer's default payment source. - /// - /// If you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_source: Option<&'a str>, - /// An arbitrary string that you can attach to a customer object. - /// It is displayed alongside the customer in the dashboard. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// Customer's email address. - /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. - /// This may be up to *512 characters*. +pub struct ListPaymentMethodsCustomerBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The prefix for the customer used to generate unique invoice numbers. - /// Must be 3–12 uppercase letters or numbers. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_prefix: Option<&'a str>, - /// Default invoice settings for this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The customer's full name or business name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// The sequence to be used on the customer's next invoice. Defaults to 1. - #[serde(skip_serializing_if = "Option::is_none")] - pub next_invoice_sequence: Option, - /// The customer's phone number. - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// Customer's preferred languages, ordered by preference. - #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locales: Option<&'a [&'a str]>, - /// The API ID of a promotion code to apply to the customer. - /// The customer will have a discount applied on all recurring payments. - /// Charges you create through the API will not have the discount. - #[serde(skip_serializing_if = "Option::is_none")] - pub promotion_code: Option<&'a str>, - /// The customer's shipping information. Appears on invoices emailed to this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option<&'a str>, - /// Tax details about the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, - /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. #[serde(skip_serializing_if = "Option::is_none")] - pub validate: Option, -} -impl<'a> UpdateCustomer<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Balance information and default balance settings for this customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerCashBalance { - /// Settings controlling the behavior of the customer's cash balance, - /// such as reconciliation of funds received. + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option, -} -impl UpdateCustomerCashBalance { - pub fn new() -> Self { - Self::default() - } -} -/// Settings controlling the behavior of the customer's cash balance, -/// such as reconciliation of funds received. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerCashBalanceSettings { - /// Controls how funds transferred by the customer are applied to payment intents and invoices. - /// Valid options are `automatic`, `manual`, or `merchant_default`. - /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). + pub starting_after: Option<&'a str>, + /// An optional filter on the list, based on the object `type` field. + /// Without the filter, the list includes all current and future payment method types. + /// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. + #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub reconciliation_mode: Option, + pub type_: Option, } -impl UpdateCustomerCashBalanceSettings { +impl<'a> ListPaymentMethodsCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Controls how funds transferred by the customer are applied to payment intents and invoices. -/// Valid options are `automatic`, `manual`, or `merchant_default`. -/// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). +/// An optional filter on the list, based on the object `type` field. +/// Without the filter, the list includes all current and future payment method types. +/// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerCashBalanceSettingsReconciliationMode { - Automatic, - Manual, - MerchantDefault, +#[non_exhaustive] +pub enum ListPaymentMethodsCustomerBuilderType { + AcssDebit, + Affirm, + AfterpayClearpay, + Alipay, + AuBecsDebit, + BacsDebit, + Bancontact, + Blik, + Boleto, + Card, + Cashapp, + CustomerBalance, + Eps, + Fpx, + Giropay, + Grabpay, + Ideal, + Klarna, + Konbini, + Link, + Oxxo, + P24, + Paynow, + Paypal, + Pix, + Promptpay, + RevolutPay, + SepaDebit, + Sofort, + UsBankAccount, + WechatPay, + Zip, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, } -impl UpdateCustomerCashBalanceSettingsReconciliationMode { +impl ListPaymentMethodsCustomerBuilderType { pub fn as_str(self) -> &'static str { - use UpdateCustomerCashBalanceSettingsReconciliationMode::*; + use ListPaymentMethodsCustomerBuilderType::*; match self { - Automatic => "automatic", - Manual => "manual", - MerchantDefault => "merchant_default", + AcssDebit => "acss_debit", + Affirm => "affirm", + AfterpayClearpay => "afterpay_clearpay", + Alipay => "alipay", + AuBecsDebit => "au_becs_debit", + BacsDebit => "bacs_debit", + Bancontact => "bancontact", + Blik => "blik", + Boleto => "boleto", + Card => "card", + Cashapp => "cashapp", + CustomerBalance => "customer_balance", + Eps => "eps", + Fpx => "fpx", + Giropay => "giropay", + Grabpay => "grabpay", + Ideal => "ideal", + Klarna => "klarna", + Konbini => "konbini", + Link => "link", + Oxxo => "oxxo", + P24 => "p24", + Paynow => "paynow", + Paypal => "paypal", + Pix => "pix", + Promptpay => "promptpay", + RevolutPay => "revolut_pay", + SepaDebit => "sepa_debit", + Sofort => "sofort", + UsBankAccount => "us_bank_account", + WechatPay => "wechat_pay", + Zip => "zip", + Unknown => "unknown", } } } -impl std::str::FromStr for UpdateCustomerCashBalanceSettingsReconciliationMode { +impl std::str::FromStr for ListPaymentMethodsCustomerBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateCustomerCashBalanceSettingsReconciliationMode::*; + use ListPaymentMethodsCustomerBuilderType::*; match s { - "automatic" => Ok(Automatic), - "manual" => Ok(Manual), - "merchant_default" => Ok(MerchantDefault), + "acss_debit" => Ok(AcssDebit), + "affirm" => Ok(Affirm), + "afterpay_clearpay" => Ok(AfterpayClearpay), + "alipay" => Ok(Alipay), + "au_becs_debit" => Ok(AuBecsDebit), + "bacs_debit" => Ok(BacsDebit), + "bancontact" => Ok(Bancontact), + "blik" => Ok(Blik), + "boleto" => Ok(Boleto), + "card" => Ok(Card), + "cashapp" => Ok(Cashapp), + "customer_balance" => Ok(CustomerBalance), + "eps" => Ok(Eps), + "fpx" => Ok(Fpx), + "giropay" => Ok(Giropay), + "grabpay" => Ok(Grabpay), + "ideal" => Ok(Ideal), + "klarna" => Ok(Klarna), + "konbini" => Ok(Konbini), + "link" => Ok(Link), + "oxxo" => Ok(Oxxo), + "p24" => Ok(P24), + "paynow" => Ok(Paynow), + "paypal" => Ok(Paypal), + "pix" => Ok(Pix), + "promptpay" => Ok(Promptpay), + "revolut_pay" => Ok(RevolutPay), + "sepa_debit" => Ok(SepaDebit), + "sofort" => Ok(Sofort), + "us_bank_account" => Ok(UsBankAccount), + "wechat_pay" => Ok(WechatPay), + "zip" => Ok(Zip), _ => Err(()), } } } -impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode { +impl std::fmt::Display for ListPaymentMethodsCustomerBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateCustomerCashBalanceSettingsReconciliationMode { +impl std::fmt::Debug for ListPaymentMethodsCustomerBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateCustomerCashBalanceSettingsReconciliationMode { +impl serde::Serialize for ListPaymentMethodsCustomerBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1152,178 +1497,279 @@ impl serde::Serialize for UpdateCustomerCashBalanceSettingsReconciliationMode { serializer.serialize_str(self.as_str()) } } -/// Default invoice settings for this customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerInvoiceSettings<'a> { - /// The list of up to 4 default custom fields to be displayed on invoices for this customer. - /// When updating, pass an empty string to remove previously-defined fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, - /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_payment_method: Option<&'a str>, - /// Default footer to be displayed on invoices for this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub footer: Option<&'a str>, - /// Default options for invoice PDF rendering for this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, +/// Returns a list of PaymentMethods for a given Customer +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentMethodsCustomer<'a> { + inner: ListPaymentMethodsCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, } -impl<'a> UpdateCustomerInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> ListPaymentMethodsCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: ListPaymentMethodsCustomerBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: ListPaymentMethodsCustomerBuilderType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl ListPaymentMethodsCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPaymentMethodsCustomer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/payment_methods")) + .query(&self.inner) } } -/// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerInvoiceSettingsRenderingOptions { - /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. - /// One of `exclude_tax` or `include_inclusive_tax`. - /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. - /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. +pub struct RetrievePaymentMethodCustomerBuilder<'a> { + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub amount_tax_display: Option, + pub expand: Option<&'a [&'a str]>, } -impl UpdateCustomerInvoiceSettingsRenderingOptions { +impl<'a> RetrievePaymentMethodCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. -/// One of `exclude_tax` or `include_inclusive_tax`. -/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. -/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - ExcludeTax, - IncludeInclusiveTax, +/// Retrieves a PaymentMethod object for a given Customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentMethodCustomer<'a> { + inner: RetrievePaymentMethodCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + payment_method: &'a str, } -impl UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - pub fn as_str(self) -> &'static str { - use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; - match self { - ExcludeTax => "exclude_tax", - IncludeInclusiveTax => "include_inclusive_tax", - } +impl<'a> RetrievePaymentMethodCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, payment_method: &'a str) -> Self { + Self { customer, payment_method, inner: RetrievePaymentMethodCustomerBuilder::new() } } -} - -impl std::str::FromStr for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*; - match s { - "exclude_tax" => Ok(ExcludeTax), - "include_inclusive_tax" => Ok(IncludeInclusiveTax), - _ => Err(()), - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl std::fmt::Display for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl RetrievePaymentMethodCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::fmt::Debug for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for RetrievePaymentMethodCustomer<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let payment_method = self.payment_method; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/payment_methods/{payment_method}"), + ) + .query(&self.inner) } } -/// Tax details about the customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. +pub struct BalanceTransactionsCustomerBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, - /// A flag that indicates when Stripe should validate the customer tax location. - /// Defaults to `deferred`. + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. #[serde(skip_serializing_if = "Option::is_none")] - pub validate_location: Option, + pub starting_after: Option<&'a str>, } -impl<'a> UpdateCustomerTax<'a> { +impl<'a> BalanceTransactionsCustomerBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// A flag that indicates when Stripe should validate the customer tax location. -/// Defaults to `deferred`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerTaxValidateLocation { - Deferred, - Immediately, +/// Returns a list of transactions that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct BalanceTransactionsCustomer<'a> { + inner: BalanceTransactionsCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, } -impl UpdateCustomerTaxValidateLocation { - pub fn as_str(self) -> &'static str { - use UpdateCustomerTaxValidateLocation::*; - match self { - Deferred => "deferred", - Immediately => "immediately", - } +impl<'a> BalanceTransactionsCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: BalanceTransactionsCustomerBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -impl std::str::FromStr for UpdateCustomerTaxValidateLocation { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateCustomerTaxValidateLocation::*; - match s { - "deferred" => Ok(Deferred), - "immediately" => Ok(Immediately), - _ => Err(()), - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl std::fmt::Display for UpdateCustomerTaxValidateLocation { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl BalanceTransactionsCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for UpdateCustomerTaxValidateLocation { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl StripeRequest for BalanceTransactionsCustomer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/balance_transactions"), + ) + .query(&self.inner) } } -impl serde::Serialize for UpdateCustomerTaxValidateLocation { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct FundCashBalanceCustomerBuilder<'a> { + /// Amount to be used for this test cash balance transaction. + /// A positive integer representing how much to fund in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to fund $1.00 or 100 to fund ¥100, a zero-decimal currency). + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A description of the test funding. + /// This simulates free-text references supplied by customers when making bank transfers to their cash balance. + /// You can use this to test how Stripe's [reconciliation algorithm](https://stripe.com/docs/payments/customer-balance/reconciliation) applies to different user inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub reference: Option<&'a str>, +} +impl<'a> FundCashBalanceCustomerBuilder<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { amount, currency, expand: None, reference: None } } } -impl<'a> UpdateCustomer<'a> { - /// Updates the specified customer by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// For example, if you pass the **source** parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. - /// When you update a customer to a new valid card source by passing the **source** parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the `past_due` state, then the latest open invoice for the subscription with automatic collection enabled will be retried. - /// This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. - /// Changing the **default_source** for a customer will not trigger this behavior. - /// - /// This request accepts mostly the same arguments as the customer creation call. - pub fn send( +/// Create an incoming testmode bank transfer +#[derive(Clone, Debug, serde::Serialize)] +pub struct FundCashBalanceCustomer<'a> { + inner: FundCashBalanceCustomerBuilder<'a>, + customer: &'a str, +} +impl<'a> FundCashBalanceCustomer<'a> { + pub fn new(customer: &'a str, amount: i64, currency: stripe_types::Currency) -> Self { + Self { customer, inner: FundCashBalanceCustomerBuilder::new(amount, currency) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn reference(mut self, reference: &'a str) -> Self { + self.inner.reference = Some(reference); + self + } +} +impl FundCashBalanceCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form(&format!("/customers/{customer}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FundCashBalanceCustomer<'_> { + type Output = stripe_shared::CustomerCashBalanceTransaction; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/customers/{customer}/fund_cash_balance"), + ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFundingInstructionsCustomer<'a> { +pub struct CreateFundingInstructionsCustomerBuilder<'a> { /// Additional parameters for `bank_transfer` funding types - pub bank_transfer: CreateFundingInstructionsCustomerBankTransfer<'a>, + pub bank_transfer: CreateFundingInstructionsCustomerBuilderBankTransfer<'a>, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -1331,47 +1777,48 @@ pub struct CreateFundingInstructionsCustomer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// The `funding_type` to get the instructions for. - pub funding_type: CreateFundingInstructionsCustomerFundingType, + pub funding_type: CreateFundingInstructionsCustomerBuilderFundingType, } -impl<'a> CreateFundingInstructionsCustomer<'a> { +impl<'a> CreateFundingInstructionsCustomerBuilder<'a> { pub fn new( - bank_transfer: CreateFundingInstructionsCustomerBankTransfer<'a>, + bank_transfer: CreateFundingInstructionsCustomerBuilderBankTransfer<'a>, currency: stripe_types::Currency, - funding_type: CreateFundingInstructionsCustomerFundingType, + funding_type: CreateFundingInstructionsCustomerBuilderFundingType, ) -> Self { Self { bank_transfer, currency, expand: None, funding_type } } } /// Additional parameters for `bank_transfer` funding types #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFundingInstructionsCustomerBankTransfer<'a> { +pub struct CreateFundingInstructionsCustomerBuilderBankTransfer<'a> { /// Configuration for eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] - pub eu_bank_transfer: Option>, + pub eu_bank_transfer: + Option>, /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[serde(skip_serializing_if = "Option::is_none")] pub requested_address_types: - Option<&'a [CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes]>, + Option<&'a [CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes]>, /// The type of the `bank_transfer` #[serde(rename = "type")] - pub type_: CreateFundingInstructionsCustomerBankTransferType, + pub type_: CreateFundingInstructionsCustomerBuilderBankTransferType, } -impl<'a> CreateFundingInstructionsCustomerBankTransfer<'a> { - pub fn new(type_: CreateFundingInstructionsCustomerBankTransferType) -> Self { +impl<'a> CreateFundingInstructionsCustomerBuilderBankTransfer<'a> { + pub fn new(type_: CreateFundingInstructionsCustomerBuilderBankTransferType) -> Self { Self { eu_bank_transfer: None, requested_address_types: None, type_ } } } /// Configuration for eu_bank_transfer funding type. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFundingInstructionsCustomerBankTransferEuBankTransfer<'a> { +pub struct CreateFundingInstructionsCustomerBuilderBankTransferEuBankTransfer<'a> { /// The desired country code of the bank account information. /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. pub country: &'a str, } -impl<'a> CreateFundingInstructionsCustomerBankTransferEuBankTransfer<'a> { +impl<'a> CreateFundingInstructionsCustomerBuilderBankTransferEuBankTransfer<'a> { pub fn new(country: &'a str) -> Self { Self { country } } @@ -1381,15 +1828,15 @@ impl<'a> CreateFundingInstructionsCustomerBankTransferEuBankTransfer<'a> { /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +pub enum CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes { Iban, SortCode, Spei, Zengin, } -impl CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +impl CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes { pub fn as_str(self) -> &'static str { - use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*; + use CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes::*; match self { Iban => "iban", SortCode => "sort_code", @@ -1399,10 +1846,12 @@ impl CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { } } -impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +impl std::str::FromStr + for CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*; + use CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes::*; match s { "iban" => Ok(Iban), "sort_code" => Ok(SortCode), @@ -1412,18 +1861,22 @@ impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferRequeste } } } -impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +impl std::fmt::Display + for CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +impl std::fmt::Debug for CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes { +impl serde::Serialize + for CreateFundingInstructionsCustomerBuilderBankTransferRequestedAddressTypes +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1433,16 +1886,16 @@ impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferRequested } /// The type of the `bank_transfer` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFundingInstructionsCustomerBankTransferType { +pub enum CreateFundingInstructionsCustomerBuilderBankTransferType { EuBankTransfer, GbBankTransfer, JpBankTransfer, MxBankTransfer, UsBankTransfer, } -impl CreateFundingInstructionsCustomerBankTransferType { +impl CreateFundingInstructionsCustomerBuilderBankTransferType { pub fn as_str(self) -> &'static str { - use CreateFundingInstructionsCustomerBankTransferType::*; + use CreateFundingInstructionsCustomerBuilderBankTransferType::*; match self { EuBankTransfer => "eu_bank_transfer", GbBankTransfer => "gb_bank_transfer", @@ -1453,10 +1906,10 @@ impl CreateFundingInstructionsCustomerBankTransferType { } } -impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferType { +impl std::str::FromStr for CreateFundingInstructionsCustomerBuilderBankTransferType { type Err = (); fn from_str(s: &str) -> Result { - use CreateFundingInstructionsCustomerBankTransferType::*; + use CreateFundingInstructionsCustomerBuilderBankTransferType::*; match s { "eu_bank_transfer" => Ok(EuBankTransfer), "gb_bank_transfer" => Ok(GbBankTransfer), @@ -1467,18 +1920,18 @@ impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferType { } } } -impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferType { +impl std::fmt::Display for CreateFundingInstructionsCustomerBuilderBankTransferType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferType { +impl std::fmt::Debug for CreateFundingInstructionsCustomerBuilderBankTransferType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferType { +impl serde::Serialize for CreateFundingInstructionsCustomerBuilderBankTransferType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1488,40 +1941,40 @@ impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferType { } /// The `funding_type` to get the instructions for. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFundingInstructionsCustomerFundingType { +pub enum CreateFundingInstructionsCustomerBuilderFundingType { BankTransfer, } -impl CreateFundingInstructionsCustomerFundingType { +impl CreateFundingInstructionsCustomerBuilderFundingType { pub fn as_str(self) -> &'static str { - use CreateFundingInstructionsCustomerFundingType::*; + use CreateFundingInstructionsCustomerBuilderFundingType::*; match self { BankTransfer => "bank_transfer", } } } -impl std::str::FromStr for CreateFundingInstructionsCustomerFundingType { +impl std::str::FromStr for CreateFundingInstructionsCustomerBuilderFundingType { type Err = (); fn from_str(s: &str) -> Result { - use CreateFundingInstructionsCustomerFundingType::*; + use CreateFundingInstructionsCustomerBuilderFundingType::*; match s { "bank_transfer" => Ok(BankTransfer), _ => Err(()), } } } -impl std::fmt::Display for CreateFundingInstructionsCustomerFundingType { +impl std::fmt::Display for CreateFundingInstructionsCustomerBuilderFundingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateFundingInstructionsCustomerFundingType { +impl std::fmt::Debug for CreateFundingInstructionsCustomerBuilderFundingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateFundingInstructionsCustomerFundingType { +impl serde::Serialize for CreateFundingInstructionsCustomerBuilderFundingType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1529,61 +1982,101 @@ impl serde::Serialize for CreateFundingInstructionsCustomerFundingType { serializer.serialize_str(self.as_str()) } } +/// Retrieve funding instructions for a customer cash balance. +/// If funding instructions do not yet exist for the customer, new. +/// funding instructions will be created. +/// If funding instructions have already been created for a given customer, the same. +/// funding instructions will be retrieved. +/// In other words, we will return the same funding instructions each time. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateFundingInstructionsCustomer<'a> { + inner: CreateFundingInstructionsCustomerBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> CreateFundingInstructionsCustomer<'a> { - /// Retrieve funding instructions for a customer cash balance. - /// If funding instructions do not yet exist for the customer, new. - /// funding instructions will be created. - /// If funding instructions have already been created for a given customer, the same. - /// funding instructions will be retrieved. - /// In other words, we will return the same funding instructions each time. - pub fn send( + pub fn new( + customer: &'a stripe_shared::CustomerId, + bank_transfer: CreateFundingInstructionsCustomerBuilderBankTransfer<'a>, + currency: stripe_types::Currency, + funding_type: CreateFundingInstructionsCustomerBuilderFundingType, + ) -> Self { + Self { + customer, + inner: CreateFundingInstructionsCustomerBuilder::new( + bank_transfer, + currency, + funding_type, + ), + } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreateFundingInstructionsCustomer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/funding_instructions"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateFundingInstructionsCustomer<'_> { + type Output = stripe_shared::FundingInstructions; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Post, + format!("/customers/{customer}/funding_instructions"), ) + .form(&self.inner) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct FundCashBalanceCustomer<'a> { - /// Amount to be used for this test cash balance transaction. - /// A positive integer representing how much to fund in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to fund $1.00 or 100 to fund ¥100, a zero-decimal currency). - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A description of the test funding. - /// This simulates free-text references supplied by customers when making bank transfers to their cash balance. - /// You can use this to test how Stripe's [reconciliation algorithm](https://stripe.com/docs/payments/customer-balance/reconciliation) applies to different user inputs. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option<&'a str>, +/// Removes the currently applied discount on a customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteDiscountCustomer<'a> { + customer: &'a stripe_shared::CustomerId, } -impl<'a> FundCashBalanceCustomer<'a> { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { amount, currency, expand: None, reference: None } +impl<'a> DeleteDiscountCustomer<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer } } } -impl<'a> FundCashBalanceCustomer<'a> { - /// Create an incoming testmode bank transfer - pub fn send( +impl DeleteDiscountCustomer<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/customers/{customer}/fund_cash_balance"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for DeleteDiscountCustomer<'_> { + type Output = stripe_shared::DeletedDiscount; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/discount")) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct OptionalFieldsAddress<'a> { /// City, district, suburb, town, or village. @@ -1622,6 +2115,19 @@ impl<'a> CustomFieldParams<'a> { Self { name, value } } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct TaxParam<'a> { + /// A recent IP address of the customer used for tax reporting and tax location inference. + /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. + /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option<&'a str>, +} +impl<'a> TaxParam<'a> { + pub fn new() -> Self { + Self::default() + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CustomerShipping<'a> { /// Customer shipping address. diff --git a/generated/stripe_core/src/customer_balance_transaction/requests.rs b/generated/stripe_core/src/customer_balance_transaction/requests.rs index b9e868401..d78113531 100644 --- a/generated/stripe_core/src/customer_balance_transaction/requests.rs +++ b/generated/stripe_core/src/customer_balance_transaction/requests.rs @@ -1,5 +1,65 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCustomerCustomerBalanceTransaction<'a> { +pub struct RetrieveCustomerBalanceTransactionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveCustomerBalanceTransactionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves a specific customer balance transaction that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCustomerBalanceTransaction<'a> { + inner: RetrieveCustomerBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + transaction: &'a str, +} +impl<'a> RetrieveCustomerBalanceTransaction<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, transaction: &'a str) -> Self { + Self { customer, transaction, inner: RetrieveCustomerBalanceTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCustomerBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCustomerBalanceTransaction<'_> { + type Output = stripe_shared::CustomerBalanceTransaction; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let transaction = self.transaction; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/balance_transactions/{transaction}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListCustomerCustomerBalanceTransactionBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,54 +78,71 @@ pub struct ListCustomerCustomerBalanceTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCustomerCustomerBalanceTransaction<'a> { +impl<'a> ListCustomerCustomerBalanceTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of transactions that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCustomerCustomerBalanceTransaction<'a> { + inner: ListCustomerCustomerBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> ListCustomerCustomerBalanceTransaction<'a> { - /// Returns a list of transactions that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/balance_transactions"), self) - } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/customers/{customer}/balance_transactions"), - self, - ) + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: ListCustomerCustomerBalanceTransactionBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCustomerBalanceTransaction<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCustomerBalanceTransaction<'a> { - pub fn new() -> Self { - Self::default() + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveCustomerBalanceTransaction<'a> { - /// Retrieves a specific customer balance transaction that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance). - pub fn send( +impl ListCustomerCustomerBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - transaction: &str, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}/balance_transactions/{transaction}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCustomerCustomerBalanceTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/balance_transactions"), + ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerCustomerBalanceTransaction<'a> { +pub struct CreateCustomerCustomerBalanceTransactionBuilder<'a> { /// The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -86,27 +163,73 @@ pub struct CreateCustomerCustomerBalanceTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateCustomerCustomerBalanceTransaction<'a> { +impl<'a> CreateCustomerCustomerBalanceTransactionBuilder<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, currency, description: None, expand: None, metadata: None } } } +/// Creates an immutable transaction that updates the customer’s credit [balance](https://stripe.com/docs/billing/customer/balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCustomerCustomerBalanceTransaction<'a> { + inner: CreateCustomerCustomerBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> CreateCustomerCustomerBalanceTransaction<'a> { - /// Creates an immutable transaction that updates the customer’s credit [balance](https://stripe.com/docs/billing/customer/balance). - pub fn send( + pub fn new( + customer: &'a stripe_shared::CustomerId, + amount: i64, + currency: stripe_types::Currency, + ) -> Self { + Self { + customer, + inner: CreateCustomerCustomerBalanceTransactionBuilder::new(amount, currency), + } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateCustomerCustomerBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/balance_transactions"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCustomerCustomerBalanceTransaction<'_> { + type Output = stripe_shared::CustomerBalanceTransaction; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Post, + format!("/customers/{customer}/balance_transactions"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerBalanceTransaction<'a> { +pub struct UpdateCustomerBalanceTransactionBuilder<'a> { /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -120,23 +243,63 @@ pub struct UpdateCustomerBalanceTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateCustomerBalanceTransaction<'a> { +impl<'a> UpdateCustomerBalanceTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Most credit balance transaction fields are immutable, but you may update its `description` and `metadata`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCustomerBalanceTransaction<'a> { + inner: UpdateCustomerBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + transaction: &'a str, +} impl<'a> UpdateCustomerBalanceTransaction<'a> { - /// Most credit balance transaction fields are immutable, but you may update its `description` and `metadata`. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId, transaction: &'a str) -> Self { + Self { customer, transaction, inner: UpdateCustomerBalanceTransactionBuilder::new() } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateCustomerBalanceTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - transaction: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/balance_transactions/{transaction}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCustomerBalanceTransaction<'_> { + type Output = stripe_shared::CustomerBalanceTransaction; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let transaction = self.transaction; + RequestBuilder::new( + StripeMethod::Post, + format!("/customers/{customer}/balance_transactions/{transaction}"), ) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/customer_cash_balance_transaction/requests.rs b/generated/stripe_core/src/customer_cash_balance_transaction/requests.rs index 7ffb1c3aa..dadc7b70c 100644 --- a/generated/stripe_core/src/customer_cash_balance_transaction/requests.rs +++ b/generated/stripe_core/src/customer_cash_balance_transaction/requests.rs @@ -1,5 +1,65 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCustomerCustomerCashBalanceTransaction<'a> { +pub struct RetrieveCustomerCashBalanceTransactionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveCustomerCashBalanceTransactionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves a specific cash balance transaction, which updated the customer’s [cash balance](https://stripe.com/docs/payments/customer-balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCustomerCashBalanceTransaction<'a> { + inner: RetrieveCustomerCashBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + transaction: &'a str, +} +impl<'a> RetrieveCustomerCashBalanceTransaction<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, transaction: &'a str) -> Self { + Self { customer, transaction, inner: RetrieveCustomerCashBalanceTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCustomerCashBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCustomerCashBalanceTransaction<'_> { + type Output = stripe_shared::CustomerCashBalanceTransaction; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let transaction = self.transaction; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/cash_balance_transactions/{transaction}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListCustomerCustomerCashBalanceTransactionBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,53 +78,66 @@ pub struct ListCustomerCustomerCashBalanceTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCustomerCustomerCashBalanceTransaction<'a> { +impl<'a> ListCustomerCustomerCashBalanceTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of transactions that modified the customer’s [cash balance](https://stripe.com/docs/payments/customer-balance). +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCustomerCustomerCashBalanceTransaction<'a> { + inner: ListCustomerCustomerCashBalanceTransactionBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> ListCustomerCustomerCashBalanceTransaction<'a> { - /// Returns a list of transactions that modified the customer’s [cash balance](https://stripe.com/docs/payments/customer-balance). - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/cash_balance_transactions"), self) + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: ListCustomerCustomerCashBalanceTransactionBuilder::new() } } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> - { - stripe::ListPaginator::from_list_params( - &format!("/customers/{customer}/cash_balance_transactions"), - self, - ) + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCustomerCashBalanceTransaction<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCustomerCashBalanceTransaction<'a> { - pub fn new() -> Self { - Self::default() + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveCustomerCashBalanceTransaction<'a> { - /// Retrieves a specific cash balance transaction, which updated the customer’s [cash balance](https://stripe.com/docs/payments/customer-balance). - pub fn send( +impl ListCustomerCustomerCashBalanceTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - transaction: &str, - ) -> stripe::Response { - client.get_query( - &format!("/customers/{customer}/cash_balance_transactions/{transaction}"), - self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCustomerCustomerCashBalanceTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new( + StripeMethod::Get, + format!("/customers/{customer}/cash_balance_transactions"), ) + .query(&self.inner) } } diff --git a/generated/stripe_core/src/customer_session/mod.rs b/generated/stripe_core/src/customer_session/mod.rs deleted file mode 100644 index 2228c469b..000000000 --- a/generated/stripe_core/src/customer_session/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "customer_session")] -mod requests; -pub(crate) mod types; -#[cfg(feature = "customer_session")] -pub use requests::*; diff --git a/generated/stripe_core/src/customer_session/requests.rs b/generated/stripe_core/src/customer_session/requests.rs deleted file mode 100644 index 958250f84..000000000 --- a/generated/stripe_core/src/customer_session/requests.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerSession<'a> { - /// Configuration for each component. Exactly 1 component must be enabled. - pub components: CreateCustomerSessionComponents, - /// The ID of an existing customer for which to create the customer session. - pub customer: &'a str, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CreateCustomerSession<'a> { - pub fn new(components: CreateCustomerSessionComponents, customer: &'a str) -> Self { - Self { components, customer, expand: None } - } -} -/// Configuration for each component. Exactly 1 component must be enabled. -#[derive(Copy, Clone, Debug, Default, serde::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, -} -impl CreateCustomerSessionComponents { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for buy button. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerSessionComponentsBuyButton { - /// Whether the buy button is enabled. - pub enabled: bool, -} -impl CreateCustomerSessionComponentsBuyButton { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Configuration for the pricing table. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerSessionComponentsPricingTable { - /// Whether the pricing table is enabled. - pub enabled: bool, -} -impl CreateCustomerSessionComponentsPricingTable { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -impl<'a> CreateCustomerSession<'a> { - /// 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 send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/customer_sessions", self, http_types::Method::Post) - } -} diff --git a/generated/stripe_core/src/customer_session/types.rs b/generated/stripe_core/src/customer_session/types.rs deleted file mode 100644 index cbd2e4bb5..000000000 --- a/generated/stripe_core/src/customer_session/types.rs +++ /dev/null @@ -1,22 +0,0 @@ -/// A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs) -/// control over a customer. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -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: stripe_types::Timestamp, - /// The customer the customer session was created for. - pub customer: stripe_types::Expandable, - /// The timestamp at which this customer session will expire. - pub expires_at: stripe_types::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, -} diff --git a/generated/stripe_core/src/customer_session_resource_components.rs b/generated/stripe_core/src/customer_session_resource_components.rs deleted file mode 100644 index 2539e1437..000000000 --- a/generated/stripe_core/src/customer_session_resource_components.rs +++ /dev/null @@ -1,6 +0,0 @@ -/// Configuration for the components supported by this customer session. -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct CustomerSessionResourceComponents { - pub buy_button: stripe_core::CustomerSessionResourceComponentsResourceBuyButton, - pub pricing_table: stripe_core::CustomerSessionResourceComponentsResourcePricingTable, -} diff --git a/generated/stripe_core/src/customer_session_resource_components_resource_buy_button.rs b/generated/stripe_core/src/customer_session_resource_components_resource_buy_button.rs deleted file mode 100644 index 748cb2ded..000000000 --- a/generated/stripe_core/src/customer_session_resource_components_resource_buy_button.rs +++ /dev/null @@ -1,6 +0,0 @@ -/// This hash contains whether the buy button is enabled. -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct CustomerSessionResourceComponentsResourceBuyButton { - /// Whether the buy button is enabled. - pub enabled: bool, -} diff --git a/generated/stripe_core/src/customer_session_resource_components_resource_pricing_table.rs b/generated/stripe_core/src/customer_session_resource_components_resource_pricing_table.rs deleted file mode 100644 index 6f8dbc4ed..000000000 --- a/generated/stripe_core/src/customer_session_resource_components_resource_pricing_table.rs +++ /dev/null @@ -1,6 +0,0 @@ -/// This hash contains whether the pricing table is enabled. -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct CustomerSessionResourceComponentsResourcePricingTable { - /// Whether the pricing table is enabled. - pub enabled: bool, -} diff --git a/generated/stripe_core/src/dispute/requests.rs b/generated/stripe_core/src/dispute/requests.rs index 510a361ef..d249a9989 100644 --- a/generated/stripe_core/src/dispute/requests.rs +++ b/generated/stripe_core/src/dispute/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListDispute<'a> { +pub struct ListDisputeBuilder<'a> { /// Only return disputes associated to the charge specified by this charge ID. #[serde(skip_serializing_if = "Option::is_none")] pub charge: Option<&'a str>, @@ -26,51 +30,135 @@ pub struct ListDispute<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListDispute<'a> { +impl<'a> ListDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your disputes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListDispute<'a> { + inner: ListDisputeBuilder<'a>, +} impl<'a> ListDispute<'a> { - /// Returns a list of your disputes. - pub fn send( + pub fn new() -> Self { + Self { inner: ListDisputeBuilder::new() } + } + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListDispute<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/disputes", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/disputes", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListDispute<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/disputes").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveDispute<'a> { +pub struct RetrieveDisputeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveDispute<'a> { +impl<'a> RetrieveDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the dispute with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveDispute<'a> { + inner: RetrieveDisputeBuilder<'a>, + dispute: &'a stripe_shared::DisputeId, +} impl<'a> RetrieveDispute<'a> { - /// Retrieves the dispute with the given ID. - pub fn send( + pub fn new(dispute: &'a stripe_shared::DisputeId) -> Self { + Self { dispute, inner: RetrieveDisputeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveDispute<'_> { + pub async fn send( &self, - client: &stripe::Client, - dispute: &stripe_shared::DisputeId, - ) -> stripe::Response { - client.get_query(&format!("/disputes/{dispute}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveDispute<'_> { + type Output = stripe_shared::Dispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Get, format!("/disputes/{dispute}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateDispute<'a> { +pub struct UpdateDisputeBuilder<'a> { /// Evidence to upload, to respond to a dispute. /// Updating any field in the hash will submit all fields in the hash for review. /// The combined character count of all fields is limited to 150,000. #[serde(skip_serializing_if = "Option::is_none")] - pub evidence: Option>, + pub evidence: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -86,7 +174,7 @@ pub struct UpdateDispute<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub submit: Option, } -impl<'a> UpdateDispute<'a> { +impl<'a> UpdateDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -95,7 +183,7 @@ impl<'a> UpdateDispute<'a> { /// Updating any field in the hash will submit all fields in the hash for review. /// The combined character count of all fields is limited to 150,000. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateDisputeEvidence<'a> { +pub struct UpdateDisputeBuilderEvidence<'a> { /// Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product. /// This information should include IP addresses, corresponding timestamps, and any detailed recorded activity. /// Has a maximum character count of 20,000. @@ -193,47 +281,121 @@ pub struct UpdateDisputeEvidence<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub uncategorized_text: Option<&'a str>, } -impl<'a> UpdateDisputeEvidence<'a> { +impl<'a> UpdateDisputeBuilderEvidence<'a> { pub fn new() -> Self { Self::default() } } +/// When you get a dispute, contacting your customer is always the best first step. +/// If that doesn’t work, you can submit evidence to help us resolve the dispute in your favor. +/// You can do this in your [dashboard](https://dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically. +/// +/// Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute. +/// To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories). +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateDispute<'a> { + inner: UpdateDisputeBuilder<'a>, + dispute: &'a stripe_shared::DisputeId, +} impl<'a> UpdateDispute<'a> { - /// When you get a dispute, contacting your customer is always the best first step. - /// If that doesn’t work, you can submit evidence to help us resolve the dispute in your favor. - /// You can do this in your [dashboard](https://dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically. - /// - /// Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute. - /// To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories). - pub fn send( + pub fn new(dispute: &'a stripe_shared::DisputeId) -> Self { + Self { dispute, inner: UpdateDisputeBuilder::new() } + } + pub fn evidence(mut self, evidence: UpdateDisputeBuilderEvidence<'a>) -> Self { + self.inner.evidence = Some(evidence); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn submit(mut self, submit: bool) -> Self { + self.inner.submit = Some(submit); + self + } +} +impl UpdateDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - dispute: &stripe_shared::DisputeId, - ) -> stripe::Response { - client.send_form(&format!("/disputes/{dispute}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateDispute<'_> { + type Output = stripe_shared::Dispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CloseDispute<'a> { +pub struct CloseDisputeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CloseDispute<'a> { +impl<'a> CloseDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost. +/// +/// The status of the dispute will change from `needs_response` to `lost`. +/// _Closing a dispute is irreversible_. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CloseDispute<'a> { + inner: CloseDisputeBuilder<'a>, + dispute: &'a stripe_shared::DisputeId, +} impl<'a> CloseDispute<'a> { - /// Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost. - /// - /// The status of the dispute will change from `needs_response` to `lost`. - /// _Closing a dispute is irreversible_. - pub fn send( + pub fn new(dispute: &'a stripe_shared::DisputeId) -> Self { + Self { dispute, inner: CloseDisputeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CloseDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - dispute: &stripe_shared::DisputeId, - ) -> stripe::Response { - client.send_form(&format!("/disputes/{dispute}/close"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CloseDispute<'_> { + type Output = stripe_shared::Dispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}/close")) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/event/requests.rs b/generated/stripe_core/src/event/requests.rs index e8b871e15..b98c32e6a 100644 --- a/generated/stripe_core/src/event/requests.rs +++ b/generated/stripe_core/src/event/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListEvent<'a> { +pub struct ListEventBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// Filter events by whether all webhooks were successfully delivered. @@ -34,43 +38,132 @@ pub struct ListEvent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub types: Option<&'a [&'a str]>, } -impl<'a> ListEvent<'a> { +impl<'a> ListEventBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// List events, going back up to 30 days. +/// Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/docs/api/events/object) `api_version` attribute (not according to your current Stripe API version or `Stripe-Version` header). +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListEvent<'a> { + inner: ListEventBuilder<'a>, +} impl<'a> ListEvent<'a> { - /// List events, going back up to 30 days. - /// Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/docs/api/events/object) `api_version` attribute (not according to your current Stripe API version or `Stripe-Version` header). - pub fn send( + pub fn new() -> Self { + Self { inner: ListEventBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn delivery_success(mut self, delivery_success: bool) -> Self { + self.inner.delivery_success = Some(delivery_success); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: &'a str) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn types(mut self, types: &'a [&'a str]) -> Self { + self.inner.types = Some(types); + self + } +} +impl ListEvent<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/events", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/events", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListEvent<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/events").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveEvent<'a> { +pub struct RetrieveEventBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveEvent<'a> { +impl<'a> RetrieveEventBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an event. +/// Supply the unique identifier of the event, which you might have received in a webhook. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveEvent<'a> { + inner: RetrieveEventBuilder<'a>, + id: &'a stripe_shared::EventId, +} impl<'a> RetrieveEvent<'a> { - /// Retrieves the details of an event. - /// Supply the unique identifier of the event, which you might have received in a webhook. - pub fn send( + pub fn new(id: &'a stripe_shared::EventId) -> Self { + Self { id, inner: RetrieveEventBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveEvent<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_shared::EventId, - ) -> stripe::Response { - client.get_query(&format!("/events/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveEvent<'_> { + type Output = stripe_shared::Event; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/events/{id}")).query(&self.inner) } } diff --git a/generated/stripe_core/src/file/requests.rs b/generated/stripe_core/src/file/requests.rs index f456ef8e6..2870a0d43 100644 --- a/generated/stripe_core/src/file/requests.rs +++ b/generated/stripe_core/src/file/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListFile<'a> { +pub struct ListFileBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A cursor for use in pagination. @@ -24,44 +28,123 @@ pub struct ListFile<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListFile<'a> { +impl<'a> ListFileBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of the files that your account has access to. +/// Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListFile<'a> { + inner: ListFileBuilder<'a>, +} impl<'a> ListFile<'a> { - /// Returns a list of the files that your account has access to. - /// Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top. - pub fn send( + pub fn new() -> Self { + Self { inner: ListFileBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn purpose(mut self, purpose: stripe_shared::FilePurpose) -> Self { + self.inner.purpose = Some(purpose); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListFile<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/files", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/files", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListFile<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/files").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveFile<'a> { +pub struct RetrieveFileBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveFile<'a> { +impl<'a> RetrieveFileBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing file object. +/// After you supply a unique file ID, Stripe returns the corresponding file object. +/// Learn how to [access file contents](https://stripe.com/docs/file-upload#download-file-contents). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveFile<'a> { + inner: RetrieveFileBuilder<'a>, + file: &'a stripe_shared::FileId, +} impl<'a> RetrieveFile<'a> { - /// Retrieves the details of an existing file object. - /// After you supply a unique file ID, Stripe returns the corresponding file object. - /// Learn how to [access file contents](https://stripe.com/docs/file-upload#download-file-contents). - pub fn send( + pub fn new(file: &'a stripe_shared::FileId) -> Self { + Self { file, inner: RetrieveFileBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveFile<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - file: &stripe_shared::FileId, - ) -> stripe::Response { - client.get_query(&format!("/files/{file}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveFile<'_> { + type Output = stripe_shared::File; + + fn build(&self) -> RequestBuilder { + let file = self.file; + RequestBuilder::new(StripeMethod::Get, format!("/files/{file}")).query(&self.inner) } } diff --git a/generated/stripe_core/src/file_link/requests.rs b/generated/stripe_core/src/file_link/requests.rs index dbc96f3ff..79521f31b 100644 --- a/generated/stripe_core/src/file_link/requests.rs +++ b/generated/stripe_core/src/file_link/requests.rs @@ -1,71 +1,59 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListFileLink<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveFileLinkBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// Filter links by their expiration status. By default, Stripe returns all links. - #[serde(skip_serializing_if = "Option::is_none")] - pub expired: Option, - /// Only return links for the given file. - #[serde(skip_serializing_if = "Option::is_none")] - pub file: Option<&'a str>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> ListFileLink<'a> { +impl<'a> RetrieveFileLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListFileLink<'a> { - /// Returns a list of file links. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/file_links", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/file_links", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves the file link with the given ID. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrieveFileLink<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: RetrieveFileLinkBuilder<'a>, + link: &'a stripe_shared::FileLinkId, } impl<'a> RetrieveFileLink<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(link: &'a stripe_shared::FileLinkId) -> Self { + Self { link, inner: RetrieveFileLinkBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrieveFileLink<'a> { - /// Retrieves the file link with the given ID. - pub fn send( +impl RetrieveFileLink<'_> { + pub async fn send( &self, - client: &stripe::Client, - link: &stripe_shared::FileLinkId, - ) -> stripe::Response { - client.get_query(&format!("/file_links/{link}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveFileLink<'_> { + type Output = stripe_shared::FileLink; + + fn build(&self) -> RequestBuilder { + let link = self.link; + RequestBuilder::new(StripeMethod::Get, format!("/file_links/{link}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFileLink<'a> { +pub struct CreateFileLinkBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -82,25 +70,66 @@ pub struct CreateFileLink<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateFileLink<'a> { +impl<'a> CreateFileLinkBuilder<'a> { pub fn new(file: &'a str) -> Self { Self { expand: None, expires_at: None, file, metadata: None } } } +/// Creates a new file link object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateFileLink<'a> { + inner: CreateFileLinkBuilder<'a>, +} impl<'a> CreateFileLink<'a> { - /// Creates a new file link object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/file_links", self, http_types::Method::Post) + pub fn new(file: &'a str) -> Self { + Self { inner: CreateFileLinkBuilder::new(file) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateFileLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateFileLink<'_> { + type Output = stripe_shared::FileLink; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/file_links").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFileLink<'a> { +pub struct UpdateFileLinkBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. #[serde(skip_serializing_if = "Option::is_none")] - pub expires_at: Option, + pub expires_at: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -108,7 +137,7 @@ pub struct UpdateFileLink<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateFileLink<'a> { +impl<'a> UpdateFileLinkBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -116,17 +145,156 @@ impl<'a> UpdateFileLink<'a> { /// A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateFileLinkExpiresAt { +pub enum UpdateFileLinkBuilderExpiresAt { Now, Timestamp(stripe_types::Timestamp), } +/// Updates an existing file link object. Expired links can no longer be updated. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateFileLink<'a> { + inner: UpdateFileLinkBuilder<'a>, + link: &'a stripe_shared::FileLinkId, +} impl<'a> UpdateFileLink<'a> { - /// Updates an existing file link object. Expired links can no longer be updated. - pub fn send( + pub fn new(link: &'a stripe_shared::FileLinkId) -> Self { + Self { link, inner: UpdateFileLinkBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: UpdateFileLinkBuilderExpiresAt) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateFileLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateFileLink<'_> { + type Output = stripe_shared::FileLink; + + fn build(&self) -> RequestBuilder { + let link = self.link; + RequestBuilder::new(StripeMethod::Post, format!("/file_links/{link}")).form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListFileLinkBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Filter links by their expiration status. By default, Stripe returns all links. + #[serde(skip_serializing_if = "Option::is_none")] + pub expired: Option, + /// Only return links for the given file. + #[serde(skip_serializing_if = "Option::is_none")] + pub file: Option<&'a str>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListFileLinkBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of file links. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListFileLink<'a> { + inner: ListFileLinkBuilder<'a>, +} +impl<'a> ListFileLink<'a> { + pub fn new() -> Self { + Self { inner: ListFileLinkBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expired(mut self, expired: bool) -> Self { + self.inner.expired = Some(expired); + self + } + + pub fn file(mut self, file: &'a str) -> Self { + self.inner.file = Some(file); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListFileLink<'_> { + pub async fn send( &self, - client: &stripe::Client, - link: &stripe_shared::FileLinkId, - ) -> stripe::Response { - client.send_form(&format!("/file_links/{link}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListFileLink<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/file_links").query(&self.inner) } } diff --git a/generated/stripe_core/src/mandate/requests.rs b/generated/stripe_core/src/mandate/requests.rs index d244fe515..6a89bb96f 100644 --- a/generated/stripe_core/src/mandate/requests.rs +++ b/generated/stripe_core/src/mandate/requests.rs @@ -1,21 +1,54 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveMandate<'a> { +pub struct RetrieveMandateBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveMandate<'a> { +impl<'a> RetrieveMandateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a Mandate object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveMandate<'a> { + inner: RetrieveMandateBuilder<'a>, + mandate: &'a stripe_shared::MandateId, +} impl<'a> RetrieveMandate<'a> { - /// Retrieves a Mandate object. - pub fn send( + pub fn new(mandate: &'a stripe_shared::MandateId) -> Self { + Self { mandate, inner: RetrieveMandateBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveMandate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - mandate: &stripe_shared::MandateId, - ) -> stripe::Response { - client.get_query(&format!("/mandates/{mandate}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveMandate<'_> { + type Output = stripe_shared::Mandate; + + fn build(&self) -> RequestBuilder { + let mandate = self.mandate; + RequestBuilder::new(StripeMethod::Get, format!("/mandates/{mandate}")).query(&self.inner) } } diff --git a/generated/stripe_core/src/mod.rs b/generated/stripe_core/src/mod.rs index 45b93a5eb..dc2ea0073 100644 --- a/generated/stripe_core/src/mod.rs +++ b/generated/stripe_core/src/mod.rs @@ -37,29 +37,14 @@ pub use stripe_shared::charge_outcome::*; pub use stripe_shared::charge_transfer_data::*; pub use stripe_shared::connect_collection_transfer::*; pub mod customer; -pub use stripe_shared::customer::*;pub use stripe_shared::customer_acceptance::*;pub use stripe_shared::customer_balance_customer_balance_settings::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction::*; +pub use stripe_shared::customer::*;pub use stripe_shared::customer_acceptance::*;pub use stripe_shared::customer_balance_customer_balance_settings::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction::*;pub use stripe_shared::customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction::*; pub mod customer_balance_transaction; pub use stripe_shared::customer_balance_transaction::*; pub mod customer_cash_balance_transaction; -pub use customer_session::types::*; pub use stripe_shared::customer_cash_balance_transaction::*; -pub mod customer_session; -#[doc(hidden)] -pub mod customer_session_resource_components; -#[doc(inline)] -pub use customer_session_resource_components::*; -#[doc(hidden)] -pub mod customer_session_resource_components_resource_buy_button; -#[doc(inline)] -pub use customer_session_resource_components_resource_buy_button::*; -#[doc(hidden)] -pub mod customer_session_resource_components_resource_pricing_table; -#[doc(inline)] -pub use customer_session_resource_components_resource_pricing_table::*; pub use stripe_shared::customer_tax::*; pub use stripe_shared::customer_tax_location::*; pub use stripe_shared::deleted_customer::*; -pub use stripe_shared::destination_details_unimplemented::*; pub mod dispute; pub use stripe_shared::dispute::*; pub use stripe_shared::dispute_evidence::*; @@ -118,8 +103,6 @@ pub use stripe_shared::payment_intent_next_action_paynow_display_qr_code::*; pub use stripe_shared::payment_intent_next_action_pix_display_qr_code::*; pub use stripe_shared::payment_intent_next_action_promptpay_display_qr_code::*; pub use stripe_shared::payment_intent_next_action_redirect_to_url::*; -pub use stripe_shared::payment_intent_next_action_swish_handle_redirect_or_display_qr_code::*; -pub use stripe_shared::payment_intent_next_action_swish_qr_code::*; pub use stripe_shared::payment_intent_next_action_verify_with_microdeposits::*; pub use stripe_shared::payment_intent_next_action_wechat_pay_display_qr_code::*; pub use stripe_shared::payment_intent_next_action_wechat_pay_redirect_to_android_app::*; @@ -134,7 +117,6 @@ pub use stripe_shared::payment_intent_payment_method_options_link::*; pub use stripe_shared::payment_intent_payment_method_options_mandate_options_acss_debit::*; pub use stripe_shared::payment_intent_payment_method_options_mandate_options_sepa_debit::*; pub use stripe_shared::payment_intent_payment_method_options_sepa_debit::*; -pub use stripe_shared::payment_intent_payment_method_options_swish::*; pub use stripe_shared::payment_intent_payment_method_options_us_bank_account::*; pub use stripe_shared::payment_intent_processing::*; pub use stripe_shared::payment_intent_processing_customer_notification::*; @@ -145,9 +127,6 @@ pub use stripe_shared::payout::*; pub use stripe_shared::platform_tax_fee::*; pub mod refund; pub use stripe_shared::refund::*; -pub use stripe_shared::refund_destination_details::*; -pub use stripe_shared::refund_destination_details_card::*; -pub use stripe_shared::refund_destination_details_generic::*; pub use stripe_shared::refund_next_action::*; pub use stripe_shared::refund_next_action_display_details::*; pub use stripe_shared::reserve_transaction::*; diff --git a/generated/stripe_core/src/payment_intent/requests.rs b/generated/stripe_core/src/payment_intent/requests.rs index c56754f87..33e39663f 100644 --- a/generated/stripe_core/src/payment_intent/requests.rs +++ b/generated/stripe_core/src/payment_intent/requests.rs @@ -1,82 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentIntent<'a> { - /// A filter on the list, based on the object `created` field. - /// The value can be a string with an integer Unix timestamp or a dictionary with a number of different query options. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// Only return PaymentIntents for the customer that this customer ID specifies. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListPaymentIntent<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListPaymentIntent<'a> { - /// Returns a list of PaymentIntents. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_intents", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payment_intents", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentIntent<'a> { - /// The client secret of the PaymentIntent. - /// We require it if you use a publishable key to retrieve the source. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_secret: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePaymentIntent<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrievePaymentIntent<'a> { - /// Retrieves the details of a PaymentIntent that has previously been created. - /// - /// You can retrieve a PaymentIntent client-side using a publishable key when the `client_secret` is in the query string. - /// - /// - /// If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties. - /// Refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.get_query(&format!("/payment_intents/{intent}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchPaymentIntent<'a> { +pub struct SearchPaymentIntentBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -93,32 +20,65 @@ pub struct SearchPaymentIntent<'a> { /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for payment intents](https://stripe.com/docs/search#query-fields-for-payment-intents). pub query: &'a str, } -impl<'a> SearchPaymentIntent<'a> { +impl<'a> SearchPaymentIntentBuilder<'a> { pub fn new(query: &'a str) -> Self { Self { expand: None, limit: None, page: None, query } } } +/// Search for PaymentIntents you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchPaymentIntent<'a> { + inner: SearchPaymentIntentBuilder<'a>, +} impl<'a> SearchPaymentIntent<'a> { - /// Search for PaymentIntents you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( + pub fn new(query: &'a str) -> Self { + Self { inner: SearchPaymentIntentBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self + } +} +impl SearchPaymentIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_intents/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/payment_intents/search", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SearchPaymentIntent<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_intents/search").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntent<'a> { +pub struct CreatePaymentIntentBuilder<'a> { /// Amount intended to be collected by this PaymentIntent. /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). @@ -131,7 +91,7 @@ pub struct CreatePaymentIntent<'a> { pub application_fee_amount: Option, /// When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntent's other parameters. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_payment_methods: Option, + pub automatic_payment_methods: Option, /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: Option, @@ -140,7 +100,6 @@ pub struct CreatePaymentIntent<'a> { /// When creating and confirming a PaymentIntent at the same time, you can also provide the parameters available in the [Confirm API](https://stripe.com/docs/api/payment_intents/confirm). #[serde(skip_serializing_if = "Option::is_none")] pub confirm: Option, - /// Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment. #[serde(skip_serializing_if = "Option::is_none")] pub confirmation_method: Option, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -171,7 +130,7 @@ pub struct CreatePaymentIntent<'a> { /// This hash contains details about the Mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_data: Option>, + pub mandate_data: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -182,7 +141,7 @@ pub struct CreatePaymentIntent<'a> { /// Use this parameter in scenarios where you collect card details and [charge them later](https://stripe.com/docs/payments/cards/charging-saved-cards). /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). #[serde(skip_serializing_if = "Option::is_none")] - pub off_session: Option, + pub off_session: Option, /// The Stripe account ID that these funds are intended for. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] @@ -200,10 +159,10 @@ pub struct CreatePaymentIntent<'a> { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment method-specific configuration for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The list of payment method types (for example, a card) that this PaymentIntent can use. /// If you don't provide this, it defaults to ["card"]. /// Use `automatic_payment_methods` to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). @@ -212,7 +171,7 @@ pub struct CreatePaymentIntent<'a> { /// Options to configure Radar. /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// Email address to send the receipt to. /// If you specify `receipt_email` for a payment in live mode, you send a receipt regardless of your [email settings](https://dashboard.stripe.com/account/emails). #[serde(skip_serializing_if = "Option::is_none")] @@ -232,9 +191,8 @@ pub struct CreatePaymentIntent<'a> { pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, - /// For card charges, use [statement_descriptor_suffix](https://stripe.com/docs/payments/account/statement-descriptors#dynamic). - /// Otherwise, you can use this value as the complete description of a charge on your customers' statements. + pub shipping: Option>, + /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. /// It must contain at least one letter and be 1–22 characters long. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, @@ -246,7 +204,7 @@ pub struct CreatePaymentIntent<'a> { /// The parameters that you can use to automatically create a Transfer. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// A string that identifies the resulting payment as part of a group. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers). #[serde(skip_serializing_if = "Option::is_none")] @@ -255,7 +213,7 @@ pub struct CreatePaymentIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub use_stripe_sdk: Option, } -impl<'a> CreatePaymentIntent<'a> { +impl<'a> CreatePaymentIntentBuilder<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, @@ -294,17 +252,17 @@ impl<'a> CreatePaymentIntent<'a> { } /// When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntent's other parameters. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentAutomaticPaymentMethods { +pub struct CreatePaymentIntentBuilderAutomaticPaymentMethods { /// Controls whether this PaymentIntent will accept redirect-based payment methods. /// /// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. /// To [confirm](https://stripe.com/docs/api/payment_intents/confirm) this PaymentIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the payment. #[serde(skip_serializing_if = "Option::is_none")] - pub allow_redirects: Option, + pub allow_redirects: Option, /// Whether this feature is enabled. pub enabled: bool, } -impl CreatePaymentIntentAutomaticPaymentMethods { +impl CreatePaymentIntentBuilderAutomaticPaymentMethods { pub fn new(enabled: bool) -> Self { Self { allow_redirects: None, enabled } } @@ -314,13 +272,13 @@ impl CreatePaymentIntentAutomaticPaymentMethods { /// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. /// To [confirm](https://stripe.com/docs/api/payment_intents/confirm) this PaymentIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the payment. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +pub enum CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { Always, Never, } -impl CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +impl CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects::*; + use CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects::*; match self { Always => "always", Never => "never", @@ -328,10 +286,10 @@ impl CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { } } -impl std::str::FromStr for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +impl std::str::FromStr for CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects::*; + use CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects::*; match s { "always" => Ok(Always), "never" => Ok(Never), @@ -339,18 +297,18 @@ impl std::str::FromStr for CreatePaymentIntentAutomaticPaymentMethodsAllowRedire } } } -impl std::fmt::Display for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +impl std::fmt::Display for CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +impl std::fmt::Debug for CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects { +impl serde::Serialize for CreatePaymentIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -361,18 +319,20 @@ impl serde::Serialize for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirec /// This hash contains details about the Mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentMandateData<'a> { +pub struct CreatePaymentIntentBuilderMandateData<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: CreatePaymentIntentMandateDataCustomerAcceptance<'a>, + pub customer_acceptance: CreatePaymentIntentBuilderMandateDataCustomerAcceptance<'a>, } -impl<'a> CreatePaymentIntentMandateData<'a> { - pub fn new(customer_acceptance: CreatePaymentIntentMandateDataCustomerAcceptance<'a>) -> Self { +impl<'a> CreatePaymentIntentBuilderMandateData<'a> { + pub fn new( + customer_acceptance: CreatePaymentIntentBuilderMandateDataCustomerAcceptance<'a>, + ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentMandateDataCustomerAcceptance<'a> { +pub struct CreatePaymentIntentBuilderMandateDataCustomerAcceptance<'a> { /// The time at which the customer accepted the Mandate. #[serde(skip_serializing_if = "Option::is_none")] pub accepted_at: Option, @@ -385,23 +345,23 @@ pub struct CreatePaymentIntentMandateDataCustomerAcceptance<'a> { /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] - pub type_: CreatePaymentIntentMandateDataCustomerAcceptanceType, + pub type_: CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType, } -impl<'a> CreatePaymentIntentMandateDataCustomerAcceptance<'a> { - pub fn new(type_: CreatePaymentIntentMandateDataCustomerAcceptanceType) -> Self { +impl<'a> CreatePaymentIntentBuilderMandateDataCustomerAcceptance<'a> { + pub fn new(type_: CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType) -> Self { Self { accepted_at: None, offline: None, online: None, type_ } } } /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentMandateDataCustomerAcceptanceType { +pub enum CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { Offline, Online, } -impl CreatePaymentIntentMandateDataCustomerAcceptanceType { +impl CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentMandateDataCustomerAcceptanceType::*; + use CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -409,10 +369,10 @@ impl CreatePaymentIntentMandateDataCustomerAcceptanceType { } } -impl std::str::FromStr for CreatePaymentIntentMandateDataCustomerAcceptanceType { +impl std::str::FromStr for CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentMandateDataCustomerAcceptanceType::*; + use CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -420,18 +380,18 @@ impl std::str::FromStr for CreatePaymentIntentMandateDataCustomerAcceptanceType } } } -impl std::fmt::Display for CreatePaymentIntentMandateDataCustomerAcceptanceType { +impl std::fmt::Display for CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentMandateDataCustomerAcceptanceType { +impl std::fmt::Debug for CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentMandateDataCustomerAcceptanceType { +impl serde::Serialize for CreatePaymentIntentBuilderMandateDataCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -444,7 +404,7 @@ impl serde::Serialize for CreatePaymentIntentMandateDataCustomerAcceptanceType { /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePaymentIntentOffSession { +pub enum CreatePaymentIntentBuilderOffSession { Bool(bool), OneOff, Recurring, @@ -453,7 +413,7 @@ pub enum CreatePaymentIntentOffSession { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodData<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -468,22 +428,22 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -492,10 +452,10 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -504,13 +464,13 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -528,7 +488,7 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -544,27 +504,24 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: CreatePaymentIntentPaymentMethodDataType, + pub type_: CreatePaymentIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -572,8 +529,8 @@ pub struct CreatePaymentIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> CreatePaymentIntentPaymentMethodData<'a> { - pub fn new(type_: CreatePaymentIntentPaymentMethodDataType) -> Self { +impl<'a> CreatePaymentIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: CreatePaymentIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -607,7 +564,6 @@ impl<'a> CreatePaymentIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -617,20 +573,20 @@ impl<'a> CreatePaymentIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> CreatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataBacsDebit<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -638,17 +594,17 @@ pub struct CreatePaymentIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> CreatePaymentIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataBillingDetails<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { /// Billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// Email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -659,14 +615,14 @@ pub struct CreatePaymentIntentPaymentMethodDataBillingDetails<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, } -impl<'a> CreatePaymentIntentPaymentMethodDataBillingDetails<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { pub fn new() -> Self { Self::default() } } /// Billing address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -686,30 +642,30 @@ pub struct CreatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataBoleto<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> CreatePaymentIntentPaymentMethodDataBoleto<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataEps { +pub struct CreatePaymentIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentIntentPaymentMethodDataEps { +impl CreatePaymentIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -717,7 +673,7 @@ impl CreatePaymentIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodDataEpsBank { +pub enum CreatePaymentIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -749,9 +705,9 @@ pub enum CreatePaymentIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodDataEpsBank { +impl CreatePaymentIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataEpsBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -786,10 +742,10 @@ impl CreatePaymentIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataEpsBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -823,18 +779,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataEpsBank { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -844,27 +800,28 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataFpx { +pub struct CreatePaymentIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: + Option, /// The customer's bank. - pub bank: CreatePaymentIntentPaymentMethodDataFpxBank, + pub bank: CreatePaymentIntentBuilderPaymentMethodDataFpxBank, } -impl CreatePaymentIntentPaymentMethodDataFpx { - pub fn new(bank: CreatePaymentIntentPaymentMethodDataFpxBank) -> Self { +impl CreatePaymentIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: CreatePaymentIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +pub enum CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -872,10 +829,10 @@ impl CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -883,18 +840,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxAccountHolderT } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -905,7 +862,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxAccountHolderTy /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodDataFpxBank { +pub enum CreatePaymentIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -931,9 +888,9 @@ pub enum CreatePaymentIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodDataFpxBank { +impl CreatePaymentIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataFpxBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -962,10 +919,10 @@ impl CreatePaymentIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataFpxBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -993,18 +950,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxBank { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1014,12 +971,12 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataIdeal { +pub struct CreatePaymentIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentIntentPaymentMethodDataIdeal { +impl CreatePaymentIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -1027,7 +984,7 @@ impl CreatePaymentIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodDataIdealBank { +pub enum CreatePaymentIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -1036,7 +993,6 @@ pub enum CreatePaymentIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -1047,9 +1003,9 @@ pub enum CreatePaymentIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodDataIdealBank { +impl CreatePaymentIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataIdealBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -1059,7 +1015,6 @@ impl CreatePaymentIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -1072,10 +1027,10 @@ impl CreatePaymentIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataIdealBank::*; + use CreatePaymentIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -1085,7 +1040,6 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -1097,18 +1051,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataIdealBank { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1118,24 +1072,24 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataKlarna { +pub struct CreatePaymentIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl CreatePaymentIntentPaymentMethodDataKlarna { +impl CreatePaymentIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataP24 { +pub struct CreatePaymentIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentIntentPaymentMethodDataP24 { +impl CreatePaymentIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -1143,7 +1097,7 @@ impl CreatePaymentIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodDataP24Bank { +pub enum CreatePaymentIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -1168,14 +1122,13 @@ pub enum CreatePaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodDataP24Bank { +impl CreatePaymentIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataP24Bank::*; + use CreatePaymentIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -1201,17 +1154,16 @@ impl CreatePaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataP24Bank::*; + use CreatePaymentIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -1237,24 +1189,23 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataP24Bank { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1265,41 +1216,41 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataP24Bank { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataRadarOptions<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> CreatePaymentIntentPaymentMethodDataRadarOptions<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataSepaDebit<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> CreatePaymentIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataSofort { +pub struct CreatePaymentIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: CreatePaymentIntentPaymentMethodDataSofortCountry, + pub country: CreatePaymentIntentBuilderPaymentMethodDataSofortCountry, } -impl CreatePaymentIntentPaymentMethodDataSofort { - pub fn new(country: CreatePaymentIntentPaymentMethodDataSofortCountry) -> Self { +impl CreatePaymentIntentBuilderPaymentMethodDataSofort { + pub fn new(country: CreatePaymentIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodDataSofortCountry { +pub enum CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -1307,9 +1258,9 @@ pub enum CreatePaymentIntentPaymentMethodDataSofortCountry { It, Nl, } -impl CreatePaymentIntentPaymentMethodDataSofortCountry { +impl CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataSofortCountry::*; + use CreatePaymentIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -1321,10 +1272,10 @@ impl CreatePaymentIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataSofortCountry::*; + use CreatePaymentIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -1336,18 +1287,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1360,7 +1311,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodDataType { +pub enum CreatePaymentIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -1389,16 +1340,15 @@ pub enum CreatePaymentIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodDataType { +impl CreatePaymentIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataType::*; + use CreatePaymentIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -1428,7 +1378,6 @@ impl CreatePaymentIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -1437,10 +1386,10 @@ impl CreatePaymentIntentPaymentMethodDataType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataType { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataType::*; + use CreatePaymentIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -1470,7 +1419,6 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -1478,18 +1426,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataType { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataType { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataType { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1499,17 +1447,17 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataUsBankAccount<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -1517,20 +1465,20 @@ pub struct CreatePaymentIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreatePaymentIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -1538,10 +1486,12 @@ impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -1549,18 +1499,22 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAcco } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1570,13 +1524,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccou } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +pub enum CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -1584,10 +1538,10 @@ impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -1595,18 +1549,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAcco } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1616,124 +1570,123 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccou } /// Payment method-specific configuration for this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptions<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option>, + pub affirm: Option>, /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option>, + pub afterpay_clearpay: + Option>, /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// Configuration for any card payments attempted on this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, + pub cashapp: Option, /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option>, + pub customer_balance: Option>, /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option>, + pub konbini: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub pix: Option, + pub pix: Option, /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay: Option, - /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. + pub promptpay: Option, + /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub revolut_pay: Option, /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option>, + pub sofort: Option, /// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option>, + pub wechat_pay: Option>, /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub zip: Option, + pub zip: Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptions<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -1744,20 +1697,20 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, - /// Bank account verification method. + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -1769,28 +1722,30 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub interval_description: Option<&'a str>, /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_schedule: - Option, + pub payment_schedule: Option< + CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule, + >, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: - Option, + pub transaction_type: Option< + CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, + >, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -1800,11 +1755,11 @@ impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedu } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -1814,7 +1769,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1822,14 +1777,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -1840,13 +1795,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -1855,11 +1810,11 @@ impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionTy } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -1868,7 +1823,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1876,14 +1831,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -1901,14 +1856,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -1917,10 +1872,10 @@ impl CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -1929,18 +1884,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetup } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1948,16 +1903,16 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupF serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -1966,10 +1921,12 @@ impl CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -1978,18 +1935,22 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerif } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1999,14 +1960,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerifi } /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAffirm<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Affirm authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_locale: Option<&'a str>, @@ -2019,9 +1980,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsAffirm<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { pub fn new() -> Self { Self::default() } @@ -2032,40 +1994,40 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2082,40 +2044,40 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMe /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2125,7 +2087,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutu } /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. @@ -2133,7 +2095,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: - Option, + Option, /// An internal identifier or reference that this payment corresponds to. /// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes. /// This field differs from the statement descriptor and item name. @@ -2149,9 +2111,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { pub fn new() -> Self { Self::default() } @@ -2162,40 +2124,48 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2212,40 +2182,48 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpa /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2255,7 +2233,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpa } /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAlipay { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAlipay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2265,9 +2243,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsAlipay { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAlipay { pub fn new() -> Self { Self::default() } @@ -2281,13 +2260,13 @@ impl CreatePaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2295,10 +2274,10 @@ impl CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2306,18 +2285,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFut } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2327,7 +2306,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutu } /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsAuBecsDebit { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2338,9 +2317,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAuBecsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebit { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { pub fn new() -> Self { Self::default() } @@ -2354,14 +2333,14 @@ impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2370,10 +2349,12 @@ impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2382,18 +2363,22 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSet } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2403,7 +2388,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetu } /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsBacsDebit { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2414,9 +2399,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsBacsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreatePaymentIntentPaymentMethodOptionsBacsDebit { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebit { pub fn new() -> Self { Self::default() } @@ -2430,14 +2415,14 @@ impl CreatePaymentIntentPaymentMethodOptionsBacsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2446,10 +2431,10 @@ impl CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2458,18 +2443,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetup } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2479,11 +2464,11 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupF } /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsBancontact { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_language: - Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2494,24 +2479,24 @@ pub struct CreatePaymentIntentPaymentMethodOptionsBancontact { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreatePaymentIntentPaymentMethodOptionsBancontact { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -2521,10 +2506,12 @@ impl CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -2534,18 +2521,22 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactPref } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2562,13 +2553,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactPrefe /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2576,10 +2567,12 @@ impl CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2587,91 +2580,20 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactSetu } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - None, -} -impl CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2681,7 +2603,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBlikSetupFuture } /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsBoleto { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsBoleto { /// The number of calendar days before a Boleto voucher expires. /// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time. #[serde(skip_serializing_if = "Option::is_none")] @@ -2695,9 +2617,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsBoleto { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBoleto { pub fn new() -> Self { Self::default() } @@ -2711,14 +2634,14 @@ impl CreatePaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -2727,10 +2650,10 @@ impl CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -2739,18 +2662,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFut } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2760,14 +2683,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutu } /// Configuration for any card payments attempted on this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCard<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCard<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// A single-use `cvc_update` Token that represents a card CVC value. /// When provided, the CVC value will be verified during the card payment attempt. /// This parameter can only be provided during confirmation. @@ -2777,10 +2700,11 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, + pub installments: Option, /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// When specified, this parameter indicates that a transaction will be marked /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -2790,33 +2714,31 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_extended_authorization: - Option, - /// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. + Option, + /// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_incremental_authorization: - Option, + Option, /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_multicapture: - Option, + Option, /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub request_overcapture: Option, + pub request_overcapture: + Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e. - /// using the cvc_token parameter). - #[serde(skip_serializing_if = "Option::is_none")] - pub require_cvc_recollection: Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -2826,7 +2748,8 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Provides information about a card payment that customers see on their statements. /// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor. /// Maximum 22 characters. @@ -2839,12 +2762,8 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCard<'a> { /// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix_kanji: Option<&'a str>, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this payment. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsCard<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } @@ -2855,40 +2774,40 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2900,7 +2819,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardCaptureMeth /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardInstallments { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallments { /// Setting to true enables installments for this PaymentIntent. /// This will cause the response to contain a list of available installment plans. /// Setting to false will prevent any selected plan from applying to a charge. @@ -2909,9 +2828,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option, + pub plan: Option, } -impl CreatePaymentIntentPaymentMethodOptionsCardInstallments { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } @@ -2919,21 +2838,21 @@ impl CreatePaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. pub count: u64, /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. - pub interval: CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, + pub interval: CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, /// Type of installment plan, one of `fixed_count`. #[serde(rename = "type")] - pub type_: CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + pub type_: CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, } -impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { pub fn new( count: u64, - interval: CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, - type_: CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + interval: CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, + type_: CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, ) -> Self { Self { count, interval, type_ } } @@ -2941,40 +2860,48 @@ impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { Month, } -impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match self { Month => "month", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match s { "month" => Ok(Month), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2984,40 +2911,40 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallment } /// Type of installment plan, one of `fixed_count`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { FixedCount, } -impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match self { FixedCount => "fixed_count", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match s { "fixed_count" => Ok(FixedCount), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3027,13 +2954,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallment } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// A description of the mandate or subscription that is meant to be displayed to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -3043,7 +2970,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -3056,14 +2983,15 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { pub start_date: stripe_types::Timestamp, /// Specifies the type of mandates supported. Possible values are `india`. #[serde(skip_serializing_if = "Option::is_none")] - pub supported_types: - Option<&'a [CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, + pub supported_types: Option< + &'a [CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes], + >, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { pub fn new( amount: i64, - amount_type: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, - interval: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + amount_type: CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, + interval: CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, reference: &'a str, start_date: stripe_types::Timestamp, ) -> Self { @@ -3084,13 +3012,13 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -3098,10 +3026,12 @@ impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -3109,18 +3039,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOpt } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3130,16 +3066,16 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOpti } /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { Day, Month, Sporadic, Week, Year, } -impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { Day => "day", Month => "month", @@ -3150,10 +3086,12 @@ impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -3164,18 +3102,20 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOpt } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3185,40 +3125,48 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOpti } /// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { India, } -impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { India => "india", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { "india" => Ok(India), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3230,7 +3178,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOpti /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardNetwork { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -3243,9 +3191,9 @@ pub enum CreatePaymentIntentPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl CreatePaymentIntentPaymentMethodOptionsCardNetwork { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardNetwork::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -3262,10 +3210,10 @@ impl CreatePaymentIntentPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardNetwork::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -3282,18 +3230,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardNetwork { } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardNetwork { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3303,13 +3251,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardNetwork { } /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { IfAvailable, Never, } -impl CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -3317,10 +3265,12 @@ impl CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -3328,18 +3278,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestExt } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3347,15 +3303,15 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestExte serializer.serialize_str(self.as_str()) } } -/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. +/// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { IfAvailable, Never, } -impl CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -3364,11 +3320,11 @@ impl CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -3377,7 +3333,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3385,14 +3341,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn serialize(&self, serializer: S) -> Result where @@ -3403,13 +3359,13 @@ impl serde::Serialize } /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { IfAvailable, Never, } -impl CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -3417,10 +3373,10 @@ impl CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -3428,18 +3384,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestMul } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3449,13 +3405,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestMult } /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { IfAvailable, Never, } -impl CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -3463,10 +3419,10 @@ impl CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -3474,18 +3430,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestOve } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3495,49 +3451,47 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestOver } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3554,14 +3508,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestThre /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -3570,10 +3524,10 @@ impl CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -3582,411 +3536,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardSetupFutur } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this payment. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - pub cryptogram: &'a str, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// The exemption requested via 3DS and accepted by the issuer at authentication time. - #[serde(skip_serializing_if = "Option::is_none")] - pub exemption_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly - #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. - #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). - pub transaction_id: &'a str, - /// The version of 3D Secure that was performed. - pub version: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - pub fn new( - cryptogram: &'a str, - transaction_id: &'a str, - version: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, - ) -> Self { - Self { - ares_trans_status: None, - cryptogram, - electronic_commerce_indicator: None, - exemption_indicator: None, - network_options: None, - requestor_challenge_indicator: None, - transaction_id, - version, - } - } -} -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", - } - } -} - -impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The exemption requested via 3DS and accepted by the issuer at authentication time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - LowRisk, - None, -} -impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match self { - LowRisk => "low_risk", - None => "none", - } - } -} - -impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match s { - "low_risk" => Ok(LowRisk), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO -pub cb_avalgo: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_score: Option, - -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", - } - } -} - -impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match s { - "0" => Ok(V0), - "1" => Ok(V1), - "2" => Ok(V2), - "3" => Ok(V3), - "4" => Ok(V4), - "A" => Ok(A), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The version of 3D Secure that was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, -} -impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3996,14 +3557,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecur } /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCashapp { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCashapp { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4013,9 +3574,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCashapp { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsCashapp { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCashapp { pub fn new() -> Self { Self::default() } @@ -4026,40 +3588,40 @@ impl CreatePaymentIntentPaymentMethodOptionsCashapp { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4076,14 +3638,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappCaptureM /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4092,10 +3654,10 @@ impl CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4104,18 +3666,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCashappSetupFu } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4125,15 +3687,16 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappSetupFut } /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] pub bank_transfer: - Option>, + Option>, /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option, + pub funding_type: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4144,16 +3707,16 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { pub fn new() -> Self { Self::default() } } /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] pub eu_bank_transfer: Option>, @@ -4162,15 +3725,15 @@ pub eu_bank_transfer: Option>, /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[serde(skip_serializing_if = "Option::is_none")] -pub requested_address_types: Option<&'a [CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, +pub requested_address_types: Option<&'a [CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[serde(rename = "type")] -pub type_: CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, +pub type_: CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { pub fn new( - type_: CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, + type_: CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, ) -> Self { Self { eu_bank_transfer: None, requested_address_types: None, type_ } } @@ -4180,7 +3743,8 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ Aba, Iban, Sepa, @@ -4189,9 +3753,11 @@ pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferReque Swift, Zengin, } -impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +impl + CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match self { Aba => "aba", Iban => "iban", @@ -4204,61 +3770,51 @@ impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequested } } -impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match s { - "aba" => Ok(Aba), - "iban" => Ok(Iban), - "sepa" => Ok(Sepa), - "sort_code" => Ok(SortCode), - "spei" => Ok(Spei), - "swift" => Ok(Swift), - "zengin" => Ok(Zengin), - _ => Err(()), + "aba" => Ok(Aba), +"iban" => Ok(Iban), +"sepa" => Ok(Sepa), +"sort_code" => Ok(SortCode), +"spei" => Ok(Spei), +"swift" => Ok(Swift), +"zengin" => Ok(Zengin), +_ => Err(()) + } } } -impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { EuBankTransfer, GbBankTransfer, JpBankTransfer, MxBankTransfer, UsBankTransfer, } -impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match self { EuBankTransfer => "eu_bank_transfer", GbBankTransfer => "gb_bank_transfer", @@ -4269,10 +3825,12 @@ impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match s { "eu_bank_transfer" => Ok(EuBankTransfer), "gb_bank_transfer" => Ok(GbBankTransfer), @@ -4283,18 +3841,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanc } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4305,40 +3869,44 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalance /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { BankTransfer, } -impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match self { BankTransfer => "bank_transfer", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match s { "bank_transfer" => Ok(BankTransfer), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4355,40 +3923,48 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalance /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4398,7 +3974,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalance } /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsEps { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsEps { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4408,9 +3984,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsEps { +impl CreatePaymentIntentBuilderPaymentMethodOptionsEps { pub fn new() -> Self { Self::default() } @@ -4424,40 +4001,40 @@ impl CreatePaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4467,7 +4044,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureU } /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsFpx { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsFpx { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4477,9 +4054,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsFpx { +impl CreatePaymentIntentBuilderPaymentMethodOptionsFpx { pub fn new() -> Self { Self::default() } @@ -4493,40 +4071,40 @@ impl CreatePaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4536,7 +4114,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureU } /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsGiropay { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsGiropay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4546,9 +4124,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsGiropay { +impl CreatePaymentIntentBuilderPaymentMethodOptionsGiropay { pub fn new() -> Self { Self::default() } @@ -4562,40 +4141,40 @@ impl CreatePaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4605,7 +4184,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFut } /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsGrabpay { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsGrabpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4615,9 +4194,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsGrabpay { +impl CreatePaymentIntentBuilderPaymentMethodOptionsGrabpay { pub fn new() -> Self { Self::default() } @@ -4631,40 +4211,40 @@ impl CreatePaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4674,7 +4254,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFut } /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsIdeal { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsIdeal { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4684,9 +4264,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsIdeal { +impl CreatePaymentIntentBuilderPaymentMethodOptionsIdeal { pub fn new() -> Self { Self::default() } @@ -4700,13 +4281,13 @@ impl CreatePaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -4714,10 +4295,10 @@ impl CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -4725,18 +4306,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutu } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4746,17 +4327,18 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutur } /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsKlarna { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsKlarna { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Klarna authorization page that the customer is redirected to #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -4766,9 +4348,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsKlarna { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsKlarna { +impl CreatePaymentIntentBuilderPaymentMethodOptionsKlarna { pub fn new() -> Self { Self::default() } @@ -4779,40 +4362,40 @@ impl CreatePaymentIntentPaymentMethodOptionsKlarna { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4823,7 +4406,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMe /// Preferred language of the Klarna authorization page that the customer is redirected to #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -4871,9 +4454,9 @@ pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -4924,10 +4507,10 @@ impl CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -4977,18 +4560,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferre } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5005,40 +4588,40 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5048,7 +4631,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutu } /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsKonbini<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { /// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. /// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness. /// We recommend to use the customer's phone number. @@ -5075,9 +4658,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsKonbini<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { pub fn new() -> Self { Self::default() } @@ -5091,40 +4675,40 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5134,14 +4718,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFut } /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsLink<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsLink<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// \[Deprecated\] This is a legacy parameter that no longer has any function. #[serde(skip_serializing_if = "Option::is_none")] pub persistent_token: Option<&'a str>, @@ -5154,9 +4738,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsLink<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsLink<'a> { pub fn new() -> Self { Self::default() } @@ -5167,40 +4752,40 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5217,13 +4802,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMeth /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -5231,10 +4816,10 @@ impl CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -5242,18 +4827,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutur } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5263,7 +4848,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkSetupFuture } /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsOxxo { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsOxxo { /// The number of calendar days before an OXXO voucher expires. /// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. #[serde(skip_serializing_if = "Option::is_none")] @@ -5277,9 +4862,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsOxxo { +impl CreatePaymentIntentBuilderPaymentMethodOptionsOxxo { pub fn new() -> Self { Self::default() } @@ -5293,40 +4879,40 @@ impl CreatePaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5336,7 +4922,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFuture } /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsP24 { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsP24 { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -5346,12 +4932,13 @@ pub struct CreatePaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Confirm that the payer has accepted the P24 terms and conditions. #[serde(skip_serializing_if = "Option::is_none")] pub tos_shown_and_accepted: Option, } -impl CreatePaymentIntentPaymentMethodOptionsP24 { +impl CreatePaymentIntentBuilderPaymentMethodOptionsP24 { pub fn new() -> Self { Self::default() } @@ -5365,40 +4952,40 @@ impl CreatePaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5408,7 +4995,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureU } /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsPaynow { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsPaynow { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -5418,9 +5005,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsPaynow { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPaynow { pub fn new() -> Self { Self::default() } @@ -5434,40 +5022,40 @@ impl CreatePaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5477,13 +5065,14 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutu } /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsPaypal<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. /// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. #[serde(skip_serializing_if = "Option::is_none")] @@ -5500,49 +5089,50 @@ pub struct CreatePaymentIntentPaymentMethodOptionsPaypal<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsPaypal<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { Manual, } -impl CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5553,7 +5143,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMe /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -5578,9 +5168,9 @@ pub enum CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -5608,10 +5198,10 @@ impl CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -5638,18 +5228,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalPreferre } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5666,13 +5256,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -5680,10 +5270,10 @@ impl CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -5691,18 +5281,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFut } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5712,7 +5302,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutu } /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsPix { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsPix { /// The number of seconds (between 10 and 1209600) after which Pix payment will expire. /// Defaults to 86400 seconds. #[serde(skip_serializing_if = "Option::is_none")] @@ -5730,9 +5320,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsPix { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPix { pub fn new() -> Self { Self::default() } @@ -5746,40 +5337,40 @@ impl CreatePaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5789,7 +5380,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureU } /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsPromptpay { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsPromptpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -5800,9 +5391,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsPromptpay { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreatePaymentIntentPaymentMethodOptionsPromptpay { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPromptpay { pub fn new() -> Self { Self::default() } @@ -5816,40 +5407,40 @@ impl CreatePaymentIntentPaymentMethodOptionsPromptpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5857,9 +5448,9 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupF serializer.serialize_str(self.as_str()) } } -/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. +/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsRevolutPay { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -5868,9 +5459,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsRevolutPay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl CreatePaymentIntentPaymentMethodOptionsRevolutPay { +impl CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPay { pub fn new() -> Self { Self::default() } @@ -5882,13 +5473,13 @@ impl CreatePaymentIntentPaymentMethodOptionsRevolutPay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -5896,10 +5487,12 @@ impl CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -5907,18 +5500,20 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetu } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5928,7 +5523,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetup } /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option<&'a serde_json::Value>, @@ -5942,9 +5537,9 @@ pub struct CreatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { pub fn new() -> Self { Self::default() } @@ -5958,14 +5553,14 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -5974,10 +5569,10 @@ impl CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -5986,18 +5581,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetup } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6007,10 +5602,11 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupF } /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsSofort { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsSofort { /// Language shown to the payer on redirect. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: Option, + pub preferred_language: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -6020,16 +5616,17 @@ pub struct CreatePaymentIntentPaymentMethodOptionsSofort { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsSofort { +impl CreatePaymentIntentBuilderPaymentMethodOptionsSofort { pub fn new() -> Self { Self::default() } } /// Language shown to the payer on redirect. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { De, En, Es, @@ -6038,9 +5635,9 @@ pub enum CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { Nl, Pl, } -impl CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match self { De => "de", En => "en", @@ -6053,10 +5650,10 @@ impl CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -6069,18 +5666,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortPreferre } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6097,13 +5694,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { None, OffSession, } -impl CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -6111,10 +5708,10 @@ impl CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -6122,18 +5719,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortSetupFut } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6141,12 +5738,20 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutu serializer.serialize_str(self.as_str()) } } -/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. +/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsSwish<'a> { - /// The order ID displayed in the Swish app after the payment is authorized. +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { + /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option<&'a str>, + pub financial_connections: + Option>, + /// Additional fields for network related functions + #[serde(skip_serializing_if = "Option::is_none")] + pub networks: Option>, + /// Preferred transaction settlement speed + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_settlement_speed: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -6156,122 +5761,36 @@ pub struct CreatePaymentIntentPaymentMethodOptionsSwish<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, + /// Verification method for the intent + #[serde(skip_serializing_if = "Option::is_none")] + pub verification_method: + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsSwish<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - None, -} -impl CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccount<'a> { - /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, - /// Additional fields for network related functions - #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, - /// Preferred transaction settlement speed - #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_settlement_speed: - Option, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: - Option, - /// Bank account verification method. - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option< - &'a [CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option< - &'a [CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch], - >, - /// For webview integrations only. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub return_url: Option<&'a str>, + } -impl<'a> CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -6280,15 +5799,16 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnection /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ Balances, Ownership, PaymentMethod, Transactions, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -6299,11 +5819,11 @@ impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPer } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -6314,7 +5834,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6322,14 +5842,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -6340,99 +5860,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() - } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), _ => Err(()), } } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6440,14 +5893,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -6458,26 +5911,26 @@ impl serde::Serialize } /// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] pub requested: - Option<&'a [CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + Option<&'a [CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } /// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { Ach, UsDomesticWire, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -6485,10 +5938,12 @@ impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -6496,18 +5951,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountN } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6517,13 +5978,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNe } /// Preferred transaction settlement speed #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { Fastest, Standard, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match self { Fastest => "fastest", Standard => "standard", @@ -6532,11 +5993,11 @@ impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpee } impl std::str::FromStr - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match s { "fastest" => Ok(Fastest), "standard" => Ok(Standard), @@ -6545,7 +6006,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6553,14 +6014,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn serialize(&self, serializer: S) -> Result where @@ -6578,14 +6039,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { None, OffSession, OnSession, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -6594,10 +6055,12 @@ impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -6606,18 +6069,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountS } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6625,16 +6094,16 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSe serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -6643,10 +6112,12 @@ impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::str::FromStr + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -6655,18 +6126,24 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountV } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Display + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for CreatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6676,12 +6153,12 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVe } /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsWechatPay<'a> { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { /// The app ID registered with WeChat Pay. Only required when client is ios or android. #[serde(skip_serializing_if = "Option::is_none")] pub app_id: Option<&'a str>, /// The client type that the end customer will pay from - pub client: CreatePaymentIntentPaymentMethodOptionsWechatPayClient, + pub client: CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -6692,23 +6169,23 @@ pub struct CreatePaymentIntentPaymentMethodOptionsWechatPay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> CreatePaymentIntentPaymentMethodOptionsWechatPay<'a> { - pub fn new(client: CreatePaymentIntentPaymentMethodOptionsWechatPayClient) -> Self { +impl<'a> CreatePaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { + pub fn new(client: CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient) -> Self { Self { app_id: None, client, setup_future_usage: None } } } /// The client type that the end customer will pay from #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { Android, Ios, Web, } -impl CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsWechatPayClient::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match self { Android => "android", Ios => "ios", @@ -6717,10 +6194,10 @@ impl CreatePaymentIntentPaymentMethodOptionsWechatPayClient { } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsWechatPayClient::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match s { "android" => Ok(Android), "ios" => Ok(Ios), @@ -6729,18 +6206,18 @@ impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsWechatPayClien } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6757,40 +6234,40 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPayClient /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6800,7 +6277,7 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupF } /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsZip { +pub struct CreatePaymentIntentBuilderPaymentMethodOptionsZip { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -6810,9 +6287,10 @@ pub struct CreatePaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl CreatePaymentIntentPaymentMethodOptionsZip { +impl CreatePaymentIntentBuilderPaymentMethodOptionsZip { pub fn new() -> Self { Self::default() } @@ -6826,40 +6304,40 @@ impl CreatePaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +pub enum CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { None, } -impl CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::str::FromStr for CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Display for CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl serde::Serialize for CreatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6870,21 +6348,21 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureU /// Options to configure Radar. /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentRadarOptions<'a> { +pub struct CreatePaymentIntentBuilderRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> CreatePaymentIntentRadarOptions<'a> { +impl<'a> CreatePaymentIntentBuilderRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentShipping<'a> { +pub struct CreatePaymentIntentBuilderShipping<'a> { /// Shipping address. - pub address: CreatePaymentIntentShippingAddress<'a>, + pub address: CreatePaymentIntentBuilderShippingAddress<'a>, /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. #[serde(skip_serializing_if = "Option::is_none")] pub carrier: Option<&'a str>, @@ -6898,14 +6376,14 @@ pub struct CreatePaymentIntentShipping<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tracking_number: Option<&'a str>, } -impl<'a> CreatePaymentIntentShipping<'a> { - pub fn new(address: CreatePaymentIntentShippingAddress<'a>, name: &'a str) -> Self { +impl<'a> CreatePaymentIntentBuilderShipping<'a> { + pub fn new(address: CreatePaymentIntentBuilderShippingAddress<'a>, name: &'a str) -> Self { Self { address, carrier: None, name, phone: None, tracking_number: None } } } /// Shipping address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentShippingAddress<'a> { +pub struct CreatePaymentIntentBuilderShippingAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -6925,7 +6403,7 @@ pub struct CreatePaymentIntentShippingAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreatePaymentIntentShippingAddress<'a> { +impl<'a> CreatePaymentIntentBuilderShippingAddress<'a> { pub fn new() -> Self { Self::default() } @@ -6933,7 +6411,7 @@ impl<'a> CreatePaymentIntentShippingAddress<'a> { /// The parameters that you can use to automatically create a Transfer. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentTransferData<'a> { +pub struct CreatePaymentIntentBuilderTransferData<'a> { /// The amount that will be transferred automatically when a charge succeeds. /// The amount is capped at the total transaction amount and if no amount is set, /// the full amount is transferred. @@ -6949,40 +6427,395 @@ pub struct CreatePaymentIntentTransferData<'a> { /// returned on the successful charge's `transfer` field. pub destination: &'a str, } -impl<'a> CreatePaymentIntentTransferData<'a> { +impl<'a> CreatePaymentIntentBuilderTransferData<'a> { pub fn new(destination: &'a str) -> Self { Self { amount: None, destination } } } +/// Creates a PaymentIntent object. +/// +/// After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm). +/// to continue the payment. Learn more about [the available payment flows +/// with the Payment Intents API](https://stripe.com/docs/payments/payment-intents). +/// +/// When you use `confirm=true` during creation, it’s equivalent to creating +/// and confirming the PaymentIntent in the same call. You can use any parameters +/// available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply +/// `confirm=true`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePaymentIntent<'a> { + inner: CreatePaymentIntentBuilder<'a>, +} impl<'a> CreatePaymentIntent<'a> { - /// Creates a PaymentIntent object. - /// - /// After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm). - /// to continue the payment. Learn more about [the available payment flows - /// with the Payment Intents API](https://stripe.com/docs/payments/payment-intents). - /// - /// When you use `confirm=true` during creation, it’s equivalent to creating - /// and confirming the PaymentIntent in the same call. You can use any parameters - /// available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply - /// `confirm=true`. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/payment_intents", self, http_types::Method::Post) + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { inner: CreatePaymentIntentBuilder::new(amount, currency) } + } + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn automatic_payment_methods( + mut self, + automatic_payment_methods: CreatePaymentIntentBuilderAutomaticPaymentMethods, + ) -> Self { + self.inner.automatic_payment_methods = Some(automatic_payment_methods); + self + } + + pub fn capture_method( + mut self, + capture_method: stripe_shared::PaymentIntentCaptureMethod, + ) -> Self { + self.inner.capture_method = Some(capture_method); + self + } + + pub fn confirm(mut self, confirm: bool) -> Self { + self.inner.confirm = Some(confirm); + self + } + + pub fn confirmation_method( + mut self, + confirmation_method: stripe_shared::PaymentIntentConfirmationMethod, + ) -> Self { + self.inner.confirmation_method = Some(confirmation_method); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn error_on_requires_action(mut self, error_on_requires_action: bool) -> Self { + self.inner.error_on_requires_action = Some(error_on_requires_action); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn mandate(mut self, mandate: &'a str) -> Self { + self.inner.mandate = Some(mandate); + self + } + + pub fn mandate_data(mut self, mandate_data: CreatePaymentIntentBuilderMandateData<'a>) -> Self { + self.inner.mandate_data = Some(mandate_data); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn off_session(mut self, off_session: CreatePaymentIntentBuilderOffSession) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn payment_method_configuration(mut self, payment_method_configuration: &'a str) -> Self { + self.inner.payment_method_configuration = Some(payment_method_configuration); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: CreatePaymentIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: CreatePaymentIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn payment_method_types(mut self, payment_method_types: &'a [&'a str]) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn radar_options( + mut self, + radar_options: CreatePaymentIntentBuilderRadarOptions<'a>, + ) -> Self { + self.inner.radar_options = Some(radar_options); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } + + pub fn setup_future_usage( + mut self, + setup_future_usage: stripe_shared::PaymentIntentSetupFutureUsage, + ) -> Self { + self.inner.setup_future_usage = Some(setup_future_usage); + self + } + + pub fn shipping(mut self, shipping: CreatePaymentIntentBuilderShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn statement_descriptor_suffix(mut self, statement_descriptor_suffix: &'a str) -> Self { + self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix); + self + } + + pub fn transfer_data( + mut self, + transfer_data: CreatePaymentIntentBuilderTransferData<'a>, + ) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self + } + + pub fn use_stripe_sdk(mut self, use_stripe_sdk: bool) -> Self { + self.inner.use_stripe_sdk = Some(use_stripe_sdk); + self + } +} +impl CreatePaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payment_intents").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntent<'a> { - /// Amount intended to be collected by this PaymentIntent. - /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). - /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). - /// The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. - /// The amount of the application fee collected will be capped at the total payment amount. - /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). +pub struct ListPaymentIntentBuilder<'a> { + /// A filter on the list, based on the object `created` field. + /// The value can be a string with an integer Unix timestamp or a dictionary with a number of different query options. #[serde(skip_serializing_if = "Option::is_none")] - pub application_fee_amount: Option, - /// Controls when the funds will be captured from the customer's account. + pub created: Option, + /// Only return PaymentIntents for the customer that this customer ID specifies. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListPaymentIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of PaymentIntents. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentIntent<'a> { + inner: ListPaymentIntentBuilder<'a>, +} +impl<'a> ListPaymentIntent<'a> { + pub fn new() -> Self { + Self { inner: ListPaymentIntentBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListPaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPaymentIntent<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_intents").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrievePaymentIntentBuilder<'a> { + /// The client secret of the PaymentIntent. + /// We require it if you use a publishable key to retrieve the source. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_secret: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePaymentIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of a PaymentIntent that has previously been created. +/// +/// You can retrieve a PaymentIntent client-side using a publishable key when the `client_secret` is in the query string. +/// +/// +/// If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties. +/// Refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentIntent<'a> { + inner: RetrievePaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} +impl<'a> RetrievePaymentIntent<'a> { + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: RetrievePaymentIntentBuilder::new() } + } + pub fn client_secret(mut self, client_secret: &'a str) -> Self { + self.inner.client_secret = Some(client_secret); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Get, format!("/payment_intents/{intent}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePaymentIntentBuilder<'a> { + /// Amount intended to be collected by this PaymentIntent. + /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). + /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). + /// The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. + /// The amount of the application fee collected will be capped at the total payment amount. + /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + #[serde(skip_serializing_if = "Option::is_none")] + pub application_fee_amount: Option, + /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: Option, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -7018,10 +6851,10 @@ pub struct UpdatePaymentIntent<'a> { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment-method-specific configuration for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The list of payment method types (for example, card) that this PaymentIntent can use. /// Use `automatic_payment_methods` to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). #[serde(skip_serializing_if = "Option::is_none")] @@ -7042,10 +6875,9 @@ pub struct UpdatePaymentIntent<'a> { pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, - /// For card charges, use [statement_descriptor_suffix](https://stripe.com/docs/payments/account/statement-descriptors#dynamic). - /// Otherwise, you can use this value as the complete description of a charge on your customers' statements. - /// It must contain at least one letter and be 1–22 characters long. + pub shipping: Option>, + /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. + /// Must contain at least one letter, maximum 22 characters. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, /// Provides information about a card payment that customers see on their statements. @@ -7063,7 +6895,7 @@ pub struct UpdatePaymentIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_group: Option<&'a str>, } -impl<'a> UpdatePaymentIntent<'a> { +impl<'a> UpdatePaymentIntentBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -7072,7 +6904,7 @@ impl<'a> UpdatePaymentIntent<'a> { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodData<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -7087,22 +6919,22 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -7111,10 +6943,10 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -7123,13 +6955,13 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -7147,7 +6979,7 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -7163,27 +6995,24 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: UpdatePaymentIntentPaymentMethodDataType, + pub type_: UpdatePaymentIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -7191,8 +7020,8 @@ pub struct UpdatePaymentIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> UpdatePaymentIntentPaymentMethodData<'a> { - pub fn new(type_: UpdatePaymentIntentPaymentMethodDataType) -> Self { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: UpdatePaymentIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -7226,7 +7055,6 @@ impl<'a> UpdatePaymentIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -7236,20 +7064,20 @@ impl<'a> UpdatePaymentIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> UpdatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataBacsDebit<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -7257,17 +7085,17 @@ pub struct UpdatePaymentIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> UpdatePaymentIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataBillingDetails<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { /// Billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// Email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -7278,14 +7106,14 @@ pub struct UpdatePaymentIntentPaymentMethodDataBillingDetails<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, } -impl<'a> UpdatePaymentIntentPaymentMethodDataBillingDetails<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { pub fn new() -> Self { Self::default() } } /// Billing address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -7305,30 +7133,30 @@ pub struct UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataBoleto<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> UpdatePaymentIntentPaymentMethodDataBoleto<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataEps { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdatePaymentIntentPaymentMethodDataEps { +impl UpdatePaymentIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -7336,7 +7164,7 @@ impl UpdatePaymentIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodDataEpsBank { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -7368,9 +7196,9 @@ pub enum UpdatePaymentIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodDataEpsBank { +impl UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataEpsBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -7405,10 +7233,10 @@ impl UpdatePaymentIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataEpsBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -7442,18 +7270,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataEpsBank { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7463,27 +7291,28 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataFpx { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: + Option, /// The customer's bank. - pub bank: UpdatePaymentIntentPaymentMethodDataFpxBank, + pub bank: UpdatePaymentIntentBuilderPaymentMethodDataFpxBank, } -impl UpdatePaymentIntentPaymentMethodDataFpx { - pub fn new(bank: UpdatePaymentIntentPaymentMethodDataFpxBank) -> Self { +impl UpdatePaymentIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: UpdatePaymentIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -7491,10 +7320,10 @@ impl UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -7502,18 +7331,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderT } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7524,7 +7353,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderTy /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodDataFpxBank { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -7550,9 +7379,9 @@ pub enum UpdatePaymentIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodDataFpxBank { +impl UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataFpxBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -7581,10 +7410,10 @@ impl UpdatePaymentIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataFpxBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -7612,18 +7441,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxBank { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7633,12 +7462,12 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataIdeal { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdatePaymentIntentPaymentMethodDataIdeal { +impl UpdatePaymentIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -7646,7 +7475,7 @@ impl UpdatePaymentIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodDataIdealBank { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -7655,7 +7484,6 @@ pub enum UpdatePaymentIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -7666,9 +7494,9 @@ pub enum UpdatePaymentIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodDataIdealBank { +impl UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataIdealBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -7678,7 +7506,6 @@ impl UpdatePaymentIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -7691,10 +7518,10 @@ impl UpdatePaymentIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataIdealBank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -7704,7 +7531,6 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -7716,18 +7542,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataIdealBank { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7737,24 +7563,24 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataKlarna { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl UpdatePaymentIntentPaymentMethodDataKlarna { +impl UpdatePaymentIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataP24 { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdatePaymentIntentPaymentMethodDataP24 { +impl UpdatePaymentIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -7762,7 +7588,7 @@ impl UpdatePaymentIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodDataP24Bank { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -7787,14 +7613,13 @@ pub enum UpdatePaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodDataP24Bank { +impl UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataP24Bank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -7820,17 +7645,16 @@ impl UpdatePaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataP24Bank::*; + use UpdatePaymentIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -7856,24 +7680,23 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataP24Bank { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7884,41 +7707,41 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataP24Bank { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataRadarOptions<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> UpdatePaymentIntentPaymentMethodDataRadarOptions<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataSepaDebit<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> UpdatePaymentIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataSofort { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: UpdatePaymentIntentPaymentMethodDataSofortCountry, + pub country: UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry, } -impl UpdatePaymentIntentPaymentMethodDataSofort { - pub fn new(country: UpdatePaymentIntentPaymentMethodDataSofortCountry) -> Self { +impl UpdatePaymentIntentBuilderPaymentMethodDataSofort { + pub fn new(country: UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodDataSofortCountry { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -7926,9 +7749,9 @@ pub enum UpdatePaymentIntentPaymentMethodDataSofortCountry { It, Nl, } -impl UpdatePaymentIntentPaymentMethodDataSofortCountry { +impl UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataSofortCountry::*; + use UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -7940,10 +7763,10 @@ impl UpdatePaymentIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataSofortCountry::*; + use UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -7955,18 +7778,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7979,7 +7802,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodDataType { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -8008,16 +7831,15 @@ pub enum UpdatePaymentIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodDataType { +impl UpdatePaymentIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -8047,7 +7869,6 @@ impl UpdatePaymentIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -8056,10 +7877,10 @@ impl UpdatePaymentIntentPaymentMethodDataType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataType { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -8089,7 +7910,6 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -8097,18 +7917,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataType { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataType { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataType { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8118,17 +7938,17 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataUsBankAccount<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -8136,20 +7956,20 @@ pub struct UpdatePaymentIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> UpdatePaymentIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -8157,10 +7977,12 @@ impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -8168,18 +7990,22 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAcco } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8189,13 +8015,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccou } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +pub enum UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -8203,10 +8029,10 @@ impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -8214,18 +8040,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAcco } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8235,124 +8061,123 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccou } /// Payment-method-specific configuration for this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptions<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option>, + pub affirm: Option>, /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option>, + pub afterpay_clearpay: + Option>, /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// Configuration for any card payments attempted on this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, + pub cashapp: Option, /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option>, + pub customer_balance: Option>, /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option>, + pub konbini: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub pix: Option, + pub pix: Option, /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay: Option, - /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. + pub promptpay: Option, + /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub revolut_pay: Option, /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option>, + pub sofort: Option, /// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option>, + pub wechat_pay: Option>, /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub zip: Option, + pub zip: Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptions<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -8363,20 +8188,20 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, - /// Bank account verification method. + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -8388,28 +8213,30 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub interval_description: Option<&'a str>, /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_schedule: - Option, + pub payment_schedule: Option< + UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule, + >, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: - Option, + pub transaction_type: Option< + UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, + >, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -8419,11 +8246,11 @@ impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedu } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -8433,7 +8260,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -8441,14 +8268,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -8459,13 +8286,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -8474,11 +8301,11 @@ impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionTy } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -8487,7 +8314,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -8495,14 +8322,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -8520,14 +8347,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -8536,10 +8363,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -8548,18 +8375,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetup } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8567,16 +8394,16 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupF serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -8585,10 +8412,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -8597,18 +8426,22 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerif } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8618,14 +8451,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerifi } /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAffirm<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Affirm authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_locale: Option<&'a str>, @@ -8638,9 +8471,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsAffirm<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { pub fn new() -> Self { Self::default() } @@ -8651,40 +8485,40 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8701,40 +8535,40 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMe /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8744,7 +8578,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutu } /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. @@ -8752,7 +8586,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: - Option, + Option, /// An internal identifier or reference that this payment corresponds to. /// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes. /// This field differs from the statement descriptor and item name. @@ -8768,9 +8602,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { pub fn new() -> Self { Self::default() } @@ -8781,40 +8615,48 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8831,40 +8673,48 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpa /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8874,7 +8724,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpa } /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAlipay { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAlipay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -8884,9 +8734,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsAlipay { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAlipay { pub fn new() -> Self { Self::default() } @@ -8900,13 +8751,13 @@ impl UpdatePaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -8914,10 +8765,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -8925,18 +8776,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFut } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8946,7 +8797,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutu } /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -8957,9 +8808,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { pub fn new() -> Self { Self::default() } @@ -8973,14 +8824,14 @@ impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -8989,10 +8840,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -9001,18 +8854,22 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSet } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9022,7 +8879,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetu } /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsBacsDebit { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -9033,9 +8890,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsBacsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsBacsDebit { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebit { pub fn new() -> Self { Self::default() } @@ -9049,14 +8906,14 @@ impl UpdatePaymentIntentPaymentMethodOptionsBacsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -9065,10 +8922,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -9077,18 +8934,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetup } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9098,11 +8955,11 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupF } /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsBancontact { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_language: - Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -9113,24 +8970,24 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsBancontact { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsBancontact { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -9140,10 +8997,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -9153,18 +9012,22 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactPref } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9181,13 +9044,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactPrefe /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -9195,10 +9058,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -9206,91 +9071,20 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactSetu } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - None, -} -impl UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9300,7 +9094,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFuture } /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsBoleto { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsBoleto { /// The number of calendar days before a Boleto voucher expires. /// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time. #[serde(skip_serializing_if = "Option::is_none")] @@ -9314,9 +9108,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsBoleto { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBoleto { pub fn new() -> Self { Self::default() } @@ -9330,14 +9125,14 @@ impl UpdatePaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -9346,10 +9141,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -9358,18 +9153,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFut } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9379,14 +9174,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutu } /// Configuration for any card payments attempted on this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCard<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCard<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// A single-use `cvc_update` Token that represents a card CVC value. /// When provided, the CVC value will be verified during the card payment attempt. /// This parameter can only be provided during confirmation. @@ -9396,10 +9191,11 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, + pub installments: Option, /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// When specified, this parameter indicates that a transaction will be marked /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -9409,33 +9205,31 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_extended_authorization: - Option, - /// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. + Option, + /// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_incremental_authorization: - Option, + Option, /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_multicapture: - Option, + Option, /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub request_overcapture: Option, + pub request_overcapture: + Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e. - /// using the cvc_token parameter). - #[serde(skip_serializing_if = "Option::is_none")] - pub require_cvc_recollection: Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -9445,7 +9239,8 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Provides information about a card payment that customers see on their statements. /// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor. /// Maximum 22 characters. @@ -9458,12 +9253,8 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCard<'a> { /// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix_kanji: Option<&'a str>, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this payment. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCard<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } @@ -9474,40 +9265,40 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9519,7 +9310,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMeth /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardInstallments { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallments { /// Setting to true enables installments for this PaymentIntent. /// This will cause the response to contain a list of available installment plans. /// Setting to false will prevent any selected plan from applying to a charge. @@ -9528,9 +9319,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option, + pub plan: Option, } -impl UpdatePaymentIntentPaymentMethodOptionsCardInstallments { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } @@ -9538,21 +9329,21 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. pub count: u64, /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. - pub interval: UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, + pub interval: UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, /// Type of installment plan, one of `fixed_count`. #[serde(rename = "type")] - pub type_: UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + pub type_: UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, } -impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { pub fn new( count: u64, - interval: UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, - type_: UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + interval: UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, + type_: UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, ) -> Self { Self { count, interval, type_ } } @@ -9560,40 +9351,48 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { Month, } -impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match self { Month => "month", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match s { "month" => Ok(Month), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9603,40 +9402,40 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallment } /// Type of installment plan, one of `fixed_count`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { FixedCount, } -impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match self { FixedCount => "fixed_count", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match s { "fixed_count" => Ok(FixedCount), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9646,13 +9445,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallment } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// A description of the mandate or subscription that is meant to be displayed to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -9662,7 +9461,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -9675,14 +9474,15 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { pub start_date: stripe_types::Timestamp, /// Specifies the type of mandates supported. Possible values are `india`. #[serde(skip_serializing_if = "Option::is_none")] - pub supported_types: - Option<&'a [UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, + pub supported_types: Option< + &'a [UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes], + >, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { pub fn new( amount: i64, - amount_type: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, - interval: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + amount_type: UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, + interval: UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, reference: &'a str, start_date: stripe_types::Timestamp, ) -> Self { @@ -9703,13 +9503,13 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -9717,10 +9517,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -9728,18 +9530,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOpt } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9749,16 +9557,16 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOpti } /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { Day, Month, Sporadic, Week, Year, } -impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { Day => "day", Month => "month", @@ -9769,10 +9577,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -9783,18 +9593,20 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOpt } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9804,40 +9616,48 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOpti } /// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { India, } -impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { India => "india", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { "india" => Ok(India), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9849,7 +9669,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOpti /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -9862,9 +9682,9 @@ pub enum UpdatePaymentIntentPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardNetwork::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -9881,10 +9701,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardNetwork::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -9901,18 +9721,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9922,13 +9742,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardNetwork { } /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { IfAvailable, Never, } -impl UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -9936,10 +9756,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -9947,18 +9769,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestExt } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -9966,15 +9794,15 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestExte serializer.serialize_str(self.as_str()) } } -/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. +/// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { IfAvailable, Never, } -impl UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -9983,11 +9811,11 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -9996,7 +9824,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -10004,14 +9832,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn serialize(&self, serializer: S) -> Result where @@ -10022,13 +9850,13 @@ impl serde::Serialize } /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { IfAvailable, Never, } -impl UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -10036,10 +9864,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -10047,18 +9875,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestMul } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10068,13 +9896,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestMult } /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { IfAvailable, Never, } -impl UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -10082,10 +9910,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -10093,18 +9921,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestOve } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10114,49 +9942,47 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestOver } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10173,14 +9999,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestThre /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -10189,10 +10015,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -10201,411 +10027,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutur } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this payment. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - pub cryptogram: &'a str, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// The exemption requested via 3DS and accepted by the issuer at authentication time. - #[serde(skip_serializing_if = "Option::is_none")] - pub exemption_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly - #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. - #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). - pub transaction_id: &'a str, - /// The version of 3D Secure that was performed. - pub version: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - pub fn new( - cryptogram: &'a str, - transaction_id: &'a str, - version: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, - ) -> Self { - Self { - ares_trans_status: None, - cryptogram, - electronic_commerce_indicator: None, - exemption_indicator: None, - network_options: None, - requestor_challenge_indicator: None, - transaction_id, - version, - } - } -} -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", - } - } -} - -impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), - _ => Err(()), - } - } -} -impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The exemption requested via 3DS and accepted by the issuer at authentication time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - LowRisk, - None, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match self { - LowRisk => "low_risk", - None => "none", - } - } -} - -impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match s { - "low_risk" => Ok(LowRisk), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO -pub cb_avalgo: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_score: Option, - -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", - } - } -} - -impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match s { - "0" => Ok(V0), - "1" => Ok(V1), - "2" => Ok(V2), - "3" => Ok(V3), - "4" => Ok(V4), - "A" => Ok(A), - _ => Err(()), - } - } -} -impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The version of 3D Secure that was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10615,14 +10048,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecur } /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCashapp { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCashapp { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -10632,9 +10065,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCashapp { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsCashapp { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCashapp { pub fn new() -> Self { Self::default() } @@ -10645,40 +10079,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsCashapp { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10695,14 +10129,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureM /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -10711,10 +10145,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -10723,18 +10157,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFu } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10744,15 +10178,16 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFut } /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] pub bank_transfer: - Option>, + Option>, /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option, + pub funding_type: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -10763,16 +10198,16 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { pub fn new() -> Self { Self::default() } } /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] pub eu_bank_transfer: Option>, @@ -10781,15 +10216,15 @@ pub eu_bank_transfer: Option>, /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[serde(skip_serializing_if = "Option::is_none")] -pub requested_address_types: Option<&'a [UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, +pub requested_address_types: Option<&'a [UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[serde(rename = "type")] -pub type_: UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, +pub type_: UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { pub fn new( - type_: UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, + type_: UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, ) -> Self { Self { eu_bank_transfer: None, requested_address_types: None, type_ } } @@ -10799,7 +10234,8 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ Aba, Iban, Sepa, @@ -10808,9 +10244,11 @@ pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferReque Swift, Zengin, } -impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +impl + UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match self { Aba => "aba", Iban => "iban", @@ -10823,61 +10261,51 @@ impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequested } } -impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match s { - "aba" => Ok(Aba), - "iban" => Ok(Iban), - "sepa" => Ok(Sepa), - "sort_code" => Ok(SortCode), - "spei" => Ok(Spei), - "swift" => Ok(Swift), - "zengin" => Ok(Zengin), - _ => Err(()), + "aba" => Ok(Aba), +"iban" => Ok(Iban), +"sepa" => Ok(Sepa), +"sort_code" => Ok(SortCode), +"spei" => Ok(Spei), +"swift" => Ok(Swift), +"zengin" => Ok(Zengin), +_ => Err(()) + } } } -impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { EuBankTransfer, GbBankTransfer, JpBankTransfer, MxBankTransfer, UsBankTransfer, } -impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match self { EuBankTransfer => "eu_bank_transfer", GbBankTransfer => "gb_bank_transfer", @@ -10888,10 +10316,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match s { "eu_bank_transfer" => Ok(EuBankTransfer), "gb_bank_transfer" => Ok(GbBankTransfer), @@ -10902,18 +10332,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanc } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10924,40 +10360,44 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalance /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { BankTransfer, } -impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match self { BankTransfer => "bank_transfer", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match s { "bank_transfer" => Ok(BankTransfer), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -10974,40 +10414,48 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalance /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11017,7 +10465,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalance } /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsEps { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsEps { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11027,9 +10475,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsEps { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsEps { pub fn new() -> Self { Self::default() } @@ -11043,40 +10492,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11086,7 +10535,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureU } /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsFpx { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsFpx { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11096,9 +10545,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsFpx { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsFpx { pub fn new() -> Self { Self::default() } @@ -11112,40 +10562,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11155,7 +10605,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureU } /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsGiropay { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsGiropay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11165,9 +10615,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsGiropay { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsGiropay { pub fn new() -> Self { Self::default() } @@ -11181,40 +10632,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11224,7 +10675,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFut } /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsGrabpay { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11234,9 +10685,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsGrabpay { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpay { pub fn new() -> Self { Self::default() } @@ -11250,40 +10702,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11293,7 +10745,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFut } /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsIdeal { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsIdeal { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11303,9 +10755,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsIdeal { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsIdeal { pub fn new() -> Self { Self::default() } @@ -11319,13 +10772,13 @@ impl UpdatePaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -11333,10 +10786,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -11344,18 +10797,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutu } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11365,17 +10818,18 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutur } /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsKlarna { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsKlarna { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Klarna authorization page that the customer is redirected to #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11385,9 +10839,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsKlarna { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsKlarna { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsKlarna { pub fn new() -> Self { Self::default() } @@ -11398,40 +10853,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsKlarna { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11442,7 +10897,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMe /// Preferred language of the Klarna authorization page that the customer is redirected to #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -11490,9 +10945,9 @@ pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -11543,10 +10998,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -11596,18 +11051,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferre } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11624,40 +11079,40 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11667,7 +11122,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutu } /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsKonbini<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { /// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. /// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness. /// We recommend to use the customer's phone number. @@ -11694,9 +11149,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsKonbini<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { pub fn new() -> Self { Self::default() } @@ -11710,40 +11166,40 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11753,14 +11209,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFut } /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsLink<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsLink<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// \[Deprecated\] This is a legacy parameter that no longer has any function. #[serde(skip_serializing_if = "Option::is_none")] pub persistent_token: Option<&'a str>, @@ -11773,9 +11229,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsLink<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsLink<'a> { pub fn new() -> Self { Self::default() } @@ -11786,40 +11243,40 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11836,13 +11293,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMeth /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -11850,10 +11307,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -11861,18 +11318,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutur } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11882,7 +11339,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFuture } /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsOxxo { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsOxxo { /// The number of calendar days before an OXXO voucher expires. /// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. #[serde(skip_serializing_if = "Option::is_none")] @@ -11896,9 +11353,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsOxxo { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsOxxo { pub fn new() -> Self { Self::default() } @@ -11912,40 +11370,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -11955,7 +11413,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFuture } /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsP24 { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsP24 { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -11965,12 +11423,13 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Confirm that the payer has accepted the P24 terms and conditions. #[serde(skip_serializing_if = "Option::is_none")] pub tos_shown_and_accepted: Option, } -impl UpdatePaymentIntentPaymentMethodOptionsP24 { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsP24 { pub fn new() -> Self { Self::default() } @@ -11984,40 +11443,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12027,7 +11486,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureU } /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsPaynow { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsPaynow { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -12037,9 +11496,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsPaynow { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPaynow { pub fn new() -> Self { Self::default() } @@ -12053,40 +11513,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12096,13 +11556,14 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutu } /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsPaypal<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. /// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. #[serde(skip_serializing_if = "Option::is_none")] @@ -12119,49 +11580,50 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsPaypal<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsPaypal<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { Manual, } -impl UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12172,7 +11634,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMe /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -12197,9 +11659,9 @@ pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -12227,10 +11689,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -12257,18 +11719,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferre } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12285,13 +11747,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -12299,10 +11761,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -12310,18 +11772,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFut } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12331,7 +11793,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutu } /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsPix { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsPix { /// The number of seconds (between 10 and 1209600) after which Pix payment will expire. /// Defaults to 86400 seconds. #[serde(skip_serializing_if = "Option::is_none")] @@ -12349,9 +11811,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsPix { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPix { pub fn new() -> Self { Self::default() } @@ -12365,40 +11828,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12408,7 +11871,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureU } /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsPromptpay { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -12419,9 +11882,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsPromptpay { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsPromptpay { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpay { pub fn new() -> Self { Self::default() } @@ -12435,40 +11898,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsPromptpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12476,9 +11939,9 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupF serializer.serialize_str(self.as_str()) } } -/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. +/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsRevolutPay { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -12487,9 +11950,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsRevolutPay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsRevolutPay { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPay { pub fn new() -> Self { Self::default() } @@ -12501,13 +11964,13 @@ impl UpdatePaymentIntentPaymentMethodOptionsRevolutPay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -12515,10 +11978,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -12526,18 +11991,20 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetu } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12547,7 +12014,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetup } /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option<&'a serde_json::Value>, @@ -12561,9 +12028,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { pub fn new() -> Self { Self::default() } @@ -12577,14 +12044,14 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -12593,10 +12060,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -12605,18 +12072,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetup } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12626,10 +12093,11 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupF } /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsSofort { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsSofort { /// Language shown to the payer on redirect. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: Option, + pub preferred_language: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -12639,16 +12107,17 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsSofort { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsSofort { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsSofort { pub fn new() -> Self { Self::default() } } /// Language shown to the payer on redirect. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { De, En, Es, @@ -12657,9 +12126,9 @@ pub enum UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { Nl, Pl, } -impl UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match self { De => "de", En => "en", @@ -12672,10 +12141,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -12688,18 +12157,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortPreferre } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12716,13 +12185,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSofortPreferred /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { None, OffSession, } -impl UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -12730,10 +12199,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -12741,90 +12210,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFut } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsSwish<'a> { - /// The order ID displayed in the Swish app after the payment is authorized. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsSwish<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - None, -} -impl UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -12834,21 +12231,18 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutur } /// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccount<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, + Option>, /// Additional fields for network related functions #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, + pub networks: Option>, /// Preferred transaction settlement speed #[serde(skip_serializing_if = "Option::is_none")] pub preferred_settlement_speed: - Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -12859,38 +12253,35 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccount<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, - /// Bank account verification method. + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option< - &'a [UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option< - &'a [UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch], - >, - /// For webview integrations only. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub return_url: Option<&'a str>, + } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -12899,15 +12290,16 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnection /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ Balances, Ownership, PaymentMethod, Transactions, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -12918,11 +12310,11 @@ impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPer } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -12933,7 +12325,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -12941,14 +12333,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -12959,99 +12351,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() - } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), _ => Err(()), } } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -13059,14 +12384,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -13077,26 +12402,26 @@ impl serde::Serialize } /// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] pub requested: - Option<&'a [UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + Option<&'a [UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } /// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { Ach, UsDomesticWire, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -13104,10 +12429,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -13115,18 +12442,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountN } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13136,13 +12469,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNe } /// Preferred transaction settlement speed #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { Fastest, Standard, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match self { Fastest => "fastest", Standard => "standard", @@ -13151,11 +12484,11 @@ impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpee } impl std::str::FromStr - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match s { "fastest" => Ok(Fastest), "standard" => Ok(Standard), @@ -13164,7 +12497,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -13172,14 +12505,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn serialize(&self, serializer: S) -> Result where @@ -13197,14 +12530,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { None, OffSession, OnSession, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -13213,10 +12546,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -13225,18 +12560,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountS } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13244,16 +12585,16 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSe serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -13262,10 +12603,12 @@ impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::str::FromStr + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -13274,18 +12617,24 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountV } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Display + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for UpdatePaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13295,12 +12644,12 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVe } /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsWechatPay<'a> { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { /// The app ID registered with WeChat Pay. Only required when client is ios or android. #[serde(skip_serializing_if = "Option::is_none")] pub app_id: Option<&'a str>, /// The client type that the end customer will pay from - pub client: UpdatePaymentIntentPaymentMethodOptionsWechatPayClient, + pub client: UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -13311,23 +12660,23 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsWechatPay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> UpdatePaymentIntentPaymentMethodOptionsWechatPay<'a> { - pub fn new(client: UpdatePaymentIntentPaymentMethodOptionsWechatPayClient) -> Self { +impl<'a> UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { + pub fn new(client: UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient) -> Self { Self { app_id: None, client, setup_future_usage: None } } } /// The client type that the end customer will pay from #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { Android, Ios, Web, } -impl UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match self { Android => "android", Ios => "ios", @@ -13336,10 +12685,10 @@ impl UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match s { "android" => Ok(Android), "ios" => Ok(Ios), @@ -13348,18 +12697,18 @@ impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsWechatPayClien } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13376,40 +12725,40 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13419,7 +12768,7 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupF } /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsZip { +pub struct UpdatePaymentIntentBuilderPaymentMethodOptionsZip { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -13429,9 +12778,10 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl UpdatePaymentIntentPaymentMethodOptionsZip { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsZip { pub fn new() -> Self { Self::default() } @@ -13445,40 +12795,40 @@ impl UpdatePaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +pub enum UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { None, } -impl UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::str::FromStr for UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Display for UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Debug for UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl serde::Serialize for UpdatePaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13488,9 +12838,9 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureU } /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentShipping<'a> { +pub struct UpdatePaymentIntentBuilderShipping<'a> { /// Shipping address. - pub address: UpdatePaymentIntentShippingAddress<'a>, + pub address: UpdatePaymentIntentBuilderShippingAddress<'a>, /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. #[serde(skip_serializing_if = "Option::is_none")] pub carrier: Option<&'a str>, @@ -13504,14 +12854,14 @@ pub struct UpdatePaymentIntentShipping<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tracking_number: Option<&'a str>, } -impl<'a> UpdatePaymentIntentShipping<'a> { - pub fn new(address: UpdatePaymentIntentShippingAddress<'a>, name: &'a str) -> Self { +impl<'a> UpdatePaymentIntentBuilderShipping<'a> { + pub fn new(address: UpdatePaymentIntentBuilderShippingAddress<'a>, name: &'a str) -> Self { Self { address, carrier: None, name, phone: None, tracking_number: None } } } /// Shipping address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentShippingAddress<'a> { +pub struct UpdatePaymentIntentBuilderShippingAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -13531,222 +12881,166 @@ pub struct UpdatePaymentIntentShippingAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> UpdatePaymentIntentShippingAddress<'a> { +impl<'a> UpdatePaymentIntentBuilderShippingAddress<'a> { pub fn new() -> Self { Self::default() } } +/// Updates properties on a PaymentIntent object without confirming. +/// +/// Depending on which properties you update, you might need to confirm the +/// PaymentIntent again. For example, updating the `payment_method` +/// always requires you to confirm the PaymentIntent again. If you prefer to +/// update and confirm at the same time, we recommend updating properties through +/// the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePaymentIntent<'a> { + inner: UpdatePaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} impl<'a> UpdatePaymentIntent<'a> { - /// Updates properties on a PaymentIntent object without confirming. - /// - /// Depending on which properties you update, you might need to confirm the - /// PaymentIntent again. For example, updating the `payment_method` - /// always requires you to confirm the PaymentIntent again. If you prefer to - /// update and confirm at the same time, we recommend updating properties through - /// the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form(&format!("/payment_intents/{intent}"), self, http_types::Method::Post) + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: UpdatePaymentIntentBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ApplyCustomerBalancePaymentIntent<'a> { - /// Amount that you intend to apply to this PaymentIntent from the customer’s cash balance. - /// - /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (for example, 100 cents to charge 1 USD or 100 to charge 100 JPY, a zero-decimal currency). - /// - /// The maximum amount is the amount of the PaymentIntent. - /// - /// When you omit the amount, it defaults to the remaining amount requested on the PaymentIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> ApplyCustomerBalancePaymentIntent<'a> { - pub fn new() -> Self { - Self::default() + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self } -} -impl<'a> ApplyCustomerBalancePaymentIntent<'a> { - /// Manually reconcile the remaining amount for a `customer_balance` PaymentIntent. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/apply_customer_balance"), - self, - http_types::Method::Post, - ) + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelPaymentIntent<'a> { - /// Reason for canceling this PaymentIntent. - /// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelPaymentIntent<'a> { - pub fn new() -> Self { - Self::default() + + pub fn capture_method( + mut self, + capture_method: stripe_shared::PaymentIntentCaptureMethod, + ) -> Self { + self.inner.capture_method = Some(capture_method); + self } -} -/// Reason for canceling this PaymentIntent. -/// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CancelPaymentIntentCancellationReason { - Abandoned, - Duplicate, - Fraudulent, - RequestedByCustomer, -} -impl CancelPaymentIntentCancellationReason { - pub fn as_str(self) -> &'static str { - use CancelPaymentIntentCancellationReason::*; - match self { - Abandoned => "abandoned", - Duplicate => "duplicate", - Fraudulent => "fraudulent", - RequestedByCustomer => "requested_by_customer", - } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self } -} -impl std::str::FromStr for CancelPaymentIntentCancellationReason { - type Err = (); - fn from_str(s: &str) -> Result { - use CancelPaymentIntentCancellationReason::*; - match s { - "abandoned" => Ok(Abandoned), - "duplicate" => Ok(Duplicate), - "fraudulent" => Ok(Fraudulent), - "requested_by_customer" => Ok(RequestedByCustomer), - _ => Err(()), - } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self } -} -impl std::fmt::Display for CancelPaymentIntentCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self } -} -impl std::fmt::Debug for CancelPaymentIntentCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl serde::Serialize for CancelPaymentIntentCancellationReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self } -} -impl<'a> CancelPaymentIntent<'a> { - /// You can cancel a PaymentIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action` or, [in rare cases](https://stripe.com/docs/payments/intents), `processing`. - /// - /// - /// After it’s canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. - /// For PaymentIntents with a `status` of `requires_capture`, the remaining `amount_capturable` is automatically refunded. - /// - /// - /// You can’t cancel the PaymentIntent for a Checkout Session. - /// [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/cancel"), - self, - http_types::Method::Post, - ) + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CapturePaymentIntent<'a> { - /// The amount to capture from the PaymentIntent, which must be less than or equal to the original amount. - /// Any additional amount is automatically refunded. - /// Defaults to the full `amount_capturable` if it's not provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_to_capture: Option, - /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. - /// The amount of the application fee collected will be capped at the total payment amount. - /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). - #[serde(skip_serializing_if = "Option::is_none")] - pub application_fee_amount: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Defaults to `true`. - /// When capturing a PaymentIntent, setting `final_capture` to `false` notifies Stripe to not release the remaining uncaptured funds to make sure that they're captured in future requests. - /// You can only use this setting when [multicapture](https://stripe.com/docs/payments/multicapture) is available for PaymentIntents. - #[serde(skip_serializing_if = "Option::is_none")] - pub final_capture: Option, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// For card charges, use [statement_descriptor_suffix](https://stripe.com/docs/payments/account/statement-descriptors#dynamic). - /// Otherwise, you can use this value as the complete description of a charge on your customers' statements. - /// It must contain at least one letter and be 1–22 characters long. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, - /// Provides information about a card payment that customers see on their statements. - /// Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. - /// The concatenated descriptor must be 1-22 characters long. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_suffix: Option<&'a str>, - /// The parameters that you can use to automatically create a transfer after the payment - /// is captured. - /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option, -} -impl<'a> CapturePaymentIntent<'a> { - pub fn new() -> Self { - Self::default() + + pub fn payment_method_configuration(mut self, payment_method_configuration: &'a str) -> Self { + self.inner.payment_method_configuration = Some(payment_method_configuration); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: UpdatePaymentIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: UpdatePaymentIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn payment_method_types(mut self, payment_method_types: &'a [&'a str]) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn setup_future_usage( + mut self, + setup_future_usage: stripe_shared::PaymentIntentSetupFutureUsage, + ) -> Self { + self.inner.setup_future_usage = Some(setup_future_usage); + self + } + + pub fn shipping(mut self, shipping: UpdatePaymentIntentBuilderShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn statement_descriptor_suffix(mut self, statement_descriptor_suffix: &'a str) -> Self { + self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataUpdateParams) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } + + pub fn transfer_group(mut self, transfer_group: &'a str) -> Self { + self.inner.transfer_group = Some(transfer_group); + self } } -impl<'a> CapturePaymentIntent<'a> { - /// Capture the funds of an existing uncaptured PaymentIntent when its status is `requires_capture`. - /// - /// Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation. - /// - /// Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later). - pub fn send( +impl UpdatePaymentIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/capture"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntent<'a> { +pub struct ConfirmPaymentIntentBuilder<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: Option, @@ -13761,11 +13055,11 @@ pub struct ConfirmPaymentIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub mandate: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_data: Option>, + pub mandate_data: Option>, /// Set to `true` to indicate that the customer isn't in your checkout flow during this payment attempt and can't authenticate. /// Use this parameter in scenarios where you collect card details and [charge them later](https://stripe.com/docs/payments/cards/charging-saved-cards). #[serde(skip_serializing_if = "Option::is_none")] - pub off_session: Option, + pub off_session: Option, /// ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods/transitioning#compatibility) object) to attach to this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub payment_method: Option<&'a str>, @@ -13773,14 +13067,14 @@ pub struct ConfirmPaymentIntent<'a> { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment method-specific configuration for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// Options to configure Radar. /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// Email address that the receipt for the resulting payment will be sent to. /// If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). #[serde(skip_serializing_if = "Option::is_none")] @@ -13802,37 +13096,37 @@ pub struct ConfirmPaymentIntent<'a> { pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. #[serde(skip_serializing_if = "Option::is_none")] pub use_stripe_sdk: Option, } -impl<'a> ConfirmPaymentIntent<'a> { +impl<'a> ConfirmPaymentIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum ConfirmPaymentIntentMandateData<'a> { - SecretKeyParam(ConfirmPaymentIntentSecretKeyParam<'a>), - ClientKeyParam(ConfirmPaymentIntentClientKeyParam<'a>), +pub enum ConfirmPaymentIntentBuilderMandateData<'a> { + SecretKeyParam(ConfirmPaymentIntentBuilderSecretKeyParam<'a>), + ClientKeyParam(ConfirmPaymentIntentBuilderClientKeyParam<'a>), } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentSecretKeyParam<'a> { +pub struct ConfirmPaymentIntentBuilderSecretKeyParam<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a>, + pub customer_acceptance: ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptance<'a>, } -impl<'a> ConfirmPaymentIntentSecretKeyParam<'a> { +impl<'a> ConfirmPaymentIntentBuilderSecretKeyParam<'a> { pub fn new( - customer_acceptance: ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a>, + customer_acceptance: ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptance<'a>, ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a> { +pub struct ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptance<'a> { /// The time at which the customer accepted the Mandate. #[serde(skip_serializing_if = "Option::is_none")] pub accepted_at: Option, @@ -13845,23 +13139,23 @@ pub struct ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a> { /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] - pub type_: ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType, + pub type_: ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType, } -impl<'a> ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a> { - pub fn new(type_: ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType) -> Self { +impl<'a> ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptance<'a> { + pub fn new(type_: ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType) -> Self { Self { accepted_at: None, offline: None, online: None, type_ } } } /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +pub enum ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { Offline, Online, } -impl ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +impl ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType::*; + use ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -13869,10 +13163,10 @@ impl ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { } } -impl std::str::FromStr for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType::*; + use ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -13880,18 +13174,18 @@ impl std::str::FromStr for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceT } } } -impl std::fmt::Display for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType { +impl serde::Serialize for ConfirmPaymentIntentBuilderSecretKeyParamCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13900,37 +13194,37 @@ impl serde::Serialize for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceTy } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentClientKeyParam<'a> { +pub struct ConfirmPaymentIntentBuilderClientKeyParam<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: ConfirmPaymentIntentClientKeyParamCustomerAcceptance<'a>, + pub customer_acceptance: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptance<'a>, } -impl<'a> ConfirmPaymentIntentClientKeyParam<'a> { +impl<'a> ConfirmPaymentIntentBuilderClientKeyParam<'a> { pub fn new( - customer_acceptance: ConfirmPaymentIntentClientKeyParamCustomerAcceptance<'a>, + customer_acceptance: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptance<'a>, ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentClientKeyParamCustomerAcceptance<'a> { +pub struct ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptance<'a> { /// If this is a Mandate accepted online, this hash contains details about the online acceptance. - pub online: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline<'a>, + pub online: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a>, /// The type of customer acceptance information included with the Mandate. #[serde(rename = "type")] - pub type_: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType, + pub type_: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType, } -impl<'a> ConfirmPaymentIntentClientKeyParamCustomerAcceptance<'a> { +impl<'a> ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptance<'a> { pub fn new( - online: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline<'a>, - type_: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType, + online: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a>, + type_: ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType, ) -> Self { Self { online, type_ } } } /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline<'a> { +pub struct ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a> { /// The IP address from which the Mandate was accepted by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub ip_address: Option<&'a str>, @@ -13938,47 +13232,47 @@ pub struct ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline<'a> { +impl<'a> ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a> { pub fn new() -> Self { Self::default() } } /// The type of customer acceptance information included with the Mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +pub enum ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { Online, } -impl ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +impl ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType::*; + use ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType::*; match self { Online => "online", } } } -impl std::str::FromStr for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType::*; + use ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType::*; match s { "online" => Ok(Online), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType { +impl serde::Serialize for ConfirmPaymentIntentBuilderClientKeyParamCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -13990,7 +13284,7 @@ impl serde::Serialize for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceTy /// Use this parameter in scenarios where you collect card details and [charge them later](https://stripe.com/docs/payments/cards/charging-saved-cards). #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum ConfirmPaymentIntentOffSession { +pub enum ConfirmPaymentIntentBuilderOffSession { Bool(bool), OneOff, Recurring, @@ -13999,7 +13293,7 @@ pub enum ConfirmPaymentIntentOffSession { /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodData<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -14014,22 +13308,22 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -14038,10 +13332,10 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -14050,13 +13344,13 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -14074,7 +13368,7 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -14090,27 +13384,24 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: ConfirmPaymentIntentPaymentMethodDataType, + pub type_: ConfirmPaymentIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -14118,8 +13409,8 @@ pub struct ConfirmPaymentIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> ConfirmPaymentIntentPaymentMethodData<'a> { - pub fn new(type_: ConfirmPaymentIntentPaymentMethodDataType) -> Self { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: ConfirmPaymentIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -14153,7 +13444,6 @@ impl<'a> ConfirmPaymentIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -14163,20 +13453,20 @@ impl<'a> ConfirmPaymentIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataBacsDebit<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -14184,17 +13474,17 @@ pub struct ConfirmPaymentIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetails<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { /// Billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// Email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -14205,14 +13495,14 @@ pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetails<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataBillingDetails<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataBillingDetails<'a> { pub fn new() -> Self { Self::default() } } /// Billing address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -14232,30 +13522,30 @@ pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataBillingDetailsAddress<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataBoleto<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataBoleto<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataEps { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmPaymentIntentPaymentMethodDataEps { +impl ConfirmPaymentIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -14263,7 +13553,7 @@ impl ConfirmPaymentIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodDataEpsBank { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -14295,9 +13585,9 @@ pub enum ConfirmPaymentIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodDataEpsBank { +impl ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataEpsBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -14332,10 +13622,10 @@ impl ConfirmPaymentIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataEpsBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -14369,18 +13659,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataEpsBank { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14390,27 +13680,28 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataFpx { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: + Option, /// The customer's bank. - pub bank: ConfirmPaymentIntentPaymentMethodDataFpxBank, + pub bank: ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank, } -impl ConfirmPaymentIntentPaymentMethodDataFpx { - pub fn new(bank: ConfirmPaymentIntentPaymentMethodDataFpxBank) -> Self { +impl ConfirmPaymentIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +impl ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -14418,10 +13709,10 @@ impl ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -14429,18 +13720,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolder } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14451,7 +13742,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderT /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodDataFpxBank { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -14477,9 +13768,9 @@ pub enum ConfirmPaymentIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodDataFpxBank { +impl ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataFpxBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -14508,10 +13799,10 @@ impl ConfirmPaymentIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataFpxBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -14539,18 +13830,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxBank { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14560,12 +13851,12 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataIdeal { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmPaymentIntentPaymentMethodDataIdeal { +impl ConfirmPaymentIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -14573,7 +13864,7 @@ impl ConfirmPaymentIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodDataIdealBank { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -14582,7 +13873,6 @@ pub enum ConfirmPaymentIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -14593,9 +13883,9 @@ pub enum ConfirmPaymentIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodDataIdealBank { +impl ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataIdealBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -14605,7 +13895,6 @@ impl ConfirmPaymentIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -14618,10 +13907,10 @@ impl ConfirmPaymentIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataIdealBank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -14631,7 +13920,6 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -14643,18 +13931,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataIdealBank { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14664,24 +13952,24 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataKlarna { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl ConfirmPaymentIntentPaymentMethodDataKlarna { +impl ConfirmPaymentIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataP24 { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmPaymentIntentPaymentMethodDataP24 { +impl ConfirmPaymentIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -14689,7 +13977,7 @@ impl ConfirmPaymentIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodDataP24Bank { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -14714,14 +14002,13 @@ pub enum ConfirmPaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodDataP24Bank { +impl ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataP24Bank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -14747,17 +14034,16 @@ impl ConfirmPaymentIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataP24Bank::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -14783,24 +14069,23 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataP24Bank { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14811,41 +14096,41 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataP24Bank { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataRadarOptions<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataRadarOptions<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataSepaDebit<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataSofort { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: ConfirmPaymentIntentPaymentMethodDataSofortCountry, + pub country: ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry, } -impl ConfirmPaymentIntentPaymentMethodDataSofort { - pub fn new(country: ConfirmPaymentIntentPaymentMethodDataSofortCountry) -> Self { +impl ConfirmPaymentIntentBuilderPaymentMethodDataSofort { + pub fn new(country: ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodDataSofortCountry { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -14853,9 +14138,9 @@ pub enum ConfirmPaymentIntentPaymentMethodDataSofortCountry { It, Nl, } -impl ConfirmPaymentIntentPaymentMethodDataSofortCountry { +impl ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataSofortCountry::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -14867,10 +14152,10 @@ impl ConfirmPaymentIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataSofortCountry::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -14882,18 +14167,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -14906,7 +14191,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodDataType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -14935,16 +14220,15 @@ pub enum ConfirmPaymentIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodDataType { +impl ConfirmPaymentIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -14974,7 +14258,6 @@ impl ConfirmPaymentIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -14983,10 +14266,10 @@ impl ConfirmPaymentIntentPaymentMethodDataType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -15016,7 +14299,6 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -15024,18 +14306,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataType { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataType { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15045,17 +14327,17 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataUsBankAccount<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -15063,20 +14345,20 @@ pub struct ConfirmPaymentIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -15084,10 +14366,12 @@ impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -15095,18 +14379,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAcc } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15116,13 +14406,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAcco } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -15130,10 +14420,10 @@ impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType::*; + use ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -15141,18 +14431,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAcc } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15162,125 +14452,124 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAcco } /// Payment method-specific configuration for this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptions<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option>, + pub affirm: Option>, /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option>, + pub afterpay_clearpay: + Option>, /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// Configuration for any card payments attempted on this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, + pub cashapp: Option, /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option>, + pub customer_balance: + Option>, /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option>, + pub konbini: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub pix: Option, + pub pix: Option, /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay: Option, - /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. + pub promptpay: Option, + /// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub revolut_pay: Option, /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option>, + pub sofort: Option, /// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option>, + pub wechat_pay: Option>, /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub zip: Option, + pub zip: Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptions<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: - Option>, + Option>, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -15291,20 +14580,20 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, - /// Bank account verification method. + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -15316,28 +14605,30 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub interval_description: Option<&'a str>, /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_schedule: - Option, + pub payment_schedule: Option< + ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule, + >, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_type: - Option, + pub transaction_type: Option< + ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType, + >, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -15347,11 +14638,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSched } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -15361,7 +14652,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -15369,14 +14660,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -15387,13 +14678,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -15402,11 +14693,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionT } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -15415,7 +14706,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -15423,14 +14714,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -15448,14 +14739,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -15464,10 +14755,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -15476,18 +14769,20 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15495,16 +14790,16 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetup serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -15513,10 +14808,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -15525,18 +14822,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVeri } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15546,14 +14849,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerif } /// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAffirm<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Affirm authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_locale: Option<&'a str>, @@ -15566,9 +14869,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAffirm<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirm<'a> { pub fn new() -> Self { Self::default() } @@ -15579,40 +14883,40 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAffirm<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15629,40 +14933,40 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureM /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsAffirmSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15672,7 +14976,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFut } /// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. @@ -15680,7 +14984,7 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] pub capture_method: - Option, + Option, /// An internal identifier or reference that this payment corresponds to. /// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes. /// This field differs from the statement descriptor and item name. @@ -15696,9 +15000,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpay<'a> { pub fn new() -> Self { Self::default() } @@ -15709,40 +15013,48 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpayCaptureMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15759,12 +15071,12 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearp /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match self { None => "none", } @@ -15772,11 +15084,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), @@ -15784,19 +15096,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAfterpayClearpaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15806,7 +15122,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearp } /// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAlipay { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -15816,9 +15132,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsAlipay { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipay { pub fn new() -> Self { Self::default() } @@ -15832,13 +15149,13 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAlipay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -15846,10 +15163,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -15857,18 +15174,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsAlipaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15878,7 +15195,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFut } /// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -15889,9 +15206,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebit { pub fn new() -> Self { Self::default() } @@ -15905,14 +15222,14 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -15921,10 +15238,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -15933,18 +15252,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSe } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsAuBecsDebitSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -15954,7 +15279,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSet } /// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsBacsDebit { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebit { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -15965,9 +15290,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsBacsDebit { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebit { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebit { pub fn new() -> Self { Self::default() } @@ -15981,14 +15306,14 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebit { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -15997,10 +15322,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -16009,18 +15336,20 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsBacsDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16030,11 +15359,11 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetup } /// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsBancontact { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontact { /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_language: - Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -16045,24 +15374,24 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsBancontact { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsBancontact { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontact { pub fn new() -> Self { Self::default() } } /// Preferred language of the Bancontact authorization page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { De, En, Fr, Nl, } -impl ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match self { De => "de", En => "en", @@ -16072,10 +15401,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -16085,18 +15416,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactPre } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactPreferredLanguage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16113,13 +15450,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactPref /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -16127,10 +15464,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -16138,91 +15477,22 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactSet } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - None, -} -impl ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsBancontactSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16232,7 +15502,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutur } /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsBoleto { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsBoleto { /// The number of calendar days before a Boleto voucher expires. /// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time. #[serde(skip_serializing_if = "Option::is_none")] @@ -16246,9 +15516,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsBoleto { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBoleto { pub fn new() -> Self { Self::default() } @@ -16262,14 +15533,14 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBoleto { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -16278,10 +15549,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -16290,18 +15561,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsBoletoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16311,14 +15582,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFut } /// Configuration for any card payments attempted on this PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCard<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// A single-use `cvc_update` Token that represents a card CVC value. /// When provided, the CVC value will be verified during the card payment attempt. /// This parameter can only be provided during confirmation. @@ -16328,10 +15599,11 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[serde(skip_serializing_if = "Option::is_none")] - pub installments: Option, + pub installments: Option, /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// When specified, this parameter indicates that a transaction will be marked /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -16341,33 +15613,31 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_extended_authorization: - Option, - /// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. + Option, + /// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_incremental_authorization: - Option, + Option, /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_multicapture: - Option, + Option, /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub request_overcapture: Option, + pub request_overcapture: + Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e. - /// using the cvc_token parameter). - #[serde(skip_serializing_if = "Option::is_none")] - pub require_cvc_recollection: Option, + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -16377,7 +15647,8 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Provides information about a card payment that customers see on their statements. /// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor. /// Maximum 22 characters. @@ -16390,12 +15661,8 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { /// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix_kanji: Option<&'a str>, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this payment. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } @@ -16406,40 +15673,40 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCard<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16451,7 +15718,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMet /// /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardInstallments { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallments { /// Setting to true enables installments for this PaymentIntent. /// This will cause the response to contain a list of available installment plans. /// Setting to false will prevent any selected plan from applying to a charge. @@ -16460,9 +15727,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[serde(skip_serializing_if = "Option::is_none")] - pub plan: Option, + pub plan: Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallments { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallments { pub fn new() -> Self { Self::default() } @@ -16470,21 +15737,21 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallments { /// The selected installment plan to use for this payment attempt. /// This parameter can only be provided during confirmation. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. pub count: u64, /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. - pub interval: ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, + pub interval: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, /// Type of installment plan, one of `fixed_count`. #[serde(rename = "type")] - pub type_: ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + pub type_: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlan { pub fn new( count: u64, - interval: ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval, - type_: ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType, + interval: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval, + type_: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType, ) -> Self { Self { count, interval, type_ } } @@ -16492,40 +15759,48 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan { /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. /// One of `month`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { Month, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match self { Month => "month", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval::*; match s { "month" => Ok(Month), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanInterval +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16535,40 +15810,40 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmen } /// Type of installment plan, one of `fixed_count`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { FixedCount, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match self { FixedCount => "fixed_count", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType::*; match s { "fixed_count" => Ok(FixedCount), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardInstallmentsPlanType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16578,13 +15853,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmen } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// A description of the mandate or subscription that is meant to be displayed to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -16594,7 +15869,7 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -16607,14 +15882,15 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { pub start_date: stripe_types::Timestamp, /// Specifies the type of mandates supported. Possible values are `india`. #[serde(skip_serializing_if = "Option::is_none")] - pub supported_types: - Option<&'a [ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, + pub supported_types: Option< + &'a [ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes], + >, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { pub fn new( amount: i64, - amount_type: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType, - interval: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval, + amount_type: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, + interval: ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, reference: &'a str, start_date: stripe_types::Timestamp, ) -> Self { @@ -16635,13 +15911,13 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions<'a> { /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -16649,10 +15925,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -16660,18 +15938,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOp } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16681,16 +15965,16 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOpt } /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { Day, Month, Sporadic, Week, Year, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { Day => "day", Month => "month", @@ -16701,10 +15985,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -16715,18 +16001,22 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOp } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16736,12 +16026,12 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOpt } /// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { India, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { India => "india", } @@ -16749,11 +16039,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { "india" => Ok(India), _ => Err(()), @@ -16761,19 +16051,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16785,7 +16079,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOpt /// Depends on the available networks of the card attached to the PaymentIntent. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -16798,9 +16092,9 @@ pub enum ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardNetwork::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -16817,10 +16111,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardNetwork::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -16837,18 +16131,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16858,13 +16152,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork { } /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { IfAvailable, Never, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -16873,11 +16167,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -16886,19 +16180,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestExtendedAuthorization +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -16906,15 +16204,15 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExt serializer.serialize_str(self.as_str()) } } -/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. +/// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { IfAvailable, Never, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match self { IfAvailable => "if_available", Never => "never", @@ -16923,11 +16221,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -16936,7 +16234,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -16944,14 +16242,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestIncrementalAuthorization { fn serialize(&self, serializer: S) -> Result where @@ -16962,13 +16260,13 @@ impl serde::Serialize } /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { IfAvailable, Never, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -16976,10 +16274,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -16987,18 +16285,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestMulticapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17008,13 +16306,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMul } /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { IfAvailable, Never, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match self { IfAvailable => "if_available", Never => "never", @@ -17022,10 +16320,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture::*; match s { "if_available" => Ok(IfAvailable), "never" => Ok(Never), @@ -17033,18 +16331,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOv } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestOvercapture { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17054,49 +16352,47 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOve } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17113,14 +16409,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThr /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -17129,10 +16425,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -17141,403 +16437,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this payment. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - pub cryptogram: &'a str, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// The exemption requested via 3DS and accepted by the issuer at authentication time. - #[serde(skip_serializing_if = "Option::is_none")] - pub exemption_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly - #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. - #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). - pub transaction_id: &'a str, - /// The version of 3D Secure that was performed. - pub version: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure<'a> { - pub fn new( - cryptogram: &'a str, - transaction_id: &'a str, - version: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion, - ) -> Self { - Self { - ares_trans_status: None, - cryptogram, - electronic_commerce_indicator: None, - exemption_indicator: None, - network_options: None, - requestor_challenge_indicator: None, - transaction_id, - version, - } - } -} -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; - match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", - } - } -} - -impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; - match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), - _ => Err(()), - } - } -} -impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The exemption requested via 3DS and accepted by the issuer at authentication time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - LowRisk, - None, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match self { - LowRisk => "low_risk", - None => "none", - } - } -} - -impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*; - match s { - "low_risk" => Ok(LowRisk), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO -pub cb_avalgo: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 -#[serde(skip_serializing_if = "Option::is_none")] -pub cb_score: Option, - -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; - match s { - "0" => Ok(V0), -"1" => Ok(V1), -"2" => Ok(V2), -"3" => Ok(V3), -"4" => Ok(V4), -"A" => Ok(A), -_ => Err(()) - - } - } -} -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { - fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { - serializer.serialize_str(self.as_str()) - } -} -/// The version of 3D Secure that was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*; - match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCardSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17547,14 +16458,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecu } /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCashapp { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCashapp { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -17564,9 +16475,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCashapp { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsCashapp { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCashapp { pub fn new() -> Self { Self::default() } @@ -17577,40 +16489,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCashapp { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17627,14 +16539,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappCapture /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -17643,10 +16555,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -17655,18 +16567,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupF } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCashappSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17676,15 +16588,16 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFu } /// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] pub bank_transfer: - Option>, + Option>, /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option, + pub funding_type: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -17695,16 +16608,16 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalance<'a> { pub fn new() -> Self { Self::default() } } /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] pub eu_bank_transfer: Option>, @@ -17713,15 +16626,15 @@ pub eu_bank_transfer: Option>, /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[serde(skip_serializing_if = "Option::is_none")] -pub requested_address_types: Option<&'a [ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, +pub requested_address_types: Option<&'a [ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes]>, /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[serde(rename = "type")] -pub type_: ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, +pub type_: ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { pub fn new( - type_: ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType, + type_: ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType, ) -> Self { Self { eu_bank_transfer: None, requested_address_types: None, type_ } } @@ -17731,7 +16644,8 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> /// /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ Aba, Iban, Sepa, @@ -17740,9 +16654,11 @@ pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequ Swift, Zengin, } -impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { +impl + ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes +{ pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match self { Aba => "aba", Iban => "iban", @@ -17755,61 +16671,51 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequeste } } -impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*; match s { - "aba" => Ok(Aba), - "iban" => Ok(Iban), - "sepa" => Ok(Sepa), - "sort_code" => Ok(SortCode), - "spei" => Ok(Spei), - "swift" => Ok(Swift), - "zengin" => Ok(Zengin), - _ => Err(()), + "aba" => Ok(Aba), +"iban" => Ok(Iban), +"sepa" => Ok(Sepa), +"sort_code" => Ok(SortCode), +"spei" => Ok(Spei), +"swift" => Ok(Swift), +"zengin" => Ok(Zengin), +_ => Err(()) + } } } -impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { EuBankTransfer, GbBankTransfer, JpBankTransfer, MxBankTransfer, UsBankTransfer, } -impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match self { EuBankTransfer => "eu_bank_transfer", GbBankTransfer => "gb_bank_transfer", @@ -17820,10 +16726,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType::*; match s { "eu_bank_transfer" => Ok(EuBankTransfer), "gb_bank_transfer" => Ok(GbBankTransfer), @@ -17834,18 +16742,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalan } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceBankTransferType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17856,40 +16770,46 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanc /// The funding method type to be used when there are not enough funds in the customer balance. /// Permitted values include: `bank_transfer`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { BankTransfer, } -impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match self { BankTransfer => "bank_transfer", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType::*; match s { "bank_transfer" => Ok(BankTransfer), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceFundingType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17906,40 +16826,48 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanc /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsCustomerBalanceSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -17949,7 +16877,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanc } /// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsEps { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsEps { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -17959,9 +16887,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsEps { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsEps { pub fn new() -> Self { Self::default() } @@ -17975,40 +16904,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsEps { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsEpsSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18018,7 +16947,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFuture } /// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsFpx { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsFpx { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18028,9 +16957,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsFpx { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsFpx { pub fn new() -> Self { Self::default() } @@ -18044,40 +16974,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsFpx { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsFpxSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18087,7 +17017,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFuture } /// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsGiropay { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18097,9 +17027,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsGiropay { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropay { pub fn new() -> Self { Self::default() } @@ -18113,40 +17044,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsGiropay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsGiropaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18156,7 +17087,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFu } /// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsGrabpay { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18166,9 +17097,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsGrabpay { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpay { pub fn new() -> Self { Self::default() } @@ -18182,40 +17114,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsGrabpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsGrabpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18225,7 +17157,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFu } /// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsIdeal { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsIdeal { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18235,9 +17167,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsIdeal { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsIdeal { pub fn new() -> Self { Self::default() } @@ -18251,13 +17184,13 @@ impl ConfirmPaymentIntentPaymentMethodOptionsIdeal { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -18265,10 +17198,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -18276,18 +17209,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFut } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsIdealSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18297,17 +17230,18 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutu } /// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsKlarna { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarna { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Preferred language of the Klarna authorization page that the customer is redirected to #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18317,9 +17251,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsKlarna { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsKlarna { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarna { pub fn new() -> Self { Self::default() } @@ -18330,40 +17265,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsKlarna { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18374,7 +17309,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureM /// Preferred language of the Klarna authorization page that the customer is redirected to #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -18422,9 +17357,9 @@ pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -18475,10 +17410,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -18528,18 +17463,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferr } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18556,40 +17491,40 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferre /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsKlarnaSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18599,7 +17534,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFut } /// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsKonbini<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { /// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. /// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness. /// We recommend to use the customer's phone number. @@ -18626,9 +17561,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsKonbini<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbini<'a> { pub fn new() -> Self { Self::default() } @@ -18642,40 +17578,40 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsKonbini<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsKonbiniSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18685,14 +17621,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFu } /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsLink<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsLink<'a> { /// Controls when the funds will be captured from the customer's account. /// /// If provided, this parameter will override the top-level `capture_method` when finalizing the payment with this payment method type. /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// \[Deprecated\] This is a legacy parameter that no longer has any function. #[serde(skip_serializing_if = "Option::is_none")] pub persistent_token: Option<&'a str>, @@ -18705,9 +17641,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsLink<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsLink<'a> { pub fn new() -> Self { Self::default() } @@ -18718,40 +17655,40 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsLink<'a> { /// /// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter will unset the stored value for this payment method type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18768,13 +17705,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMet /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -18782,10 +17719,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -18793,18 +17730,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsLinkSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18814,7 +17751,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutur } /// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsOxxo { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxo { /// The number of calendar days before an OXXO voucher expires. /// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. #[serde(skip_serializing_if = "Option::is_none")] @@ -18828,9 +17765,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsOxxo { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxo { pub fn new() -> Self { Self::default() } @@ -18844,40 +17782,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsOxxo { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsOxxoSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18887,7 +17825,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutur } /// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsP24 { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsP24 { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18897,12 +17835,13 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, /// Confirm that the payer has accepted the P24 terms and conditions. #[serde(skip_serializing_if = "Option::is_none")] pub tos_shown_and_accepted: Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsP24 { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsP24 { pub fn new() -> Self { Self::default() } @@ -18916,40 +17855,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsP24 { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsP24SetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -18959,7 +17898,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFuture } /// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsPaynow { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynow { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -18969,9 +17908,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsPaynow { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynow { pub fn new() -> Self { Self::default() } @@ -18985,40 +17925,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsPaynow { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaynowSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19028,13 +17968,14 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFut } /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsPaypal<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locale: Option, + pub preferred_locale: + Option, /// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. /// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. #[serde(skip_serializing_if = "Option::is_none")] @@ -19051,49 +17992,50 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsPaypal<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsPaypal<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypal<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { Manual, } -impl ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match self { Manual => "manual", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod::*; match s { "manual" => Ok(Manual), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19104,7 +18046,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureM /// [Preferred locale](https://stripe.com/docs/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { CsMinusCz, DaMinusDk, DeMinusAt, @@ -19129,9 +18071,9 @@ pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match self { CsMinusCz => "cs-CZ", DaMinusDk => "da-DK", @@ -19159,10 +18101,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale::*; match s { "cs-CZ" => Ok(CsMinusCz), "da-DK" => Ok(DaMinusDk), @@ -19189,18 +18131,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferr } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalPreferredLocale { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19217,13 +18159,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferre /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -19231,10 +18173,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -19242,18 +18184,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPaypalSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19263,7 +18205,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFut } /// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsPix { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsPix { /// The number of seconds (between 10 and 1209600) after which Pix payment will expire. /// Defaults to 86400 seconds. #[serde(skip_serializing_if = "Option::is_none")] @@ -19281,9 +18223,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsPix { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPix { pub fn new() -> Self { Self::default() } @@ -19297,40 +18240,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsPix { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPixSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19340,7 +18283,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFuture } /// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsPromptpay { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -19351,9 +18294,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsPromptpay { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsPromptpay { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpay { pub fn new() -> Self { Self::default() } @@ -19367,40 +18310,44 @@ impl ConfirmPaymentIntentPaymentMethodOptionsPromptpay { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsPromptpaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19408,9 +18355,9 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetup serializer.serialize_str(self.as_str()) } } -/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options. +/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Demo Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsRevolutPay { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPay { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -19419,9 +18366,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsRevolutPay { /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPay { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPay { pub fn new() -> Self { Self::default() } @@ -19433,13 +18380,13 @@ impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPay { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -19447,10 +18394,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -19458,18 +18407,22 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySet } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsRevolutPaySetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19479,7 +18432,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetu } /// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsSepaDebit<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option<&'a serde_json::Value>, @@ -19493,9 +18446,9 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsSepaDebit<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebit<'a> { pub fn new() -> Self { Self::default() } @@ -19509,14 +18462,14 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsSepaDebit<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -19525,10 +18478,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -19537,18 +18492,20 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsSepaDebitSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19558,10 +18515,11 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetup } /// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsSofort { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsSofort { /// Language shown to the payer on redirect. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_language: Option, + pub preferred_language: + Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -19571,16 +18529,17 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsSofort { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsSofort { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsSofort { pub fn new() -> Self { Self::default() } } /// Language shown to the payer on redirect. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { De, En, Es, @@ -19589,9 +18548,9 @@ pub enum ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { Nl, Pl, } -impl ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match self { De => "de", En => "en", @@ -19604,10 +18563,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage::*; match s { "de" => Ok(De), "en" => Ok(En), @@ -19620,18 +18579,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferr } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortPreferredLanguage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19648,13 +18607,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferre /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { None, OffSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -19662,10 +18621,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -19673,18 +18632,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFu } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsSofortSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -19692,96 +18651,22 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFut serializer.serialize_str(self.as_str()) } } -/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options. +/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsSwish<'a> { - /// The order ID displayed in the Swish app after the payment is authorized. +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { + /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsSwish<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - None, -} -impl ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount<'a> { - /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: - Option, - /// Additional fields for network related functions - #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, - /// Preferred transaction settlement speed - #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_settlement_speed: - Option, + pub financial_connections: Option< + ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, + >, + /// Additional fields for network related functions + #[serde(skip_serializing_if = "Option::is_none")] + pub networks: Option>, + /// Preferred transaction settlement speed + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_settlement_speed: Option< + ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed, + >, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -19792,35 +18677,35 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, - /// Bank account verification method. + Option, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[serde(skip_serializing_if = "Option::is_none")] -pub permissions: Option<&'a [ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, +pub permissions: Option<&'a [ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] -pub prefetch: Option<&'a [ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, +pub prefetch: Option<&'a [ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. #[serde(skip_serializing_if = "Option::is_none")] pub return_url: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -19829,15 +18714,16 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectio /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ Balances, Ownership, PaymentMethod, Transactions, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -19848,11 +18734,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPe } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -19863,7 +18749,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -19871,14 +18757,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -19889,99 +18775,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() - } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), _ => Err(()), } } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -19989,14 +18808,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -20007,26 +18826,26 @@ impl serde::Serialize } /// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] pub requested: - Option<&'a [ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + Option<&'a [ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } /// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { Ach, UsDomesticWire, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -20034,10 +18853,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -20045,18 +18866,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20066,13 +18893,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountN } /// Preferred transaction settlement speed #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { Fastest, Standard, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match self { Fastest => "fastest", Standard => "standard", @@ -20081,11 +18908,11 @@ impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpe } impl std::str::FromStr - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*; match s { "fastest" => Ok(Fastest), "standard" => Ok(Standard), @@ -20094,7 +18921,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -20102,14 +18929,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed { fn serialize(&self, serializer: S) -> Result where @@ -20127,14 +18954,14 @@ impl serde::Serialize /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { None, OffSession, OnSession, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match self { None => "none", OffSession => "off_session", @@ -20143,10 +18970,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage::*; match s { "none" => Ok(None), "off_session" => Ok(OffSession), @@ -20155,18 +18984,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountSetupFutureUsage +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20174,16 +19009,16 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountS serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -20192,10 +19027,12 @@ impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -20204,18 +19041,24 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for ConfirmPaymentIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20225,12 +19068,12 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountV } /// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsWechatPay<'a> { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { /// The app ID registered with WeChat Pay. Only required when client is ios or android. #[serde(skip_serializing_if = "Option::is_none")] pub app_id: Option<&'a str>, /// The client type that the end customer will pay from - pub client: ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient, + pub client: ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -20241,23 +19084,23 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsWechatPay<'a> { /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] pub setup_future_usage: - Option, + Option, } -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsWechatPay<'a> { - pub fn new(client: ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient) -> Self { +impl<'a> ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPay<'a> { + pub fn new(client: ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient) -> Self { Self { app_id: None, client, setup_future_usage: None } } } /// The client type that the end customer will pay from #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { Android, Ios, Web, } -impl ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match self { Android => "android", Ios => "ios", @@ -20266,10 +19109,10 @@ impl ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient::*; match s { "android" => Ok(Android), "ios" => Ok(Ios), @@ -20278,18 +19121,18 @@ impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClie } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPayClient { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20306,40 +19149,44 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClien /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::str::FromStr + for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Display + for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsWechatPaySetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20349,7 +19196,7 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetup } /// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsZip { +pub struct ConfirmPaymentIntentBuilderPaymentMethodOptionsZip { /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -20359,9 +19206,10 @@ pub struct ConfirmPaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: + Option, } -impl ConfirmPaymentIntentPaymentMethodOptionsZip { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsZip { pub fn new() -> Self { Self::default() } @@ -20375,40 +19223,40 @@ impl ConfirmPaymentIntentPaymentMethodOptionsZip { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +pub enum ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { None, } -impl ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match self { None => "none", } } } -impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::str::FromStr for ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*; + use ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage::*; match s { "none" => Ok(None), _ => Err(()), } } } -impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Display for ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl std::fmt::Debug for ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage { +impl serde::Serialize for ConfirmPaymentIntentBuilderPaymentMethodOptionsZipSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -20419,21 +19267,21 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFuture /// Options to configure Radar. /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentRadarOptions<'a> { +pub struct ConfirmPaymentIntentBuilderRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentRadarOptions<'a> { +impl<'a> ConfirmPaymentIntentBuilderRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentShipping<'a> { +pub struct ConfirmPaymentIntentBuilderShipping<'a> { /// Shipping address. - pub address: ConfirmPaymentIntentShippingAddress<'a>, + pub address: ConfirmPaymentIntentBuilderShippingAddress<'a>, /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. #[serde(skip_serializing_if = "Option::is_none")] pub carrier: Option<&'a str>, @@ -20447,14 +19295,14 @@ pub struct ConfirmPaymentIntentShipping<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tracking_number: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentShipping<'a> { - pub fn new(address: ConfirmPaymentIntentShippingAddress<'a>, name: &'a str) -> Self { +impl<'a> ConfirmPaymentIntentBuilderShipping<'a> { + pub fn new(address: ConfirmPaymentIntentBuilderShippingAddress<'a>, name: &'a str) -> Self { Self { address, carrier: None, name, phone: None, tracking_number: None } } } /// Shipping address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentShippingAddress<'a> { +pub struct ConfirmPaymentIntentBuilderShippingAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -20474,50 +19322,413 @@ pub struct ConfirmPaymentIntentShippingAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> ConfirmPaymentIntentShippingAddress<'a> { +impl<'a> ConfirmPaymentIntentBuilderShippingAddress<'a> { pub fn new() -> Self { Self::default() } } +/// Confirm that your customer intends to pay with current or provided +/// payment method. Upon confirmation, the PaymentIntent will attempt to initiate +/// a payment. +/// If the selected payment method requires additional authentication steps, the +/// PaymentIntent will transition to the `requires_action` status and +/// suggest additional actions via `next_action`. If payment fails, +/// the PaymentIntent transitions to the `requires_payment_method` status or the +/// `canceled` status if the confirmation limit is reached. If +/// payment succeeds, the PaymentIntent will transition to the `succeeded` +/// status (or `requires_capture`, if `capture_method` is set to `manual`). +/// If the `confirmation_method` is `automatic`, payment may be attempted +/// using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) +/// and the PaymentIntent’s [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret). +/// After `next_action`s are handled by the client, no additional +/// confirmation is required to complete the payment. +/// If the `confirmation_method` is `manual`, all payment attempts must be +/// initiated using a secret key. +/// If any actions are required for the payment, the PaymentIntent will +/// return to the `requires_confirmation` state +/// after those actions are completed. Your server needs to then +/// explicitly re-confirm the PaymentIntent to initiate the next payment +/// attempt. +/// Read the [expanded documentation](https://stripe.com/docs/payments/payment-intents/web-manual). +/// to learn more about manual confirmation. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ConfirmPaymentIntent<'a> { + inner: ConfirmPaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} impl<'a> ConfirmPaymentIntent<'a> { - /// Confirm that your customer intends to pay with current or provided - /// payment method. Upon confirmation, the PaymentIntent will attempt to initiate - /// a payment. - /// If the selected payment method requires additional authentication steps, the - /// PaymentIntent will transition to the `requires_action` status and - /// suggest additional actions via `next_action`. If payment fails, - /// the PaymentIntent transitions to the `requires_payment_method` status or the - /// `canceled` status if the confirmation limit is reached. If - /// payment succeeds, the PaymentIntent will transition to the `succeeded` - /// status (or `requires_capture`, if `capture_method` is set to `manual`). - /// If the `confirmation_method` is `automatic`, payment may be attempted - /// using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) - /// and the PaymentIntent’s [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret). - /// After `next_action`s are handled by the client, no additional - /// confirmation is required to complete the payment. - /// If the `confirmation_method` is `manual`, all payment attempts must be - /// initiated using a secret key. - /// If any actions are required for the payment, the PaymentIntent will - /// return to the `requires_confirmation` state - /// after those actions are completed. Your server needs to then - /// explicitly re-confirm the PaymentIntent to initiate the next payment - /// attempt. - /// Read the [expanded documentation](https://stripe.com/docs/payments/payment-intents/web-manual). - /// to learn more about manual confirmation. - pub fn send( + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: ConfirmPaymentIntentBuilder::new() } + } + pub fn capture_method( + mut self, + capture_method: stripe_shared::PaymentIntentCaptureMethod, + ) -> Self { + self.inner.capture_method = Some(capture_method); + self + } + + pub fn error_on_requires_action(mut self, error_on_requires_action: bool) -> Self { + self.inner.error_on_requires_action = Some(error_on_requires_action); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn mandate(mut self, mandate: &'a str) -> Self { + self.inner.mandate = Some(mandate); + self + } + + pub fn mandate_data( + mut self, + mandate_data: ConfirmPaymentIntentBuilderMandateData<'a>, + ) -> Self { + self.inner.mandate_data = Some(mandate_data); + self + } + + pub fn off_session(mut self, off_session: ConfirmPaymentIntentBuilderOffSession) -> Self { + self.inner.off_session = Some(off_session); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: ConfirmPaymentIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: ConfirmPaymentIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn radar_options( + mut self, + radar_options: ConfirmPaymentIntentBuilderRadarOptions<'a>, + ) -> Self { + self.inner.radar_options = Some(radar_options); + self + } + + pub fn receipt_email(mut self, receipt_email: &'a str) -> Self { + self.inner.receipt_email = Some(receipt_email); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } + + pub fn setup_future_usage( + mut self, + setup_future_usage: stripe_shared::PaymentIntentSetupFutureUsage, + ) -> Self { + self.inner.setup_future_usage = Some(setup_future_usage); + self + } + + pub fn shipping(mut self, shipping: ConfirmPaymentIntentBuilderShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn use_stripe_sdk(mut self, use_stripe_sdk: bool) -> Self { + self.inner.use_stripe_sdk = Some(use_stripe_sdk); + self + } +} +impl ConfirmPaymentIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/confirm"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ConfirmPaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/confirm")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelPaymentIntentBuilder<'a> { + /// Reason for canceling this PaymentIntent. + /// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. + #[serde(skip_serializing_if = "Option::is_none")] + pub cancellation_reason: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelPaymentIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Reason for canceling this PaymentIntent. +/// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CancelPaymentIntentBuilderCancellationReason { + Abandoned, + Duplicate, + Fraudulent, + RequestedByCustomer, +} +impl CancelPaymentIntentBuilderCancellationReason { + pub fn as_str(self) -> &'static str { + use CancelPaymentIntentBuilderCancellationReason::*; + match self { + Abandoned => "abandoned", + Duplicate => "duplicate", + Fraudulent => "fraudulent", + RequestedByCustomer => "requested_by_customer", + } + } +} + +impl std::str::FromStr for CancelPaymentIntentBuilderCancellationReason { + type Err = (); + fn from_str(s: &str) -> Result { + use CancelPaymentIntentBuilderCancellationReason::*; + match s { + "abandoned" => Ok(Abandoned), + "duplicate" => Ok(Duplicate), + "fraudulent" => Ok(Fraudulent), + "requested_by_customer" => Ok(RequestedByCustomer), + _ => Err(()), + } + } +} +impl std::fmt::Display for CancelPaymentIntentBuilderCancellationReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CancelPaymentIntentBuilderCancellationReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CancelPaymentIntentBuilderCancellationReason { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// You can cancel a PaymentIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action` or, [in rare cases](https://stripe.com/docs/payments/intents), `processing`. +/// +/// +/// After it’s canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. +/// For PaymentIntents with a `status` of `requires_capture`, the remaining `amount_capturable` is automatically refunded. +/// +/// +/// You can’t cancel the PaymentIntent for a Checkout Session. +/// [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelPaymentIntent<'a> { + inner: CancelPaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} +impl<'a> CancelPaymentIntent<'a> { + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: CancelPaymentIntentBuilder::new() } + } + pub fn cancellation_reason( + mut self, + cancellation_reason: CancelPaymentIntentBuilderCancellationReason, + ) -> Self { + self.inner.cancellation_reason = Some(cancellation_reason); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelPaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelPaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/cancel")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CapturePaymentIntentBuilder<'a> { + /// The amount to capture from the PaymentIntent, which must be less than or equal to the original amount. + /// Any additional amount is automatically refunded. + /// Defaults to the full `amount_capturable` if it's not provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_to_capture: Option, + /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. + /// The amount of the application fee collected will be capped at the total payment amount. + /// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + #[serde(skip_serializing_if = "Option::is_none")] + pub application_fee_amount: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Defaults to `true`. + /// When capturing a PaymentIntent, setting `final_capture` to `false` notifies Stripe to not release the remaining uncaptured funds to make sure that they're captured in future requests. + /// You can only use this setting when [multicapture](https://stripe.com/docs/payments/multicapture) is available for PaymentIntents. + #[serde(skip_serializing_if = "Option::is_none")] + pub final_capture: Option, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. + /// Must contain at least one letter, maximum 22 characters. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor: Option<&'a str>, + /// Provides information about a card payment that customers see on their statements. + /// Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. + /// The concatenated descriptor must be 1-22 characters long. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor_suffix: Option<&'a str>, + /// The parameters that you can use to automatically create a transfer after the payment + /// is captured. + /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + #[serde(skip_serializing_if = "Option::is_none")] + pub transfer_data: Option, +} +impl<'a> CapturePaymentIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Capture the funds of an existing uncaptured PaymentIntent when its status is `requires_capture`. +/// +/// Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation. +/// +/// Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CapturePaymentIntent<'a> { + inner: CapturePaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} +impl<'a> CapturePaymentIntent<'a> { + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: CapturePaymentIntentBuilder::new() } + } + pub fn amount_to_capture(mut self, amount_to_capture: i64) -> Self { + self.inner.amount_to_capture = Some(amount_to_capture); + self + } + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn final_capture(mut self, final_capture: bool) -> Self { + self.inner.final_capture = Some(final_capture); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn statement_descriptor_suffix(mut self, statement_descriptor_suffix: &'a str) -> Self { + self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataUpdateParams) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } +} +impl CapturePaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CapturePaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/capture")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct IncrementAuthorizationPaymentIntent<'a> { +pub struct IncrementAuthorizationPaymentIntentBuilder<'a> { /// The updated total amount that you intend to collect from the cardholder. /// This amount must be greater than the currently authorized amount. pub amount: i64, @@ -20538,9 +19749,8 @@ pub struct IncrementAuthorizationPaymentIntent<'a> { /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, - /// For card charges, use [statement_descriptor_suffix](https://stripe.com/docs/payments/account/statement-descriptors#dynamic). - /// Otherwise, you can use this value as the complete description of a charge on your customers' statements. - /// It must contain at least one letter and be 1–22 characters long. + /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. + /// Must contain at least one letter, maximum 22 characters. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, /// The parameters used to automatically create a transfer after the payment is captured. @@ -20548,7 +19758,7 @@ pub struct IncrementAuthorizationPaymentIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option, } -impl<'a> IncrementAuthorizationPaymentIntent<'a> { +impl<'a> IncrementAuthorizationPaymentIntentBuilder<'a> { pub fn new(amount: i64) -> Self { Self { amount, @@ -20561,45 +19771,99 @@ impl<'a> IncrementAuthorizationPaymentIntent<'a> { } } } +/// Perform an incremental authorization on an eligible +/// [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the +/// PaymentIntent’s status must be `requires_capture` and +/// [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported). +/// must be `true`. +/// +/// Incremental authorizations attempt to increase the authorized amount on +/// your customer’s card to the new, higher `amount` provided. Similar to the +/// initial authorization, incremental authorizations can be declined. A +/// single PaymentIntent can call this endpoint multiple times to further +/// increase the authorized amount. +/// +/// If the incremental authorization succeeds, the PaymentIntent object +/// returns with the updated +/// [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). +/// If the incremental authorization fails, a +/// [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other +/// fields on the PaymentIntent or Charge update. The PaymentIntent +/// object remains capturable for the previously authorized amount. +/// +/// Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines. +/// After it’s captured, a PaymentIntent can no longer be incremented. +/// +/// Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations). +#[derive(Clone, Debug, serde::Serialize)] +pub struct IncrementAuthorizationPaymentIntent<'a> { + inner: IncrementAuthorizationPaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} impl<'a> IncrementAuthorizationPaymentIntent<'a> { - /// Perform an incremental authorization on an eligible - /// [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the - /// PaymentIntent’s status must be `requires_capture` and - /// [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported). - /// must be `true`. - /// - /// Incremental authorizations attempt to increase the authorized amount on - /// your customer’s card to the new, higher `amount` provided. Similar to the - /// initial authorization, incremental authorizations can be declined. A - /// single PaymentIntent can call this endpoint multiple times to further - /// increase the authorized amount. - /// - /// If the incremental authorization succeeds, the PaymentIntent object - /// returns with the updated - /// [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). - /// If the incremental authorization fails, a - /// [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other - /// fields on the PaymentIntent or Charge update. The PaymentIntent - /// object remains capturable for the previously authorized amount. - /// - /// Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines. - /// After it’s captured, a PaymentIntent can no longer be incremented. - /// - /// Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations). - pub fn send( + pub fn new(intent: &'a stripe_shared::PaymentIntentId, amount: i64) -> Self { + Self { intent, inner: IncrementAuthorizationPaymentIntentBuilder::new(amount) } + } + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn transfer_data(mut self, transfer_data: TransferDataUpdateParams) -> Self { + self.inner.transfer_data = Some(transfer_data); + self + } +} +impl IncrementAuthorizationPaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/increment_authorization"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for IncrementAuthorizationPaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_intents/{intent}/increment_authorization"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct VerifyMicrodepositsPaymentIntent<'a> { +pub struct VerifyMicrodepositsPaymentIntentBuilder<'a> { /// Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub amounts: Option<&'a [i64]>, @@ -20610,25 +19874,142 @@ pub struct VerifyMicrodepositsPaymentIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> VerifyMicrodepositsPaymentIntent<'a> { +impl<'a> VerifyMicrodepositsPaymentIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Verifies microdeposits on a PaymentIntent object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct VerifyMicrodepositsPaymentIntent<'a> { + inner: VerifyMicrodepositsPaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} impl<'a> VerifyMicrodepositsPaymentIntent<'a> { - /// Verifies microdeposits on a PaymentIntent object. - pub fn send( + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: VerifyMicrodepositsPaymentIntentBuilder::new() } + } + pub fn amounts(mut self, amounts: &'a [i64]) -> Self { + self.inner.amounts = Some(amounts); + self + } + + pub fn descriptor_code(mut self, descriptor_code: &'a str) -> Self { + self.inner.descriptor_code = Some(descriptor_code); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl VerifyMicrodepositsPaymentIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for VerifyMicrodepositsPaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_intents/{intent}/verify_microdeposits"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ApplyCustomerBalancePaymentIntentBuilder<'a> { + /// Amount that you intend to apply to this PaymentIntent from the customer’s cash balance. + /// + /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (for example, 100 cents to charge 1 USD or 100 to charge 100 JPY, a zero-decimal currency). + /// + /// The maximum amount is the amount of the PaymentIntent. + /// + /// When you omit the amount, it defaults to the remaining amount requested on the PaymentIntent. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> ApplyCustomerBalancePaymentIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Manually reconcile the remaining amount for a `customer_balance` PaymentIntent. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ApplyCustomerBalancePaymentIntent<'a> { + inner: ApplyCustomerBalancePaymentIntentBuilder<'a>, + intent: &'a stripe_shared::PaymentIntentId, +} +impl<'a> ApplyCustomerBalancePaymentIntent<'a> { + pub fn new(intent: &'a stripe_shared::PaymentIntentId) -> Self { + Self { intent, inner: ApplyCustomerBalancePaymentIntentBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ApplyCustomerBalancePaymentIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::PaymentIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_intents/{intent}/verify_microdeposits"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ApplyCustomerBalancePaymentIntent<'_> { + type Output = stripe_shared::PaymentIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_intents/{intent}/apply_customer_balance"), ) + .form(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct OnlineParam<'a> { /// The IP address from which the Mandate was accepted by the customer. @@ -20674,6 +20055,18 @@ impl DateOfBirth { } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PaymentIntentPaymentMethodOptionsParam<'a> { + /// The 6-digit BLIK code that a customer has generated using their banking application. + /// Can only be set on confirmation. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option<&'a str>, +} +impl<'a> PaymentIntentPaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct PaymentMethodOptionsParam { /// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity). #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/stripe_core/src/payment_source/requests.rs b/generated/stripe_core/src/payment_source/requests.rs index 40402f3e8..05bfbecf4 100644 --- a/generated/stripe_core/src/payment_source/requests.rs +++ b/generated/stripe_core/src/payment_source/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCustomerPaymentSource<'a> { +pub struct ListCustomerPaymentSourceBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -21,51 +25,126 @@ pub struct ListCustomerPaymentSource<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCustomerPaymentSource<'a> { +impl<'a> ListCustomerPaymentSourceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// List sources for a specified customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCustomerPaymentSource<'a> { + inner: ListCustomerPaymentSourceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> ListCustomerPaymentSource<'a> { - /// List sources for a specified customer. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId) -> Self { + Self { customer, inner: ListCustomerPaymentSourceBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn object(mut self, object: &'a str) -> Self { + self.inner.object = Some(object); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListCustomerPaymentSource<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response> { - client.get_query(&format!("/customers/{customer}/sources"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - customer: &stripe_shared::CustomerId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/customers/{customer}/sources"), self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCustomerPaymentSource<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/sources")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentSource<'a> { +pub struct RetrievePaymentSourceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrievePaymentSource<'a> { +impl<'a> RetrievePaymentSourceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieve a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentSource<'a> { + inner: RetrievePaymentSourceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} impl<'a> RetrievePaymentSource<'a> { - /// Retrieve a specified source for a given customer. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: RetrievePaymentSourceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentSource<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.get_query(&format!("/customers/{customer}/sources/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentSource<'_> { + type Output = stripe_shared::PaymentSource; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/sources/{id}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerPaymentSource<'a> { +pub struct CreateCustomerPaymentSourceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -80,22 +159,62 @@ pub struct CreateCustomerPaymentSource<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, } -impl<'a> CreateCustomerPaymentSource<'a> { +impl<'a> CreateCustomerPaymentSourceBuilder<'a> { pub fn new(source: &'a str) -> Self { Self { expand: None, metadata: None, source, validate: None } } } +/// When you create a new credit card, you must specify a customer or recipient on which to create it. +/// +/// If the card’s owner has no default card, then the new card will become the default. +/// However, if the owner already has a default, then it will not change. +/// To change the default, you should [update the customer](https://stripe.com/docs/api#update_customer) to have a new `default_source`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCustomerPaymentSource<'a> { + inner: CreateCustomerPaymentSourceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, +} impl<'a> CreateCustomerPaymentSource<'a> { - /// When you create a new credit card, you must specify a customer or recipient on which to create it. - /// - /// If the card’s owner has no default card, then the new card will become the default. - /// However, if the owner already has a default, then it will not change. - /// To change the default, you should [update the customer](https://stripe.com/docs/api#update_customer) to have a new `default_source`. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId, source: &'a str) -> Self { + Self { customer, inner: CreateCustomerPaymentSourceBuilder::new(source) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn validate(mut self, validate: bool) -> Self { + self.inner.validate = Some(validate); + self + } +} +impl CreateCustomerPaymentSource<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - ) -> stripe::Response { - client.send_form(&format!("/customers/{customer}/sources"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCustomerPaymentSource<'_> { + type Output = stripe_shared::PaymentSource; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}/sources")) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/payout/requests.rs b/generated/stripe_core/src/payout/requests.rs index 48cad35dd..18a1eb637 100644 --- a/generated/stripe_core/src/payout/requests.rs +++ b/generated/stripe_core/src/payout/requests.rs @@ -1,5 +1,61 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPayout<'a> { +pub struct RetrievePayoutBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePayoutBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing payout. +/// Supply the unique payout ID from either a payout creation request or the payout list. +/// Stripe returns the corresponding payout information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePayout<'a> { + inner: RetrievePayoutBuilder<'a>, + payout: &'a stripe_shared::PayoutId, +} +impl<'a> RetrievePayout<'a> { + pub fn new(payout: &'a stripe_shared::PayoutId) -> Self { + Self { payout, inner: RetrievePayoutBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePayout<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePayout<'_> { + type Output = stripe_shared::Payout; + + fn build(&self) -> RequestBuilder { + let payout = self.payout; + RequestBuilder::new(StripeMethod::Get, format!("/payouts/{payout}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListPayoutBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub arrival_date: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -28,49 +84,86 @@ pub struct ListPayout<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option<&'a str>, } -impl<'a> ListPayout<'a> { +impl<'a> ListPayoutBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. +/// The payouts return in sorted order, with the most recently created payouts appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPayout<'a> { + inner: ListPayoutBuilder<'a>, +} impl<'a> ListPayout<'a> { - /// Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. - /// The payouts return in sorted order, with the most recently created payouts appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payouts", self) + pub fn new() -> Self { + Self { inner: ListPayoutBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payouts", self) + pub fn arrival_date(mut self, arrival_date: stripe_types::RangeQueryTs) -> Self { + self.inner.arrival_date = Some(arrival_date); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePayout<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePayout<'a> { - pub fn new() -> Self { - Self::default() + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn destination(mut self, destination: &'a str) -> Self { + self.inner.destination = Some(destination); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: &'a str) -> Self { + self.inner.status = Some(status); + self } } -impl<'a> RetrievePayout<'a> { - /// Retrieves the details of an existing payout. - /// Supply the unique payout ID from either a payout creation request or the payout list. - /// Stripe returns the corresponding payout information. - pub fn send( +impl ListPayout<'_> { + pub async fn send( &self, - client: &stripe::Client, - payout: &stripe_shared::PayoutId, - ) -> stripe::Response { - client.get_query(&format!("/payouts/{payout}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPayout<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payouts").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePayout<'a> { +pub struct CreatePayoutBuilder<'a> { /// A positive integer in cents representing how much to payout. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -96,13 +189,13 @@ pub struct CreatePayout<'a> { /// We support `instant` for payouts to debit cards and bank accounts in certain countries. /// Learn more about [bank support for Instant Payouts](https://stripe.com/docs/payouts/instant-payouts-banks). #[serde(skip_serializing_if = "Option::is_none")] - pub method: Option, + pub method: Option, /// The balance type of your Stripe balance to draw this payout from. /// Balances for different payment sources are kept separately. /// You can find the amounts with the Balances API. /// One of `bank_account`, `card`, or `fpx`. #[serde(skip_serializing_if = "Option::is_none")] - pub source_type: Option, + pub source_type: Option, /// A string that displays on the recipient's bank or card statement (up to 22 characters). /// A `statement_descriptor` that's longer than 22 characters return an error. /// Most banks truncate this information and display it inconsistently. @@ -110,7 +203,7 @@ pub struct CreatePayout<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, } -impl<'a> CreatePayout<'a> { +impl<'a> CreatePayoutBuilder<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, @@ -129,13 +222,13 @@ impl<'a> CreatePayout<'a> { /// We support `instant` for payouts to debit cards and bank accounts in certain countries. /// Learn more about [bank support for Instant Payouts](https://stripe.com/docs/payouts/instant-payouts-banks). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePayoutMethod { +pub enum CreatePayoutBuilderMethod { Instant, Standard, } -impl CreatePayoutMethod { +impl CreatePayoutBuilderMethod { pub fn as_str(self) -> &'static str { - use CreatePayoutMethod::*; + use CreatePayoutBuilderMethod::*; match self { Instant => "instant", Standard => "standard", @@ -143,10 +236,10 @@ impl CreatePayoutMethod { } } -impl std::str::FromStr for CreatePayoutMethod { +impl std::str::FromStr for CreatePayoutBuilderMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePayoutMethod::*; + use CreatePayoutBuilderMethod::*; match s { "instant" => Ok(Instant), "standard" => Ok(Standard), @@ -154,18 +247,18 @@ impl std::str::FromStr for CreatePayoutMethod { } } } -impl std::fmt::Display for CreatePayoutMethod { +impl std::fmt::Display for CreatePayoutBuilderMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePayoutMethod { +impl std::fmt::Debug for CreatePayoutBuilderMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePayoutMethod { +impl serde::Serialize for CreatePayoutBuilderMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -178,14 +271,14 @@ impl serde::Serialize for CreatePayoutMethod { /// You can find the amounts with the Balances API. /// One of `bank_account`, `card`, or `fpx`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePayoutSourceType { +pub enum CreatePayoutBuilderSourceType { BankAccount, Card, Fpx, } -impl CreatePayoutSourceType { +impl CreatePayoutBuilderSourceType { pub fn as_str(self) -> &'static str { - use CreatePayoutSourceType::*; + use CreatePayoutBuilderSourceType::*; match self { BankAccount => "bank_account", Card => "card", @@ -194,10 +287,10 @@ impl CreatePayoutSourceType { } } -impl std::str::FromStr for CreatePayoutSourceType { +impl std::str::FromStr for CreatePayoutBuilderSourceType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePayoutSourceType::*; + use CreatePayoutBuilderSourceType::*; match s { "bank_account" => Ok(BankAccount), "card" => Ok(Card), @@ -206,18 +299,18 @@ impl std::str::FromStr for CreatePayoutSourceType { } } } -impl std::fmt::Display for CreatePayoutSourceType { +impl std::fmt::Display for CreatePayoutBuilderSourceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePayoutSourceType { +impl std::fmt::Debug for CreatePayoutBuilderSourceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePayoutSourceType { +impl serde::Serialize for CreatePayoutBuilderSourceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -225,21 +318,82 @@ impl serde::Serialize for CreatePayoutSourceType { serializer.serialize_str(self.as_str()) } } +/// To send funds to your own bank account, create a new payout object. +/// Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. +/// If it doesn’t, you receive an “Insufficient Funds” error. +/// +/// If your API key is in test mode, money won’t actually be sent, though every other action occurs as if you’re in live mode. +/// +/// If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. +/// The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePayout<'a> { + inner: CreatePayoutBuilder<'a>, +} impl<'a> CreatePayout<'a> { - /// To send funds to your own bank account, create a new payout object. - /// Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. - /// If it doesn’t, you receive an “Insufficient Funds” error. - /// - /// If your API key is in test mode, money won’t actually be sent, though every other action occurs as if you’re in live mode. - /// - /// If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. - /// The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/payouts", self, http_types::Method::Post) + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { inner: CreatePayoutBuilder::new(amount, currency) } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn destination(mut self, destination: &'a str) -> Self { + self.inner.destination = Some(destination); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn method(mut self, method: CreatePayoutBuilderMethod) -> Self { + self.inner.method = Some(method); + self + } + + pub fn source_type(mut self, source_type: CreatePayoutBuilderSourceType) -> Self { + self.inner.source_type = Some(source_type); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } +} +impl CreatePayout<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePayout<'_> { + type Output = stripe_shared::Payout; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payouts").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePayout<'a> { +pub struct UpdatePayoutBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -250,48 +404,112 @@ pub struct UpdatePayout<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdatePayout<'a> { +impl<'a> UpdatePayoutBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified payout by setting the values of the parameters you pass. +/// We don’t change parameters that you don’t provide. +/// This request only accepts the metadata as arguments. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePayout<'a> { + inner: UpdatePayoutBuilder<'a>, + payout: &'a stripe_shared::PayoutId, +} impl<'a> UpdatePayout<'a> { - /// Updates the specified payout by setting the values of the parameters you pass. - /// We don’t change parameters that you don’t provide. - /// This request only accepts the metadata as arguments. - pub fn send( + pub fn new(payout: &'a stripe_shared::PayoutId) -> Self { + Self { payout, inner: UpdatePayoutBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdatePayout<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payout: &stripe_shared::PayoutId, - ) -> stripe::Response { - client.send_form(&format!("/payouts/{payout}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePayout<'_> { + type Output = stripe_shared::Payout; + + fn build(&self) -> RequestBuilder { + let payout = self.payout; + RequestBuilder::new(StripeMethod::Post, format!("/payouts/{payout}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelPayout<'a> { +pub struct CancelPayoutBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CancelPayout<'a> { +impl<'a> CancelPayoutBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// You can cancel a previously created payout if it hasn’t been paid out yet. +/// Stripe refunds the funds to your available balance. +/// You can’t cancel automatic Stripe payouts. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelPayout<'a> { + inner: CancelPayoutBuilder<'a>, + payout: &'a stripe_shared::PayoutId, +} impl<'a> CancelPayout<'a> { - /// You can cancel a previously created payout if its status is `pending`. - /// Stripe refunds the funds to your available balance. - /// You can’t cancel automatic Stripe payouts. - pub fn send( + pub fn new(payout: &'a stripe_shared::PayoutId) -> Self { + Self { payout, inner: CancelPayoutBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelPayout<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payout: &stripe_shared::PayoutId, - ) -> stripe::Response { - client.send_form(&format!("/payouts/{payout}/cancel"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelPayout<'_> { + type Output = stripe_shared::Payout; + + fn build(&self) -> RequestBuilder { + let payout = self.payout; + RequestBuilder::new(StripeMethod::Post, format!("/payouts/{payout}/cancel")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReversePayout<'a> { +pub struct ReversePayoutBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -302,22 +520,57 @@ pub struct ReversePayout<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> ReversePayout<'a> { +impl<'a> ReversePayoutBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Reverses a payout by debiting the destination bank account. +/// At this time, you can only reverse payouts for connected accounts to US bank accounts. +/// If the payout is in the `pending` status, use `/v1/payouts/:id/cancel` instead. +/// +/// By requesting a reversal through `/v1/payouts/:id/reverse`, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReversePayout<'a> { + inner: ReversePayoutBuilder<'a>, + payout: &'a stripe_shared::PayoutId, +} impl<'a> ReversePayout<'a> { - /// Reverses a payout by debiting the destination bank account. - /// At this time, you can only reverse payouts for connected accounts to US bank accounts. - /// If the payout is manual and in the `pending` status, use `/v1/payouts/:id/cancel` instead. - /// - /// By requesting a reversal through `/v1/payouts/:id/reverse`, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required. - pub fn send( + pub fn new(payout: &'a stripe_shared::PayoutId) -> Self { + Self { payout, inner: ReversePayoutBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl ReversePayout<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payout: &stripe_shared::PayoutId, - ) -> stripe::Response { - client.send_form(&format!("/payouts/{payout}/reverse"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ReversePayout<'_> { + type Output = stripe_shared::Payout; + + fn build(&self) -> RequestBuilder { + let payout = self.payout; + RequestBuilder::new(StripeMethod::Post, format!("/payouts/{payout}/reverse")) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/refund/requests.rs b/generated/stripe_core/src/refund/requests.rs index da81c81d0..f59f7ec03 100644 --- a/generated/stripe_core/src/refund/requests.rs +++ b/generated/stripe_core/src/refund/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListRefund<'a> { +pub struct ListRefundBuilder<'a> { /// Only return refunds for the charge specified by this charge ID. #[serde(skip_serializing_if = "Option::is_none")] pub charge: Option<&'a str>, @@ -26,47 +30,81 @@ pub struct ListRefund<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListRefund<'a> { +impl<'a> ListRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of all refunds you created. +/// We return the refunds in sorted order, with the most recent refunds appearing first The 10 most recent refunds are always available by default on the Charge object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListRefund<'a> { + inner: ListRefundBuilder<'a>, +} impl<'a> ListRefund<'a> { - /// Returns a list of all refunds you created. - /// We return the refunds in sorted order, with the most recent refunds appearing first The 10 most recent refunds are always available by default on the Charge object. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/refunds", self) + pub fn new() -> Self { + Self { inner: ListRefundBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/refunds", self) + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveRefund<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveRefund<'a> { - pub fn new() -> Self { - Self::default() + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveRefund<'a> { - /// Retrieves the details of an existing refund. - pub fn send( +impl ListRefund<'_> { + pub async fn send( &self, - client: &stripe::Client, - refund: &stripe_shared::RefundId, - ) -> stripe::Response { - client.get_query(&format!("/refunds/{refund}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListRefund<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/refunds").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateRefund<'a> { +pub struct CreateRefundBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, /// The identifier of the charge to refund. @@ -93,7 +131,7 @@ pub struct CreateRefund<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Origin of the refund #[serde(skip_serializing_if = "Option::is_none")] - pub origin: Option, + pub origin: Option, /// The identifier of the PaymentIntent to refund. #[serde(skip_serializing_if = "Option::is_none")] pub payment_intent: Option<&'a str>, @@ -101,7 +139,7 @@ pub struct CreateRefund<'a> { /// If set, possible values are `duplicate`, `fraudulent`, and `requested_by_customer`. /// If you believe the charge to be fraudulent, specifying `fraudulent` as the reason will add the associated card and email to your [block lists](https://stripe.com/docs/radar/lists), and will also help us improve our fraud detection algorithms. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// Boolean indicating whether the application fee should be refunded when refunding this charge. /// If a full charge refund is given, the full application fee will be refunded. /// Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. @@ -115,47 +153,47 @@ pub struct CreateRefund<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub reverse_transfer: Option, } -impl<'a> CreateRefund<'a> { +impl<'a> CreateRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Origin of the refund #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateRefundOrigin { +pub enum CreateRefundBuilderOrigin { CustomerBalance, } -impl CreateRefundOrigin { +impl CreateRefundBuilderOrigin { pub fn as_str(self) -> &'static str { - use CreateRefundOrigin::*; + use CreateRefundBuilderOrigin::*; match self { CustomerBalance => "customer_balance", } } } -impl std::str::FromStr for CreateRefundOrigin { +impl std::str::FromStr for CreateRefundBuilderOrigin { type Err = (); fn from_str(s: &str) -> Result { - use CreateRefundOrigin::*; + use CreateRefundBuilderOrigin::*; match s { "customer_balance" => Ok(CustomerBalance), _ => Err(()), } } } -impl std::fmt::Display for CreateRefundOrigin { +impl std::fmt::Display for CreateRefundBuilderOrigin { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateRefundOrigin { +impl std::fmt::Debug for CreateRefundBuilderOrigin { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateRefundOrigin { +impl serde::Serialize for CreateRefundBuilderOrigin { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -167,14 +205,14 @@ impl serde::Serialize for CreateRefundOrigin { /// If set, possible values are `duplicate`, `fraudulent`, and `requested_by_customer`. /// If you believe the charge to be fraudulent, specifying `fraudulent` as the reason will add the associated card and email to your [block lists](https://stripe.com/docs/radar/lists), and will also help us improve our fraud detection algorithms. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateRefundReason { +pub enum CreateRefundBuilderReason { Duplicate, Fraudulent, RequestedByCustomer, } -impl CreateRefundReason { +impl CreateRefundBuilderReason { pub fn as_str(self) -> &'static str { - use CreateRefundReason::*; + use CreateRefundBuilderReason::*; match self { Duplicate => "duplicate", Fraudulent => "fraudulent", @@ -183,10 +221,10 @@ impl CreateRefundReason { } } -impl std::str::FromStr for CreateRefundReason { +impl std::str::FromStr for CreateRefundBuilderReason { type Err = (); fn from_str(s: &str) -> Result { - use CreateRefundReason::*; + use CreateRefundBuilderReason::*; match s { "duplicate" => Ok(Duplicate), "fraudulent" => Ok(Fraudulent), @@ -195,18 +233,18 @@ impl std::str::FromStr for CreateRefundReason { } } } -impl std::fmt::Display for CreateRefundReason { +impl std::fmt::Display for CreateRefundBuilderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateRefundReason { +impl std::fmt::Debug for CreateRefundBuilderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateRefundReason { +impl serde::Serialize for CreateRefundBuilderReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -214,24 +252,160 @@ impl serde::Serialize for CreateRefundReason { serializer.serialize_str(self.as_str()) } } +/// When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it. +/// +/// Creating a new refund will refund a charge that has previously been created but not yet refunded. +/// Funds will be refunded to the credit or debit card that was originally charged. +/// +/// You can optionally refund only part of a charge. +/// You can do so multiple times, until the entire charge has been refunded. +/// +/// Once entirely refunded, a charge can’t be refunded again. +/// This method will raise an error when called on an already-refunded charge, +/// or when trying to refund more money than is left on a charge. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateRefund<'a> { + inner: CreateRefundBuilder<'a>, +} impl<'a> CreateRefund<'a> { - /// When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it. - /// - /// Creating a new refund will refund a charge that has previously been created but not yet refunded. - /// Funds will be refunded to the credit or debit card that was originally charged. - /// - /// You can optionally refund only part of a charge. - /// You can do so multiple times, until the entire charge has been refunded. - /// - /// Once entirely refunded, a charge can’t be refunded again. - /// This method will raise an error when called on an already-refunded charge, - /// or when trying to refund more money than is left on a charge. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/refunds", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateRefundBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn instructions_email(mut self, instructions_email: &'a str) -> Self { + self.inner.instructions_email = Some(instructions_email); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn origin(mut self, origin: CreateRefundBuilderOrigin) -> Self { + self.inner.origin = Some(origin); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn reason(mut self, reason: CreateRefundBuilderReason) -> Self { + self.inner.reason = Some(reason); + self + } + + pub fn refund_application_fee(mut self, refund_application_fee: bool) -> Self { + self.inner.refund_application_fee = Some(refund_application_fee); + self + } + + pub fn reverse_transfer(mut self, reverse_transfer: bool) -> Self { + self.inner.reverse_transfer = Some(reverse_transfer); + self + } +} +impl CreateRefund<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateRefund<'_> { + type Output = stripe_shared::Refund; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/refunds").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateRefund<'a> { +pub struct RetrieveRefundBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveRefundBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing refund. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveRefund<'a> { + inner: RetrieveRefundBuilder<'a>, + refund: &'a stripe_shared::RefundId, +} +impl<'a> RetrieveRefund<'a> { + pub fn new(refund: &'a stripe_shared::RefundId) -> Self { + Self { refund, inner: RetrieveRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveRefund<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveRefund<'_> { + type Output = stripe_shared::Refund; + + fn build(&self) -> RequestBuilder { + let refund = self.refund; + RequestBuilder::new(StripeMethod::Get, format!("/refunds/{refund}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateRefundBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -242,70 +416,160 @@ pub struct UpdateRefund<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateRefund<'a> { +impl<'a> UpdateRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the refund that you specify by setting the values of the passed parameters. +/// Any parameters that you don’t provide remain unchanged. +/// +/// This request only accepts `metadata` as an argument. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateRefund<'a> { + inner: UpdateRefundBuilder<'a>, + refund: &'a stripe_shared::RefundId, +} impl<'a> UpdateRefund<'a> { - /// Updates the refund that you specify by setting the values of the passed parameters. - /// Any parameters that you don’t provide remain unchanged. - /// - /// This request only accepts `metadata` as an argument. - pub fn send( + pub fn new(refund: &'a stripe_shared::RefundId) -> Self { + Self { refund, inner: UpdateRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateRefund<'_> { + pub async fn send( &self, - client: &stripe::Client, - refund: &stripe_shared::RefundId, - ) -> stripe::Response { - client.send_form(&format!("/refunds/{refund}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateRefund<'_> { + type Output = stripe_shared::Refund; + + fn build(&self) -> RequestBuilder { + let refund = self.refund; + RequestBuilder::new(StripeMethod::Post, format!("/refunds/{refund}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelRefund<'a> { +pub struct CancelRefundBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CancelRefund<'a> { +impl<'a> CancelRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Cancels a refund with a status of `requires_action`. +/// +/// You can’t cancel refunds in other states. +/// Only refunds for payment methods that require customer action can enter the `requires_action` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelRefund<'a> { + inner: CancelRefundBuilder<'a>, + refund: &'a stripe_shared::RefundId, +} impl<'a> CancelRefund<'a> { - /// Cancels a refund with a status of `requires_action`. - /// - /// You can’t cancel refunds in other states. - /// Only refunds for payment methods that require customer action can enter the `requires_action` state. - pub fn send( + pub fn new(refund: &'a stripe_shared::RefundId) -> Self { + Self { refund, inner: CancelRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelRefund<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - refund: &stripe_shared::RefundId, - ) -> stripe::Response { - client.send_form(&format!("/refunds/{refund}/cancel"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelRefund<'_> { + type Output = stripe_shared::Refund; + + fn build(&self) -> RequestBuilder { + let refund = self.refund; + RequestBuilder::new(StripeMethod::Post, format!("/refunds/{refund}/cancel")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ExpireRefund<'a> { +pub struct ExpireRefundBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ExpireRefund<'a> { +impl<'a> ExpireRefundBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Expire a refund with a status of `requires_action`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ExpireRefund<'a> { + inner: ExpireRefundBuilder<'a>, + refund: &'a str, +} impl<'a> ExpireRefund<'a> { - /// Expire a refund with a status of `requires_action`. - pub fn send( + pub fn new(refund: &'a str) -> Self { + Self { refund, inner: ExpireRefundBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ExpireRefund<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - refund: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/refunds/{refund}/expire"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ExpireRefund<'_> { + type Output = stripe_shared::Refund; + + fn build(&self) -> RequestBuilder { + let refund = self.refund; + RequestBuilder::new(StripeMethod::Post, format!("/test_helpers/refunds/{refund}/expire")) + .form(&self.inner) } } diff --git a/generated/stripe_core/src/setup_attempt/requests.rs b/generated/stripe_core/src/setup_attempt/requests.rs index e570c255a..d897abec0 100644 --- a/generated/stripe_core/src/setup_attempt/requests.rs +++ b/generated/stripe_core/src/setup_attempt/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListSetupAttempt<'a> { +pub struct ListSetupAttemptBuilder<'a> { /// A filter on the list, based on the object `created` field. The value /// can be a string with an integer Unix timestamp or a /// dictionary with a number of different query options. @@ -26,7 +30,7 @@ pub struct ListSetupAttempt<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListSetupAttempt<'a> { +impl<'a> ListSetupAttemptBuilder<'a> { pub fn new(setup_intent: &'a str) -> Self { Self { created: None, @@ -38,17 +42,60 @@ impl<'a> ListSetupAttempt<'a> { } } } +/// Returns a list of SetupAttempts that associate with a provided SetupIntent. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSetupAttempt<'a> { + inner: ListSetupAttemptBuilder<'a>, +} impl<'a> ListSetupAttempt<'a> { - /// Returns a list of SetupAttempts that associate with a provided SetupIntent. - pub fn send( + pub fn new(setup_intent: &'a str) -> Self { + Self { inner: ListSetupAttemptBuilder::new(setup_intent) } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListSetupAttempt<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/setup_attempts", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/setup_attempts", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListSetupAttempt<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/setup_attempts").query(&self.inner) } } diff --git a/generated/stripe_core/src/setup_intent/requests.rs b/generated/stripe_core/src/setup_intent/requests.rs index c1a6a0d16..d2e2aa256 100644 --- a/generated/stripe_core/src/setup_intent/requests.rs +++ b/generated/stripe_core/src/setup_intent/requests.rs @@ -1,89 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListSetupIntent<'a> { - /// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account. - /// - /// It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. - /// It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub attach_to_self: Option, - /// A filter on the list, based on the object `created` field. - /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// Only return SetupIntents for the customer specified by this customer ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Only return SetupIntents that associate with the specified payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method: Option<&'a str>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListSetupIntent<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListSetupIntent<'a> { - /// Returns a list of SetupIntents. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/setup_intents", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/setup_intents", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveSetupIntent<'a> { - /// The client secret of the SetupIntent. - /// We require this string if you use a publishable key to retrieve the SetupIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_secret: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveSetupIntent<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveSetupIntent<'a> { - /// Retrieves the details of a SetupIntent that has previously been created. - /// - /// Client-side retrieval using a publishable key is allowed when the `client_secret` is provided in the query string. - /// - /// - /// When retrieved with a publishable key, only a subset of properties will be returned. - /// Please refer to the [SetupIntent](https://stripe.com/docs/api#setup_intent_object) object reference for more details. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::SetupIntentId, - ) -> stripe::Response { - client.get_query(&format!("/setup_intents/{intent}"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntent<'a> { +pub struct CreateSetupIntentBuilder<'a> { /// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account. /// /// It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. @@ -92,7 +12,7 @@ pub struct CreateSetupIntent<'a> { pub attach_to_self: Option, /// When you enable this parameter, this SetupIntent accepts payment methods that you enable in the Dashboard and that are compatible with its other parameters. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_payment_methods: Option, + pub automatic_payment_methods: Option, /// Set to `true` to attempt to confirm this SetupIntent immediately. /// This parameter defaults to `false`. /// If a card is the attached payment method, you can provide a `return_url` in case further authentication is necessary. @@ -120,7 +40,7 @@ pub struct CreateSetupIntent<'a> { /// This hash contains details about the mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_data: Option>, + pub mandate_data: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -139,10 +59,10 @@ pub struct CreateSetupIntent<'a> { /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment method-specific configuration for this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The list of payment method types (for example, card) that this SetupIntent can use. /// If you don't provide this, it defaults to ["card"]. #[serde(skip_serializing_if = "Option::is_none")] @@ -154,33 +74,33 @@ pub struct CreateSetupIntent<'a> { pub return_url: Option<&'a str>, /// If you populate this hash, this SetupIntent generates a `single_use` mandate after successful completion. #[serde(skip_serializing_if = "Option::is_none")] - pub single_use: Option, + pub single_use: Option, /// Indicates how the payment method is intended to be used in the future. /// If not provided, this value defaults to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub usage: Option, + pub usage: Option, /// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. #[serde(skip_serializing_if = "Option::is_none")] pub use_stripe_sdk: Option, } -impl<'a> CreateSetupIntent<'a> { +impl<'a> CreateSetupIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } /// When you enable this parameter, this SetupIntent accepts payment methods that you enable in the Dashboard and that are compatible with its other parameters. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentAutomaticPaymentMethods { +pub struct CreateSetupIntentBuilderAutomaticPaymentMethods { /// Controls whether this SetupIntent will accept redirect-based payment methods. /// /// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. /// To [confirm](https://stripe.com/docs/api/setup_intents/confirm) this SetupIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the setup. #[serde(skip_serializing_if = "Option::is_none")] - pub allow_redirects: Option, + pub allow_redirects: Option, /// Whether this feature is enabled. pub enabled: bool, } -impl CreateSetupIntentAutomaticPaymentMethods { +impl CreateSetupIntentBuilderAutomaticPaymentMethods { pub fn new(enabled: bool) -> Self { Self { allow_redirects: None, enabled } } @@ -190,13 +110,13 @@ impl CreateSetupIntentAutomaticPaymentMethods { /// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. /// To [confirm](https://stripe.com/docs/api/setup_intents/confirm) this SetupIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the setup. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +pub enum CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { Always, Never, } -impl CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +impl CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { pub fn as_str(self) -> &'static str { - use CreateSetupIntentAutomaticPaymentMethodsAllowRedirects::*; + use CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects::*; match self { Always => "always", Never => "never", @@ -204,10 +124,10 @@ impl CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { } } -impl std::str::FromStr for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +impl std::str::FromStr for CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentAutomaticPaymentMethodsAllowRedirects::*; + use CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects::*; match s { "always" => Ok(Always), "never" => Ok(Never), @@ -215,18 +135,18 @@ impl std::str::FromStr for CreateSetupIntentAutomaticPaymentMethodsAllowRedirect } } } -impl std::fmt::Display for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +impl std::fmt::Display for CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +impl std::fmt::Debug for CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects { +impl serde::Serialize for CreateSetupIntentBuilderAutomaticPaymentMethodsAllowRedirects { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -237,18 +157,20 @@ impl serde::Serialize for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects /// This hash contains details about the mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentMandateData<'a> { +pub struct CreateSetupIntentBuilderMandateData<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: CreateSetupIntentMandateDataCustomerAcceptance<'a>, + pub customer_acceptance: CreateSetupIntentBuilderMandateDataCustomerAcceptance<'a>, } -impl<'a> CreateSetupIntentMandateData<'a> { - pub fn new(customer_acceptance: CreateSetupIntentMandateDataCustomerAcceptance<'a>) -> Self { +impl<'a> CreateSetupIntentBuilderMandateData<'a> { + pub fn new( + customer_acceptance: CreateSetupIntentBuilderMandateDataCustomerAcceptance<'a>, + ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentMandateDataCustomerAcceptance<'a> { +pub struct CreateSetupIntentBuilderMandateDataCustomerAcceptance<'a> { /// The time at which the customer accepted the Mandate. #[serde(skip_serializing_if = "Option::is_none")] pub accepted_at: Option, @@ -261,23 +183,23 @@ pub struct CreateSetupIntentMandateDataCustomerAcceptance<'a> { /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] - pub type_: CreateSetupIntentMandateDataCustomerAcceptanceType, + pub type_: CreateSetupIntentBuilderMandateDataCustomerAcceptanceType, } -impl<'a> CreateSetupIntentMandateDataCustomerAcceptance<'a> { - pub fn new(type_: CreateSetupIntentMandateDataCustomerAcceptanceType) -> Self { +impl<'a> CreateSetupIntentBuilderMandateDataCustomerAcceptance<'a> { + pub fn new(type_: CreateSetupIntentBuilderMandateDataCustomerAcceptanceType) -> Self { Self { accepted_at: None, offline: None, online: None, type_ } } } /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentMandateDataCustomerAcceptanceType { +pub enum CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { Offline, Online, } -impl CreateSetupIntentMandateDataCustomerAcceptanceType { +impl CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentMandateDataCustomerAcceptanceType::*; + use CreateSetupIntentBuilderMandateDataCustomerAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -285,10 +207,10 @@ impl CreateSetupIntentMandateDataCustomerAcceptanceType { } } -impl std::str::FromStr for CreateSetupIntentMandateDataCustomerAcceptanceType { +impl std::str::FromStr for CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentMandateDataCustomerAcceptanceType::*; + use CreateSetupIntentBuilderMandateDataCustomerAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -296,18 +218,18 @@ impl std::str::FromStr for CreateSetupIntentMandateDataCustomerAcceptanceType { } } } -impl std::fmt::Display for CreateSetupIntentMandateDataCustomerAcceptanceType { +impl std::fmt::Display for CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentMandateDataCustomerAcceptanceType { +impl std::fmt::Debug for CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentMandateDataCustomerAcceptanceType { +impl serde::Serialize for CreateSetupIntentBuilderMandateDataCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -318,7 +240,7 @@ impl serde::Serialize for CreateSetupIntentMandateDataCustomerAcceptanceType { /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodData<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -333,10 +255,10 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, @@ -348,7 +270,7 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -357,10 +279,10 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -369,13 +291,13 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -393,7 +315,7 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -415,21 +337,18 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: CreateSetupIntentPaymentMethodDataType, + pub type_: CreateSetupIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -437,8 +356,8 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> CreateSetupIntentPaymentMethodData<'a> { - pub fn new(type_: CreateSetupIntentPaymentMethodDataType) -> Self { +impl<'a> CreateSetupIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: CreateSetupIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -472,7 +391,6 @@ impl<'a> CreateSetupIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -482,20 +400,20 @@ impl<'a> CreateSetupIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> CreateSetupIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataBacsDebit<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -503,30 +421,30 @@ pub struct CreateSetupIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> CreateSetupIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataBoleto<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> CreateSetupIntentPaymentMethodDataBoleto<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataEps { +pub struct CreateSetupIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreateSetupIntentPaymentMethodDataEps { +impl CreateSetupIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -534,7 +452,7 @@ impl CreateSetupIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSetupIntentPaymentMethodDataEpsBank { +pub enum CreateSetupIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -566,9 +484,9 @@ pub enum CreateSetupIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSetupIntentPaymentMethodDataEpsBank { +impl CreateSetupIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataEpsBank::*; + use CreateSetupIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -603,10 +521,10 @@ impl CreateSetupIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataEpsBank::*; + use CreateSetupIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -640,18 +558,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataEpsBank { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -661,27 +579,27 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataFpx { +pub struct CreateSetupIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// The customer's bank. - pub bank: CreateSetupIntentPaymentMethodDataFpxBank, + pub bank: CreateSetupIntentBuilderPaymentMethodDataFpxBank, } -impl CreateSetupIntentPaymentMethodDataFpx { - pub fn new(bank: CreateSetupIntentPaymentMethodDataFpxBank) -> Self { +impl CreateSetupIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: CreateSetupIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +pub enum CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -689,10 +607,10 @@ impl CreateSetupIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -700,18 +618,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataFpxAccountHolderTyp } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -722,7 +640,7 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataFpxAccountHolderType /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSetupIntentPaymentMethodDataFpxBank { +pub enum CreateSetupIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -748,9 +666,9 @@ pub enum CreateSetupIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSetupIntentPaymentMethodDataFpxBank { +impl CreateSetupIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataFpxBank::*; + use CreateSetupIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -779,10 +697,10 @@ impl CreateSetupIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataFpxBank::*; + use CreateSetupIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -810,18 +728,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataFpxBank { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -831,12 +749,12 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataIdeal { +pub struct CreateSetupIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreateSetupIntentPaymentMethodDataIdeal { +impl CreateSetupIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -844,7 +762,7 @@ impl CreateSetupIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSetupIntentPaymentMethodDataIdealBank { +pub enum CreateSetupIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -853,7 +771,6 @@ pub enum CreateSetupIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -864,9 +781,9 @@ pub enum CreateSetupIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSetupIntentPaymentMethodDataIdealBank { +impl CreateSetupIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataIdealBank::*; + use CreateSetupIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -876,7 +793,6 @@ impl CreateSetupIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -889,10 +805,10 @@ impl CreateSetupIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataIdealBank::*; + use CreateSetupIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -902,7 +818,6 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -914,18 +829,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataIdealBank { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -935,24 +850,24 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataKlarna { +pub struct CreateSetupIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl CreateSetupIntentPaymentMethodDataKlarna { +impl CreateSetupIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataP24 { +pub struct CreateSetupIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreateSetupIntentPaymentMethodDataP24 { +impl CreateSetupIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -960,7 +875,7 @@ impl CreateSetupIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSetupIntentPaymentMethodDataP24Bank { +pub enum CreateSetupIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -985,14 +900,13 @@ pub enum CreateSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSetupIntentPaymentMethodDataP24Bank { +impl CreateSetupIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataP24Bank::*; + use CreateSetupIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -1018,17 +932,16 @@ impl CreateSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataP24Bank::*; + use CreateSetupIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -1054,24 +967,23 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataP24Bank { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1081,29 +993,29 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataP24Bank { } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataSepaDebit<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> CreateSetupIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataSofort { +pub struct CreateSetupIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: CreateSetupIntentPaymentMethodDataSofortCountry, + pub country: CreateSetupIntentBuilderPaymentMethodDataSofortCountry, } -impl CreateSetupIntentPaymentMethodDataSofort { - pub fn new(country: CreateSetupIntentPaymentMethodDataSofortCountry) -> Self { +impl CreateSetupIntentBuilderPaymentMethodDataSofort { + pub fn new(country: CreateSetupIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodDataSofortCountry { +pub enum CreateSetupIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -1111,9 +1023,9 @@ pub enum CreateSetupIntentPaymentMethodDataSofortCountry { It, Nl, } -impl CreateSetupIntentPaymentMethodDataSofortCountry { +impl CreateSetupIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataSofortCountry::*; + use CreateSetupIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -1125,10 +1037,10 @@ impl CreateSetupIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataSofortCountry::*; + use CreateSetupIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -1140,18 +1052,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1164,7 +1076,7 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateSetupIntentPaymentMethodDataType { +pub enum CreateSetupIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -1193,16 +1105,15 @@ pub enum CreateSetupIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateSetupIntentPaymentMethodDataType { +impl CreateSetupIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataType::*; + use CreateSetupIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -1232,7 +1143,6 @@ impl CreateSetupIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -1241,10 +1151,10 @@ impl CreateSetupIntentPaymentMethodDataType { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataType { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataType::*; + use CreateSetupIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -1274,7 +1184,6 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -1282,18 +1191,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataType { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataType { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataType { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataType { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1303,17 +1212,17 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataUsBankAccount<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -1321,20 +1230,20 @@ pub struct CreateSetupIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreateSetupIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -1342,10 +1251,10 @@ impl CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -1353,18 +1262,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataUsBankAccountAccoun } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1374,13 +1283,13 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataUsBankAccountAccount } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +pub enum CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -1388,10 +1297,10 @@ impl CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -1399,18 +1308,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodDataUsBankAccountAccoun } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1420,13 +1329,13 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataUsBankAccountAccount } /// Payment method-specific configuration for this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptions<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// Configuration for any card setup attempted on this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub link: Option>, @@ -1435,32 +1344,33 @@ pub struct CreateSetupIntentPaymentMethodOptions<'a> { pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, } -impl<'a> CreateSetupIntentPaymentMethodOptions<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, + pub currency: Option, /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, - /// Bank account verification method. + pub mandate_options: + Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> CreateSetupIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } @@ -1468,13 +1378,13 @@ impl<'a> CreateSetupIntentPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { Cad, Usd, } -impl CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match self { Cad => "cad", Usd => "usd", @@ -1482,10 +1392,10 @@ impl CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match s { "cad" => Ok(Cad), "usd" => Ok(Usd), @@ -1493,18 +1403,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrenc } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1514,7 +1424,7 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitCurrency } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -1523,7 +1433,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// List of Stripe products where this mandate can be selected automatically. #[serde(skip_serializing_if = "Option::is_none")] pub default_for: - Option<&'a [CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, + Option<&'a [CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, /// Description of the mandate interval. /// Only required if 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] @@ -1531,26 +1441,26 @@ pub struct CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub payment_schedule: - Option, + Option, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub transaction_type: - Option, + Option, } -impl<'a> CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// List of Stripe products where this mandate can be selected automatically. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { Invoice, Subscription, } -impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match self { Invoice => "invoice", Subscription => "subscription", @@ -1558,10 +1468,12 @@ impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::str::FromStr + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match s { "invoice" => Ok(Invoice), "subscription" => Ok(Subscription), @@ -1569,18 +1481,24 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitMandate } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Display + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Debug + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl serde::Serialize + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1590,14 +1508,14 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateO } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -1607,11 +1525,11 @@ impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule } impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -1621,7 +1539,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1629,14 +1547,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -1647,13 +1565,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -1662,11 +1580,11 @@ impl CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType } impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -1675,7 +1593,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1683,14 +1601,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -1699,16 +1617,16 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -1717,10 +1635,10 @@ impl CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -1729,18 +1647,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsAcssDebitVerific } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1750,10 +1668,10 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsAcssDebitVerifica } /// Configuration for any card setup attempted on this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsCard<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodOptionsCard<'a> { /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: Option>, /// When specified, this parameter signals that a card has been collected /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -1763,33 +1681,30 @@ pub struct CreateSetupIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the SetupIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this setup. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, + Option, } -impl<'a> CreateSetupIntentPaymentMethodOptionsCard<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// Currency in which future payments will be charged. /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). @@ -1803,7 +1718,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -1817,14 +1732,14 @@ pub struct CreateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { /// Specifies the type of mandates supported. Possible values are `india`. #[serde(skip_serializing_if = "Option::is_none")] pub supported_types: - Option<&'a [CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, + Option<&'a [CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, } -impl<'a> CreateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { pub fn new( amount: i64, - amount_type: CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, + amount_type: CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, currency: stripe_types::Currency, - interval: CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, + interval: CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, reference: &'a str, start_date: stripe_types::Timestamp, ) -> Self { @@ -1846,13 +1761,13 @@ impl<'a> CreateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -1860,10 +1775,12 @@ impl CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::str::FromStr + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -1871,18 +1788,20 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardMandateOptio } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Display + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1892,16 +1811,16 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOption } /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { Day, Month, Sporadic, Week, Year, } -impl CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { Day => "day", Month => "month", @@ -1912,10 +1831,10 @@ impl CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -1926,18 +1845,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardMandateOptio } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1947,40 +1866,48 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOption } /// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { India, } -impl CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { India => "india", } } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::str::FromStr + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { "india" => Ok(India), _ => Err(()), } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Display + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl std::fmt::Debug + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { +impl serde::Serialize + for CreateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1992,7 +1919,7 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardMandateOption /// Depends on the available networks of the card attached to the SetupIntent. /// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardNetwork { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { Amex, CartesBancaires, Diners, @@ -2005,9 +1932,9 @@ pub enum CreateSetupIntentPaymentMethodOptionsCardNetwork { Unknown, Visa, } -impl CreateSetupIntentPaymentMethodOptionsCardNetwork { +impl CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardNetwork::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { Amex => "amex", CartesBancaires => "cartes_bancaires", @@ -2024,10 +1951,10 @@ impl CreateSetupIntentPaymentMethodOptionsCardNetwork { } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardNetwork { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardNetwork::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { "amex" => Ok(Amex), "cartes_bancaires" => Ok(CartesBancaires), @@ -2044,18 +1971,18 @@ impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardNetwork { } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardNetwork { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardNetwork { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2065,49 +1992,47 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardNetwork { } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } -impl CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr for CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display for CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize for CreateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2115,102 +2040,115 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardRequestThreeD serializer.serialize_str(self.as_str()) } } -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this setup. +/// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - #[serde(skip_serializing_if = "Option::is_none")] - pub cryptogram: Option<&'a str>, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly +pub struct CreateSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { + /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. + pub mandate_options: Option<&'a serde_json::Value>, +} +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { + /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). + pub financial_connections: + Option>, + /// Additional fields for network related functions #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_id: Option<&'a str>, - /// The version of 3D Secure that was performed. + pub networks: Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, + pub verification_method: + Option, } -impl<'a> CreateSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. +/// Additional fields for Financial Connections Session creation +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. + /// If this parameter is passed, the `payment_method` permission must be included. + /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, + /// List of data features that you would like to retrieve upon account creation. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + /// For webview integrations only. + /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. +#[serde(skip_serializing_if = "Option::is_none")] +pub return_url: Option<&'a str>, + +} +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// The list of permissions to request. +/// If this parameter is passed, the `payment_method` permission must be included. +/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { + Balances, + Ownership, + PaymentMethod, + Transactions, +} +impl CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", + Balances => "balances", + Ownership => "ownership", + PaymentMethod => "payment_method", + Transactions => "transactions", } } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::str::FromStr + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), + "balances" => Ok(Balances), + "ownership" => Ok(Ownership), + "payment_method" => Ok(PaymentMethod), + "transactions" => Ok(Transactions), _ => Err(()), } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Display + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Debug + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl serde::Serialize + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2218,47 +2156,34 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureA serializer.serialize_str(self.as_str()) } } -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. +/// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { + Balances, +} +impl CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", + Balances => "balances", } } } impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), + "balances" => Ok(Balances), _ => Err(()), } } } impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2266,14 +2191,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -2282,94 +2207,50 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly +/// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. +pub struct CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { + /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, + pub requested: + Option<&'a [CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { +impl<'a> CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO - pub cb_avalgo: - CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_score: Option, -} -impl<'a> CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO +/// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { +pub enum CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { + Ach, + UsDomesticWire, +} +impl CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", + Ach => "ach", + UsDomesticWire => "us_domestic_wire", } } } impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { - "0" => Ok(V0), - "1" => Ok(V1), - "2" => Ok(V2), - "3" => Ok(V3), - "4" => Ok(V4), - "A" => Ok(A), + "ach" => Ok(Ach), + "us_domestic_wire" => Ok(UsDomesticWire), _ => Err(()), } } } impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2377,14 +2258,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { fn serialize(&self, serializer: S) -> Result where @@ -2393,48 +2274,56 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// The version of 3D Secure that was performed. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, +pub enum CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { + Automatic, + Instant, + Microdeposits, } -impl CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", + Automatic => "automatic", + Instant => "instant", + Microdeposits => "microdeposits", } } } -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::str::FromStr + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), + "automatic" => Ok(Automatic), + "instant" => Ok(Instant), + "microdeposits" => Ok(Microdeposits), _ => Err(()), } } } -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Display + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Debug + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize + for CreateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2442,121 +2331,63 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardThreeDSecureV serializer.serialize_str(self.as_str()) } } -/// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsSepaDebit<'a> { - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option<&'a serde_json::Value>, +/// If you populate this hash, this SetupIntent generates a `single_use` mandate after successful completion. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreateSetupIntentBuilderSingleUse { + /// Amount the customer is granting permission to collect later. + /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). + /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). + /// The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, } -impl<'a> CreateSetupIntentPaymentMethodOptionsSepaDebit<'a> { - pub fn new() -> Self { - Self::default() +impl CreateSetupIntentBuilderSingleUse { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { amount, currency } } } -/// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccount<'a> { - /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, - /// Additional fields for network related functions - #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, - /// Bank account verification method. - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, +/// Indicates how the payment method is intended to be used in the future. +/// If not provided, this value defaults to `off_session`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateSetupIntentBuilderUsage { + OffSession, + OnSession, } -impl<'a> CreateSetupIntentPaymentMethodOptionsUsBankAccount<'a> { - pub fn new() -> Self { - Self::default() +impl CreateSetupIntentBuilderUsage { + pub fn as_str(self) -> &'static str { + use CreateSetupIntentBuilderUsage::*; + match self { + OffSession => "off_session", + OnSession => "on_session", + } } } -/// Additional fields for Financial Connections Session creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. - /// If this parameter is passed, the `payment_method` permission must be included. - /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option< - &'a [CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions], - >, - /// List of data features that you would like to retrieve upon account creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option< - &'a [CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch], - >, - /// For webview integrations only. - /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, + +impl std::str::FromStr for CreateSetupIntentBuilderUsage { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateSetupIntentBuilderUsage::*; + match s { + "off_session" => Ok(OffSession), + "on_session" => Ok(OnSession), + _ => Err(()), + } + } } -impl<'a> CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The list of permissions to request. -/// If this parameter is passed, the `payment_method` permission must be included. -/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { - Balances, - Ownership, - PaymentMethod, - Transactions, -} -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; - match self { - Balances => "balances", - Ownership => "ownership", - PaymentMethod => "payment_method", - Transactions => "transactions", - } - } -} - -impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; - match s { - "balances" => Ok(Balances), - "ownership" => Ok(Ownership), - "payment_method" => Ok(PaymentMethod), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl std::fmt::Display for CreateSetupIntentBuilderUsage { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ +impl std::fmt::Debug for CreateSetupIntentBuilderUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions -{ +impl serde::Serialize for CreateSetupIntentBuilderUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2564,307 +2395,329 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// List of data features that you would like to retrieve upon account creation. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { - Balances, - Transactions, +/// Creates a SetupIntent object. +/// +/// After you create the SetupIntent, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm). +/// it to collect any required permissions to charge the payment method later. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSetupIntent<'a> { + inner: CreateSetupIntentBuilder<'a>, } -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; - match self { - Balances => "balances", - Transactions => "transactions", - } +impl<'a> CreateSetupIntent<'a> { + pub fn new() -> Self { + Self { inner: CreateSetupIntentBuilder::new() } + } + pub fn attach_to_self(mut self, attach_to_self: bool) -> Self { + self.inner.attach_to_self = Some(attach_to_self); + self } -} -impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; - match s { - "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } + pub fn automatic_payment_methods( + mut self, + automatic_payment_methods: CreateSetupIntentBuilderAutomaticPaymentMethods, + ) -> Self { + self.inner.automatic_payment_methods = Some(automatic_payment_methods); + self } -} -impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn confirm(mut self, confirm: bool) -> Self { + self.inner.confirm = Some(confirm); + self } -} -impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self } -} -impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } + + pub fn flow_directions( + mut self, + flow_directions: &'a [stripe_shared::SetupIntentFlowDirections], + ) -> Self { + self.inner.flow_directions = Some(flow_directions); + self } -} -impl std::str::FromStr - for CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), - _ => Err(()), - } + pub fn mandate_data(mut self, mandate_data: CreateSetupIntentBuilderMandateData<'a>) -> Self { + self.inner.mandate_data = Some(mandate_data); + self } -} -impl std::fmt::Display - for CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn payment_method_configuration(mut self, payment_method_configuration: &'a str) -> Self { + self.inner.payment_method_configuration = Some(payment_method_configuration); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: CreateSetupIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: CreateSetupIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn payment_method_types(mut self, payment_method_types: &'a [&'a str]) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } + + pub fn single_use(mut self, single_use: CreateSetupIntentBuilderSingleUse) -> Self { + self.inner.single_use = Some(single_use); + self + } + + pub fn usage(mut self, usage: CreateSetupIntentBuilderUsage) -> Self { + self.inner.usage = Some(usage); + self + } + + pub fn use_stripe_sdk(mut self, use_stripe_sdk: bool) -> Self { + self.inner.use_stripe_sdk = Some(use_stripe_sdk); + self } } +impl CreateSetupIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } -impl std::fmt::Debug - for CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize - for CreateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for CreateSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/setup_intents").form(&self.inner) } } -/// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { - /// Triggers validations to run across the selected networks +pub struct ListSetupIntentBuilder<'a> { + /// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account. + /// + /// It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. + /// It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: - Option<&'a [CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + pub attach_to_self: Option, + /// A filter on the list, based on the object `created` field. + /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// Only return SetupIntents for the customer specified by this customer ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Only return SetupIntents that associate with the specified payment method. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method: Option<&'a str>, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, } -impl<'a> CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> ListSetupIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// Triggers validations to run across the selected networks -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - Ach, - UsDomesticWire, -} -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; - match self { - Ach => "ach", - UsDomesticWire => "us_domestic_wire", - } - } +/// Returns a list of SetupIntents. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListSetupIntent<'a> { + inner: ListSetupIntentBuilder<'a>, } - -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; - match s { - "ach" => Ok(Ach), - "us_domestic_wire" => Ok(UsDomesticWire), - _ => Err(()), - } +impl<'a> ListSetupIntent<'a> { + pub fn new() -> Self { + Self { inner: ListSetupIntentBuilder::new() } } -} -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn attach_to_self(mut self, attach_to_self: bool) -> Self { + self.inner.attach_to_self = Some(attach_to_self); + self } -} -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self } -} -/// Bank account verification method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - Automatic, - Instant, - Microdeposits, -} -impl CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; - match self { - Automatic => "automatic", - Instant => "instant", - Microdeposits => "microdeposits", - } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -impl std::str::FromStr for CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; - match s { - "automatic" => Ok(Automatic), - "instant" => Ok(Instant), - "microdeposits" => Ok(Microdeposits), - _ => Err(()), - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl std::fmt::Display for CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self } -} -impl std::fmt::Debug for CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self } -} -impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -/// If you populate this hash, this SetupIntent generates a `single_use` mandate after successful completion. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentSingleUse { - /// Amount the customer is granting permission to collect later. - /// A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). - /// The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). - /// The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, -} -impl CreateSetupIntentSingleUse { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { amount, currency } +impl ListSetupIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -/// Indicates how the payment method is intended to be used in the future. -/// If not provided, this value defaults to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentUsage { - OffSession, - OnSession, -} -impl CreateSetupIntentUsage { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentUsage::*; - match self { - OffSession => "off_session", - OnSession => "on_session", - } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } - -impl std::str::FromStr for CreateSetupIntentUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentUsage::*; - match s { - "off_session" => Ok(OffSession), - "on_session" => Ok(OnSession), - _ => Err(()), - } + +impl StripeRequest for ListSetupIntent<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/setup_intents").query(&self.inner) } } -impl std::fmt::Display for CreateSetupIntentUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveSetupIntentBuilder<'a> { + /// The client secret of the SetupIntent. + /// We require this string if you use a publishable key to retrieve the SetupIntent. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_secret: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveSetupIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() } } +/// Retrieves the details of a SetupIntent that has previously been created. +/// +/// Client-side retrieval using a publishable key is allowed when the `client_secret` is provided in the query string. +/// +/// +/// When retrieved with a publishable key, only a subset of properties will be returned. +/// Please refer to the [SetupIntent](https://stripe.com/docs/api#setup_intent_object) object reference for more details. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveSetupIntent<'a> { + inner: RetrieveSetupIntentBuilder<'a>, + intent: &'a stripe_shared::SetupIntentId, +} +impl<'a> RetrieveSetupIntent<'a> { + pub fn new(intent: &'a stripe_shared::SetupIntentId) -> Self { + Self { intent, inner: RetrieveSetupIntentBuilder::new() } + } + pub fn client_secret(mut self, client_secret: &'a str) -> Self { + self.inner.client_secret = Some(client_secret); + self + } -impl std::fmt::Debug for CreateSetupIntentUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl serde::Serialize for CreateSetupIntentUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +impl RetrieveSetupIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateSetupIntent<'a> { - /// Creates a SetupIntent object. - /// - /// After you create the SetupIntent, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm). - /// it to collect any required permissions to charge the payment method later. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/setup_intents", self, http_types::Method::Post) + +impl StripeRequest for RetrieveSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Get, format!("/setup_intents/{intent}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntent<'a> { +pub struct UpdateSetupIntentBuilder<'a> { /// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account. /// /// It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. @@ -2905,16 +2758,16 @@ pub struct UpdateSetupIntent<'a> { /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment method-specific configuration for this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The list of payment method types (for example, card) that this SetupIntent can set up. /// If you don't provide this array, it defaults to ["card"]. #[serde(skip_serializing_if = "Option::is_none")] pub payment_method_types: Option<&'a [&'a str]>, } -impl<'a> UpdateSetupIntent<'a> { +impl<'a> UpdateSetupIntentBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -2922,7 +2775,7 @@ impl<'a> UpdateSetupIntent<'a> { /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodData<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -2937,10 +2790,10 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, @@ -2952,7 +2805,7 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -2961,10 +2814,10 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -2973,13 +2826,13 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -2997,7 +2850,7 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -3019,21 +2872,18 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: UpdateSetupIntentPaymentMethodDataType, + pub type_: UpdateSetupIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -3041,8 +2891,8 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> UpdateSetupIntentPaymentMethodData<'a> { - pub fn new(type_: UpdateSetupIntentPaymentMethodDataType) -> Self { +impl<'a> UpdateSetupIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: UpdateSetupIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -3076,7 +2926,6 @@ impl<'a> UpdateSetupIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -3086,20 +2935,20 @@ impl<'a> UpdateSetupIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> UpdateSetupIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataBacsDebit<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -3107,30 +2956,30 @@ pub struct UpdateSetupIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> UpdateSetupIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataBoleto<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> UpdateSetupIntentPaymentMethodDataBoleto<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataEps { +pub struct UpdateSetupIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdateSetupIntentPaymentMethodDataEps { +impl UpdateSetupIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -3138,7 +2987,7 @@ impl UpdateSetupIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSetupIntentPaymentMethodDataEpsBank { +pub enum UpdateSetupIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -3170,9 +3019,9 @@ pub enum UpdateSetupIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSetupIntentPaymentMethodDataEpsBank { +impl UpdateSetupIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataEpsBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -3207,10 +3056,10 @@ impl UpdateSetupIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataEpsBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -3244,18 +3093,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataEpsBank { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3265,27 +3114,27 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataFpx { +pub struct UpdateSetupIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// The customer's bank. - pub bank: UpdateSetupIntentPaymentMethodDataFpxBank, + pub bank: UpdateSetupIntentBuilderPaymentMethodDataFpxBank, } -impl UpdateSetupIntentPaymentMethodDataFpx { - pub fn new(bank: UpdateSetupIntentPaymentMethodDataFpxBank) -> Self { +impl UpdateSetupIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: UpdateSetupIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +pub enum UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -3293,10 +3142,10 @@ impl UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -3304,18 +3153,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataFpxAccountHolderTyp } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3326,7 +3175,7 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataFpxAccountHolderType /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSetupIntentPaymentMethodDataFpxBank { +pub enum UpdateSetupIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -3352,9 +3201,9 @@ pub enum UpdateSetupIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSetupIntentPaymentMethodDataFpxBank { +impl UpdateSetupIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataFpxBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -3383,10 +3232,10 @@ impl UpdateSetupIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataFpxBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -3414,18 +3263,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataFpxBank { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3435,12 +3284,12 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataIdeal { +pub struct UpdateSetupIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdateSetupIntentPaymentMethodDataIdeal { +impl UpdateSetupIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -3448,7 +3297,7 @@ impl UpdateSetupIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSetupIntentPaymentMethodDataIdealBank { +pub enum UpdateSetupIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -3457,7 +3306,6 @@ pub enum UpdateSetupIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -3468,9 +3316,9 @@ pub enum UpdateSetupIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSetupIntentPaymentMethodDataIdealBank { +impl UpdateSetupIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataIdealBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -3480,7 +3328,6 @@ impl UpdateSetupIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -3493,10 +3340,10 @@ impl UpdateSetupIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataIdealBank::*; + use UpdateSetupIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -3506,7 +3353,6 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -3518,18 +3364,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataIdealBank { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3539,24 +3385,24 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataKlarna { +pub struct UpdateSetupIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl UpdateSetupIntentPaymentMethodDataKlarna { +impl UpdateSetupIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataP24 { +pub struct UpdateSetupIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl UpdateSetupIntentPaymentMethodDataP24 { +impl UpdateSetupIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -3564,7 +3410,7 @@ impl UpdateSetupIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSetupIntentPaymentMethodDataP24Bank { +pub enum UpdateSetupIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -3589,14 +3435,13 @@ pub enum UpdateSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSetupIntentPaymentMethodDataP24Bank { +impl UpdateSetupIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataP24Bank::*; + use UpdateSetupIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -3622,17 +3467,16 @@ impl UpdateSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataP24Bank::*; + use UpdateSetupIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -3658,24 +3502,23 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataP24Bank { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3685,29 +3528,29 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataP24Bank { } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataSepaDebit<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> UpdateSetupIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataSofort { +pub struct UpdateSetupIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: UpdateSetupIntentPaymentMethodDataSofortCountry, + pub country: UpdateSetupIntentBuilderPaymentMethodDataSofortCountry, } -impl UpdateSetupIntentPaymentMethodDataSofort { - pub fn new(country: UpdateSetupIntentPaymentMethodDataSofortCountry) -> Self { +impl UpdateSetupIntentBuilderPaymentMethodDataSofort { + pub fn new(country: UpdateSetupIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodDataSofortCountry { +pub enum UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -3715,9 +3558,9 @@ pub enum UpdateSetupIntentPaymentMethodDataSofortCountry { It, Nl, } -impl UpdateSetupIntentPaymentMethodDataSofortCountry { +impl UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataSofortCountry::*; + use UpdateSetupIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -3729,10 +3572,10 @@ impl UpdateSetupIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataSofortCountry::*; + use UpdateSetupIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -3744,18 +3587,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3768,7 +3611,7 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateSetupIntentPaymentMethodDataType { +pub enum UpdateSetupIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -3797,16 +3640,15 @@ pub enum UpdateSetupIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateSetupIntentPaymentMethodDataType { +impl UpdateSetupIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataType::*; + use UpdateSetupIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -3836,7 +3678,6 @@ impl UpdateSetupIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -3845,10 +3686,10 @@ impl UpdateSetupIntentPaymentMethodDataType { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataType { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataType::*; + use UpdateSetupIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -3878,7 +3719,6 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -3886,18 +3726,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataType { } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataType { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataType { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataType { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3907,17 +3747,17 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataUsBankAccount<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -3925,20 +3765,20 @@ pub struct UpdateSetupIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> UpdateSetupIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -3946,10 +3786,10 @@ impl UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -3957,18 +3797,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataUsBankAccountAccoun } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3978,13 +3818,13 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataUsBankAccountAccount } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +pub enum UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -3992,10 +3832,10 @@ impl UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -4003,18 +3843,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodDataUsBankAccountAccoun } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4024,13 +3864,13 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataUsBankAccountAccount } /// Payment method-specific configuration for this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptions<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// Configuration for any card setup attempted on this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub link: Option>, @@ -4039,32 +3879,33 @@ pub struct UpdateSetupIntentPaymentMethodOptions<'a> { pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, } -impl<'a> UpdateSetupIntentPaymentMethodOptions<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, + pub currency: Option, /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, - /// Bank account verification method. + pub mandate_options: + Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } @@ -4072,13 +3913,13 @@ impl<'a> UpdateSetupIntentPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { Cad, Usd, } -impl UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match self { Cad => "cad", Usd => "usd", @@ -4086,10 +3927,10 @@ impl UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match s { "cad" => Ok(Cad), "usd" => Ok(Usd), @@ -4097,18 +3938,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrenc } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4118,7 +3959,7 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitCurrency } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -4127,7 +3968,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// List of Stripe products where this mandate can be selected automatically. #[serde(skip_serializing_if = "Option::is_none")] pub default_for: - Option<&'a [UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, + Option<&'a [UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, /// Description of the mandate interval. /// Only required if 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] @@ -4135,26 +3976,26 @@ pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub payment_schedule: - Option, + Option, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub transaction_type: - Option, + Option, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// List of Stripe products where this mandate can be selected automatically. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { Invoice, Subscription, } -impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match self { Invoice => "invoice", Subscription => "subscription", @@ -4162,10 +4003,12 @@ impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::str::FromStr + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match s { "invoice" => Ok(Invoice), "subscription" => Ok(Subscription), @@ -4173,18 +4016,24 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandate } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Display + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Debug + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl serde::Serialize + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4194,14 +4043,14 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateO } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -4211,11 +4060,11 @@ impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule } impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -4225,7 +4074,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4233,14 +4082,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -4251,13 +4100,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -4266,11 +4115,11 @@ impl UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType } impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -4279,7 +4128,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4287,14 +4136,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -4303,16 +4152,16 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -4321,10 +4170,10 @@ impl UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -4333,18 +4182,18 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerific } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4354,10 +4203,10 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsAcssDebitVerifica } /// Configuration for any card setup attempted on this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsCard<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsCard<'a> { /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: Option>, /// When specified, this parameter signals that a card has been collected /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -4367,33 +4216,30 @@ pub struct UpdateSetupIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the SetupIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this setup. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, + Option, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsCard<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// Currency in which future payments will be charged. /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). @@ -4407,7 +4253,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -4417,301 +4263,80 @@ pub struct UpdateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { /// Unique identifier for the mandate or subscription. pub reference: &'a str, /// Start date of the mandate or subscription. Start date should not be lesser than yesterday. - pub start_date: stripe_types::Timestamp, - /// Specifies the type of mandates supported. Possible values are `india`. - #[serde(skip_serializing_if = "Option::is_none")] - pub supported_types: - Option<&'a [UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { - pub fn new( - amount: i64, - amount_type: UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, - currency: stripe_types::Currency, - interval: UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, - reference: &'a str, - start_date: stripe_types::Timestamp, - ) -> Self { - Self { - amount, - amount_type, - currency, - description: None, - end_date: None, - interval, - interval_count: None, - reference, - start_date, - supported_types: None, - } - } -} -/// One of `fixed` or `maximum`. -/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. -/// If `maximum`, the amount charged can be up to the value passed for the `amount` param. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - Fixed, - Maximum, -} -impl UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; - match self { - Fixed => "fixed", - Maximum => "maximum", - } - } -} - -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; - match s { - "fixed" => Ok(Fixed), - "maximum" => Ok(Maximum), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - Day, - Month, - Sporadic, - Week, - Year, -} -impl UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; - match self { - Day => "day", - Month => "month", - Sporadic => "sporadic", - Week => "week", - Year => "year", - } - } -} - -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; - match s { - "day" => Ok(Day), - "month" => Ok(Month), - "sporadic" => Ok(Sporadic), - "week" => Ok(Week), - "year" => Ok(Year), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies the type of mandates supported. Possible values are `india`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - India, -} -impl UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; - match self { - India => "india", - } - } -} - -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; - match s { - "india" => Ok(India), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Selected network to process this SetupIntent on. -/// Depends on the available networks of the card attached to the SetupIntent. -/// Can be only set confirm-time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardNetwork { - Amex, - CartesBancaires, - Diners, - Discover, - EftposAu, - Interac, - Jcb, - Mastercard, - Unionpay, - Unknown, - Visa, -} -impl UpdateSetupIntentPaymentMethodOptionsCardNetwork { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardNetwork::*; - match self { - Amex => "amex", - CartesBancaires => "cartes_bancaires", - Diners => "diners", - Discover => "discover", - EftposAu => "eftpos_au", - Interac => "interac", - Jcb => "jcb", - Mastercard => "mastercard", - Unionpay => "unionpay", - Unknown => "unknown", - Visa => "visa", - } - } -} - -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardNetwork { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardNetwork::*; - match s { - "amex" => Ok(Amex), - "cartes_bancaires" => Ok(CartesBancaires), - "diners" => Ok(Diners), - "discover" => Ok(Discover), - "eftpos_au" => Ok(EftposAu), - "interac" => Ok(Interac), - "jcb" => Ok(Jcb), - "mastercard" => Ok(Mastercard), - "unionpay" => Ok(Unionpay), - "unknown" => Ok(Unknown), - "visa" => Ok(Visa), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardNetwork { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardNetwork { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } + pub start_date: stripe_types::Timestamp, + /// Specifies the type of mandates supported. Possible values are `india`. + #[serde(skip_serializing_if = "Option::is_none")] + pub supported_types: + Option<&'a [UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardNetwork { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { + pub fn new( + amount: i64, + amount_type: UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, + currency: stripe_types::Currency, + interval: UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, + reference: &'a str, + start_date: stripe_types::Timestamp, + ) -> Self { + Self { + amount, + amount_type, + currency, + description: None, + end_date: None, + interval, + interval_count: None, + reference, + start_date, + supported_types: None, + } } } -/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). -/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. -/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. +/// One of `fixed` or `maximum`. +/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. +/// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { - Any, - Automatic, - Challenge, +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { + Fixed, + Maximum, } -impl UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { - Any => "any", - Automatic => "automatic", - Challenge => "challenge", + Fixed => "fixed", + Maximum => "maximum", } } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::str::FromStr + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { - "any" => Ok(Any), - "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), + "fixed" => Ok(Fixed), + "maximum" => Ok(Maximum), _ => Err(()), } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4719,102 +4344,54 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeD serializer.serialize_str(self.as_str()) } } -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this setup. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - #[serde(skip_serializing_if = "Option::is_none")] - pub cryptogram: Option<&'a str>, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly - #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. - #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_id: Option<&'a str>, - /// The version of 3D Secure that was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. +/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { + Day, + Month, + Sporadic, + Week, + Year, +} +impl UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", + Day => "day", + Month => "month", + Sporadic => "sporadic", + Week => "week", + Year => "year", } } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), + "day" => Ok(Day), + "month" => Ok(Month), + "sporadic" => Ok(Sporadic), + "week" => Ok(Week), + "year" => Ok(Year), _ => Err(()), } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4822,47 +4399,34 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureA serializer.serialize_str(self.as_str()) } } -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. +/// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { + India, +} +impl UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", + India => "india", } } } impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), + "india" => Ok(India), _ => Err(()), } } } impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4870,14 +4434,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for UpdateSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn serialize(&self, serializer: S) -> Result where @@ -4886,110 +4450,74 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO - pub cb_avalgo: - UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_score: Option, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO +/// Selected network to process this SetupIntent on. +/// Depends on the available networks of the card attached to the SetupIntent. +/// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { + Amex, + CartesBancaires, + Diners, + Discover, + EftposAu, + Interac, + Jcb, + Mastercard, + Unionpay, + Unknown, + Visa, +} +impl UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", + Amex => "amex", + CartesBancaires => "cartes_bancaires", + Diners => "diners", + Discover => "discover", + EftposAu => "eftpos_au", + Interac => "interac", + Jcb => "jcb", + Mastercard => "mastercard", + Unionpay => "unionpay", + Unknown => "unknown", + Visa => "visa", } } } -impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { - "0" => Ok(V0), - "1" => Ok(V1), - "2" => Ok(V2), - "3" => Ok(V3), - "4" => Ok(V4), - "A" => Ok(A), + "amex" => Ok(Amex), + "cartes_bancaires" => Ok(CartesBancaires), + "diners" => Ok(Diners), + "discover" => Ok(Discover), + "eftpos_au" => Ok(EftposAu), + "interac" => Ok(Interac), + "jcb" => Ok(Jcb), + "mastercard" => Ok(Mastercard), + "unionpay" => Ok(Unionpay), + "unknown" => Ok(Unknown), + "visa" => Ok(Visa), _ => Err(()), } } } -impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4997,48 +4525,49 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// The version of 3D Secure that was performed. +/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). +/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. +/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { + Any, + Automatic, } -impl UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", + Any => "any", + Automatic => "automatic", } } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::str::FromStr for UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), + "any" => Ok(Any), + "automatic" => Ok(Automatic), _ => Err(()), } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Display for UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Debug for UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize for UpdateSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5048,60 +4577,54 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardThreeDSecureV } /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsSepaDebit<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option<&'a serde_json::Value>, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsSepaDebit<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccount<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, + Option>, /// Additional fields for network related functions #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, - /// Bank account verification method. + pub networks: Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option< - &'a [UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option< - &'a [UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch], - >, - /// For webview integrations only. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub return_url: Option<&'a str>, + } -impl<'a> UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -5110,15 +4633,15 @@ impl<'a> UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections< /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { Balances, Ownership, PaymentMethod, Transactions, } -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -5129,11 +4652,11 @@ impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermi } impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -5144,7 +4667,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -5152,14 +4675,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -5170,99 +4693,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() - } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), _ => Err(()), } } } impl std::fmt::Display - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -5270,14 +4726,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdateSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -5288,26 +4744,26 @@ impl serde::Serialize } /// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +pub struct UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] pub requested: - Option<&'a [UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + Option<&'a [UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } /// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { Ach, UsDomesticWire, } -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -5315,10 +4771,12 @@ impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::str::FromStr + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -5326,18 +4784,24 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNet } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Display + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Debug + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl serde::Serialize + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5345,16 +4809,16 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetw serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -5363,10 +4827,12 @@ impl UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { } } -impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::str::FromStr + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -5375,18 +4841,24 @@ impl std::str::FromStr for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVer } } } -impl std::fmt::Display for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Display + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for UpdateSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5394,61 +4866,122 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsUsBankAccountVeri serializer.serialize_str(self.as_str()) } } -impl<'a> UpdateSetupIntent<'a> { - /// Updates a SetupIntent object. - pub fn send( +/// Updates a SetupIntent object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateSetupIntent<'a> { + inner: UpdateSetupIntentBuilder<'a>, + intent: &'a stripe_shared::SetupIntentId, +} +impl<'a> UpdateSetupIntent<'a> { + pub fn new(intent: &'a stripe_shared::SetupIntentId) -> Self { + Self { intent, inner: UpdateSetupIntentBuilder::new() } + } + pub fn attach_to_self(mut self, attach_to_self: bool) -> Self { + self.inner.attach_to_self = Some(attach_to_self); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn flow_directions( + mut self, + flow_directions: &'a [stripe_shared::SetupIntentFlowDirections], + ) -> Self { + self.inner.flow_directions = Some(flow_directions); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn payment_method_configuration(mut self, payment_method_configuration: &'a str) -> Self { + self.inner.payment_method_configuration = Some(payment_method_configuration); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: UpdateSetupIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: UpdateSetupIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn payment_method_types(mut self, payment_method_types: &'a [&'a str]) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } +} +impl UpdateSetupIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::SetupIntentId, - ) -> stripe::Response { - client.send_form(&format!("/setup_intents/{intent}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelSetupIntent<'a> { - /// Reason for canceling this SetupIntent. - /// Possible values are: `abandoned`, `requested_by_customer`, or `duplicate`. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelSetupIntent<'a> { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CancelSetupIntent<'a> { - /// You can cancel a SetupIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_confirmation`, or `requires_action`. - /// - /// - /// After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. - pub fn send( - &self, - client: &stripe::Client, - intent: &stripe_shared::SetupIntentId, - ) -> stripe::Response { - client.send_form(&format!("/setup_intents/{intent}/cancel"), self, http_types::Method::Post) + +impl StripeRequest for UpdateSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/setup_intents/{intent}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntent<'a> { +pub struct ConfirmSetupIntentBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_data: Option>, + pub mandate_data: Option>, /// ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] pub payment_method: Option<&'a str>, /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_data: Option>, + pub payment_method_data: Option>, /// Payment method-specific configuration for this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, + pub payment_method_options: Option>, /// The URL to redirect your customer back to after they authenticate on the payment method's app or site. /// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. /// This parameter is only used for cards and other redirect-based payment methods. @@ -5458,32 +4991,32 @@ pub struct ConfirmSetupIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub use_stripe_sdk: Option, } -impl<'a> ConfirmSetupIntent<'a> { +impl<'a> ConfirmSetupIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum ConfirmSetupIntentMandateData<'a> { - SecretKeyParam(ConfirmSetupIntentSecretKeyParam<'a>), - ClientKeyParam(ConfirmSetupIntentClientKeyParam<'a>), +pub enum ConfirmSetupIntentBuilderMandateData<'a> { + SecretKeyParam(ConfirmSetupIntentBuilderSecretKeyParam<'a>), + ClientKeyParam(ConfirmSetupIntentBuilderClientKeyParam<'a>), } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentSecretKeyParam<'a> { +pub struct ConfirmSetupIntentBuilderSecretKeyParam<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a>, + pub customer_acceptance: ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptance<'a>, } -impl<'a> ConfirmSetupIntentSecretKeyParam<'a> { +impl<'a> ConfirmSetupIntentBuilderSecretKeyParam<'a> { pub fn new( - customer_acceptance: ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a>, + customer_acceptance: ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptance<'a>, ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a> { +pub struct ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptance<'a> { /// The time at which the customer accepted the Mandate. #[serde(skip_serializing_if = "Option::is_none")] pub accepted_at: Option, @@ -5496,23 +5029,23 @@ pub struct ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a> { /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] - pub type_: ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType, + pub type_: ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType, } -impl<'a> ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a> { - pub fn new(type_: ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType) -> Self { +impl<'a> ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptance<'a> { + pub fn new(type_: ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType) -> Self { Self { accepted_at: None, offline: None, online: None, type_ } } } /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +pub enum ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { Offline, Online, } -impl ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +impl ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType::*; + use ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -5520,10 +5053,10 @@ impl ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { } } -impl std::str::FromStr for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +impl std::str::FromStr for ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType::*; + use ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -5531,18 +5064,18 @@ impl std::str::FromStr for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceTyp } } } -impl std::fmt::Display for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +impl std::fmt::Display for ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType { +impl serde::Serialize for ConfirmSetupIntentBuilderSecretKeyParamCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5551,37 +5084,37 @@ impl serde::Serialize for ConfirmSetupIntentSecretKeyParamCustomerAcceptanceType } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentClientKeyParam<'a> { +pub struct ConfirmSetupIntentBuilderClientKeyParam<'a> { /// This hash contains details about the customer acceptance of the Mandate. - pub customer_acceptance: ConfirmSetupIntentClientKeyParamCustomerAcceptance<'a>, + pub customer_acceptance: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptance<'a>, } -impl<'a> ConfirmSetupIntentClientKeyParam<'a> { +impl<'a> ConfirmSetupIntentBuilderClientKeyParam<'a> { pub fn new( - customer_acceptance: ConfirmSetupIntentClientKeyParamCustomerAcceptance<'a>, + customer_acceptance: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptance<'a>, ) -> Self { Self { customer_acceptance } } } /// This hash contains details about the customer acceptance of the Mandate. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentClientKeyParamCustomerAcceptance<'a> { +pub struct ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptance<'a> { /// If this is a Mandate accepted online, this hash contains details about the online acceptance. - pub online: ConfirmSetupIntentClientKeyParamCustomerAcceptanceOnline<'a>, + pub online: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a>, /// The type of customer acceptance information included with the Mandate. #[serde(rename = "type")] - pub type_: ConfirmSetupIntentClientKeyParamCustomerAcceptanceType, + pub type_: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType, } -impl<'a> ConfirmSetupIntentClientKeyParamCustomerAcceptance<'a> { +impl<'a> ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptance<'a> { pub fn new( - online: ConfirmSetupIntentClientKeyParamCustomerAcceptanceOnline<'a>, - type_: ConfirmSetupIntentClientKeyParamCustomerAcceptanceType, + online: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a>, + type_: ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType, ) -> Self { Self { online, type_ } } } /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentClientKeyParamCustomerAcceptanceOnline<'a> { +pub struct ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a> { /// The IP address from which the Mandate was accepted by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub ip_address: Option<&'a str>, @@ -5589,47 +5122,47 @@ pub struct ConfirmSetupIntentClientKeyParamCustomerAcceptanceOnline<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> ConfirmSetupIntentClientKeyParamCustomerAcceptanceOnline<'a> { +impl<'a> ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceOnline<'a> { pub fn new() -> Self { Self::default() } } /// The type of customer acceptance information included with the Mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +pub enum ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { Online, } -impl ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +impl ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentClientKeyParamCustomerAcceptanceType::*; + use ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType::*; match self { Online => "online", } } } -impl std::str::FromStr for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +impl std::str::FromStr for ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentClientKeyParamCustomerAcceptanceType::*; + use ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType::*; match s { "online" => Ok(Online), _ => Err(()), } } } -impl std::fmt::Display for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +impl std::fmt::Display for ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType { +impl serde::Serialize for ConfirmSetupIntentBuilderClientKeyParamCustomerAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5640,7 +5173,7 @@ impl serde::Serialize for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodData<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option>, @@ -5655,10 +5188,10 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, @@ -5670,7 +5203,7 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -5679,10 +5212,10 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -5691,13 +5224,13 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -5715,7 +5248,7 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option<&'a serde_json::Value>, @@ -5737,21 +5270,18 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: ConfirmSetupIntentPaymentMethodDataType, + pub type_: ConfirmSetupIntentBuilderPaymentMethodDataType, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -5759,8 +5289,8 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> ConfirmSetupIntentPaymentMethodData<'a> { - pub fn new(type_: ConfirmSetupIntentPaymentMethodDataType) -> Self { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodData<'a> { + pub fn new(type_: ConfirmSetupIntentBuilderPaymentMethodDataType) -> Self { Self { acss_debit: None, affirm: None, @@ -5794,7 +5324,6 @@ impl<'a> ConfirmSetupIntentPaymentMethodData<'a> { revolut_pay: None, sepa_debit: None, sofort: None, - swish: None, type_, us_bank_account: None, wechat_pay: None, @@ -5804,20 +5333,20 @@ impl<'a> ConfirmSetupIntentPaymentMethodData<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataAuBecsDebit<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> ConfirmSetupIntentPaymentMethodDataAuBecsDebit<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodDataAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataBacsDebit<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -5825,30 +5354,30 @@ pub struct ConfirmSetupIntentPaymentMethodDataBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> ConfirmSetupIntentPaymentMethodDataBacsDebit<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodDataBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataBoleto<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> ConfirmSetupIntentPaymentMethodDataBoleto<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodDataBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataEps { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmSetupIntentPaymentMethodDataEps { +impl ConfirmSetupIntentBuilderPaymentMethodDataEps { pub fn new() -> Self { Self::default() } @@ -5856,7 +5385,7 @@ impl ConfirmSetupIntentPaymentMethodDataEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmSetupIntentPaymentMethodDataEpsBank { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -5888,9 +5417,9 @@ pub enum ConfirmSetupIntentPaymentMethodDataEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmSetupIntentPaymentMethodDataEpsBank { +impl ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataEpsBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -5925,10 +5454,10 @@ impl ConfirmSetupIntentPaymentMethodDataEpsBank { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataEpsBank { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataEpsBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -5962,18 +5491,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataEpsBank { } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataEpsBank { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataEpsBank { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5983,27 +5512,27 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataFpx { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// The customer's bank. - pub bank: ConfirmSetupIntentPaymentMethodDataFpxBank, + pub bank: ConfirmSetupIntentBuilderPaymentMethodDataFpxBank, } -impl ConfirmSetupIntentPaymentMethodDataFpx { - pub fn new(bank: ConfirmSetupIntentPaymentMethodDataFpxBank) -> Self { +impl ConfirmSetupIntentBuilderPaymentMethodDataFpx { + pub fn new(bank: ConfirmSetupIntentBuilderPaymentMethodDataFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { Company, Individual, } -impl ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +impl ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -6011,10 +5540,10 @@ impl ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -6022,18 +5551,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderTy } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderType { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6044,7 +5573,7 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataFpxAccountHolderTyp /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmSetupIntentPaymentMethodDataFpxBank { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { AffinBank, Agrobank, AllianceBank, @@ -6070,9 +5599,9 @@ pub enum ConfirmSetupIntentPaymentMethodDataFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmSetupIntentPaymentMethodDataFpxBank { +impl ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataFpxBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -6101,10 +5630,10 @@ impl ConfirmSetupIntentPaymentMethodDataFpxBank { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataFpxBank { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataFpxBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -6132,18 +5661,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataFpxBank { } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataFpxBank { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataFpxBank { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6153,12 +5682,12 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataIdeal { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmSetupIntentPaymentMethodDataIdeal { +impl ConfirmSetupIntentBuilderPaymentMethodDataIdeal { pub fn new() -> Self { Self::default() } @@ -6166,7 +5695,7 @@ impl ConfirmSetupIntentPaymentMethodDataIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmSetupIntentPaymentMethodDataIdealBank { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { AbnAmro, AsnBank, Bunq, @@ -6175,7 +5704,6 @@ pub enum ConfirmSetupIntentPaymentMethodDataIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -6186,9 +5714,9 @@ pub enum ConfirmSetupIntentPaymentMethodDataIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmSetupIntentPaymentMethodDataIdealBank { +impl ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataIdealBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -6198,7 +5726,6 @@ impl ConfirmSetupIntentPaymentMethodDataIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -6211,10 +5738,10 @@ impl ConfirmSetupIntentPaymentMethodDataIdealBank { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataIdealBank { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataIdealBank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -6224,7 +5751,6 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -6236,18 +5762,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataIdealBank { } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataIdealBank { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataIdealBank { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6257,24 +5783,24 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataKlarna { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, } -impl ConfirmSetupIntentPaymentMethodDataKlarna { +impl ConfirmSetupIntentBuilderPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataP24 { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl ConfirmSetupIntentPaymentMethodDataP24 { +impl ConfirmSetupIntentBuilderPaymentMethodDataP24 { pub fn new() -> Self { Self::default() } @@ -6282,7 +5808,7 @@ impl ConfirmSetupIntentPaymentMethodDataP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmSetupIntentPaymentMethodDataP24Bank { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -6307,14 +5833,13 @@ pub enum ConfirmSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmSetupIntentPaymentMethodDataP24Bank { +impl ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataP24Bank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -6340,17 +5865,16 @@ impl ConfirmSetupIntentPaymentMethodDataP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataP24Bank { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataP24Bank::*; + use ConfirmSetupIntentBuilderPaymentMethodDataP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -6376,24 +5900,23 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataP24Bank { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataP24Bank { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6403,29 +5926,29 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataP24Bank { } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataSepaDebit<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> ConfirmSetupIntentPaymentMethodDataSepaDebit<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodDataSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataSofort { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: ConfirmSetupIntentPaymentMethodDataSofortCountry, + pub country: ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry, } -impl ConfirmSetupIntentPaymentMethodDataSofort { - pub fn new(country: ConfirmSetupIntentPaymentMethodDataSofortCountry) -> Self { +impl ConfirmSetupIntentBuilderPaymentMethodDataSofort { + pub fn new(country: ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodDataSofortCountry { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { At, Be, De, @@ -6433,9 +5956,9 @@ pub enum ConfirmSetupIntentPaymentMethodDataSofortCountry { It, Nl, } -impl ConfirmSetupIntentPaymentMethodDataSofortCountry { +impl ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataSofortCountry::*; + use ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry::*; match self { At => "AT", Be => "BE", @@ -6447,10 +5970,10 @@ impl ConfirmSetupIntentPaymentMethodDataSofortCountry { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataSofortCountry { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataSofortCountry::*; + use ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -6462,18 +5985,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataSofortCountry { } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataSofortCountry { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataSofortCountry { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6486,7 +6009,7 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum ConfirmSetupIntentPaymentMethodDataType { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataType { AcssDebit, Affirm, AfterpayClearpay, @@ -6515,16 +6038,15 @@ pub enum ConfirmSetupIntentPaymentMethodDataType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl ConfirmSetupIntentPaymentMethodDataType { +impl ConfirmSetupIntentBuilderPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -6554,7 +6076,6 @@ impl ConfirmSetupIntentPaymentMethodDataType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -6563,10 +6084,10 @@ impl ConfirmSetupIntentPaymentMethodDataType { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataType { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -6596,7 +6117,6 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -6604,18 +6124,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataType { } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataType { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataType { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6625,17 +6145,17 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataUsBankAccount<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: - Option, + Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -6643,20 +6163,20 @@ pub struct ConfirmSetupIntentPaymentMethodDataUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> ConfirmSetupIntentPaymentMethodDataUsBankAccount<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { Company, Individual, } -impl ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -6664,10 +6184,12 @@ impl ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -6675,18 +6197,20 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccou } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountHolderType { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6696,13 +6220,13 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccoun } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +pub enum ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -6710,10 +6234,10 @@ impl ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType::*; + use ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -6721,18 +6245,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccou } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccountType { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6742,13 +6266,13 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataUsBankAccountAccoun } /// Payment method-specific configuration for this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptions<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptions<'a> { /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// Configuration for any card setup attempted on this SetupIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub link: Option>, @@ -6757,32 +6281,33 @@ pub struct ConfirmSetupIntentPaymentMethodOptions<'a> { pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, } -impl<'a> ConfirmSetupIntentPaymentMethodOptions<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `acss_debit` SetupIntent, this sub-hash contains details about the ACSS Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsAcssDebit<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, + pub currency: Option, /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, - /// Bank account verification method. + pub mandate_options: + Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsAcssDebit<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebit<'a> { pub fn new() -> Self { Self::default() } @@ -6790,13 +6315,13 @@ impl<'a> ConfirmSetupIntentPaymentMethodOptionsAcssDebit<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { Cad, Usd, } -impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match self { Cad => "cad", Usd => "usd", @@ -6804,10 +6329,10 @@ impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency::*; match s { "cad" => Ok(Cad), "usd" => Ok(Usd), @@ -6815,18 +6340,18 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurren } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrency { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitCurrency { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6836,7 +6361,7 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitCurrenc } /// Additional fields for Mandate creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// A URL for custom mandate text to render during confirmation step. /// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,. /// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent. @@ -6844,8 +6369,9 @@ pub struct ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub custom_mandate_url: Option<&'a str>, /// List of Stripe products where this mandate can be selected automatically. #[serde(skip_serializing_if = "Option::is_none")] - pub default_for: - Option<&'a [ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor]>, + pub default_for: Option< + &'a [ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor], + >, /// Description of the mandate interval. /// Only required if 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] @@ -6853,26 +6379,26 @@ pub struct ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { /// Payment schedule for the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub payment_schedule: - Option, + Option, /// Transaction type of the mandate. #[serde(skip_serializing_if = "Option::is_none")] pub transaction_type: - Option, + Option, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptions<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptions<'a> { pub fn new() -> Self { Self::default() } } /// List of Stripe products where this mandate can be selected automatically. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { Invoice, Subscription, } -impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match self { Invoice => "invoice", Subscription => "subscription", @@ -6880,10 +6406,12 @@ impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor::*; match s { "invoice" => Ok(Invoice), "subscription" => Ok(Subscription), @@ -6891,18 +6419,24 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandat } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl std::fmt::Debug + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor { +impl serde::Serialize + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsDefaultFor +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6912,14 +6446,14 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandate } /// Payment schedule for the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { Combined, Interval, Sporadic, } -impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match self { Combined => "combined", Interval => "interval", @@ -6929,11 +6463,11 @@ impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedul } impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*; match s { "combined" => Ok(Combined), "interval" => Ok(Interval), @@ -6943,7 +6477,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -6951,14 +6485,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule { fn serialize(&self, serializer: S) -> Result where @@ -6969,13 +6503,13 @@ impl serde::Serialize } /// Transaction type of the mandate. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { Business, Personal, } -impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match self { Business => "business", Personal => "personal", @@ -6984,11 +6518,11 @@ impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionTyp } impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*; match s { "business" => Ok(Business), "personal" => Ok(Personal), @@ -6997,7 +6531,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -7005,14 +6539,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitMandateOptionsTransactionType { fn serialize(&self, serializer: S) -> Result where @@ -7021,16 +6555,16 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { Automatic, Instant, Microdeposits, } -impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -7039,10 +6573,12 @@ impl ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -7051,18 +6587,20 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerifi } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodOptionsAcssDebitVerificationMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7072,10 +6610,11 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsAcssDebitVerific } /// Configuration for any card setup attempted on this SetupIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsCard<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsCard<'a> { /// Configuration options for setting up an eMandate for cards issued in India. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option>, + pub mandate_options: + Option>, /// When specified, this parameter signals that a card has been collected /// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This /// parameter can only be provided during confirmation. @@ -7085,33 +6624,30 @@ pub struct ConfirmSetupIntentPaymentMethodOptionsCard<'a> { /// Depends on the available networks of the card attached to the SetupIntent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, + pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[serde(skip_serializing_if = "Option::is_none")] pub request_three_d_secure: - Option, - /// If 3D Secure authentication was performed with a third-party provider, - /// the authentication details to use for this setup. - #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option>, + Option, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsCard<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsCard<'a> { pub fn new() -> Self { Self::default() } } /// Configuration options for setting up an eMandate for cards issued in India. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { /// Amount to be charged for future payments. pub amount: i64, /// One of `fixed` or `maximum`. /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. - pub amount_type: ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, + pub amount_type: ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, /// Currency in which future payments will be charged. /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). @@ -7125,7 +6661,7 @@ pub struct ConfirmSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub end_date: Option, /// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. - pub interval: ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, + pub interval: ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, /// The number of intervals between payments. /// For example, `interval=month` and `interval_count=3` indicates one payment every three months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -7139,14 +6675,14 @@ pub struct ConfirmSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { /// Specifies the type of mandates supported. Possible values are `india`. #[serde(skip_serializing_if = "Option::is_none")] pub supported_types: - Option<&'a [ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, + Option<&'a [ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes]>, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptions<'a> { pub fn new( amount: i64, - amount_type: ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType, + amount_type: ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType, currency: stripe_types::Currency, - interval: ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval, + interval: ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval, reference: &'a str, start_date: stripe_types::Timestamp, ) -> Self { @@ -7168,13 +6704,13 @@ impl<'a> ConfirmSetupIntentPaymentMethodOptionsCardMandateOptions<'a> { /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments. /// If `maximum`, the amount charged can be up to the value passed for the `amount` param. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { Fixed, Maximum, } -impl ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match self { Fixed => "fixed", Maximum => "maximum", @@ -7182,10 +6718,12 @@ impl ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType::*; match s { "fixed" => Ok(Fixed), "maximum" => Ok(Maximum), @@ -7193,346 +6731,77 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardMandateOpti } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsAmountType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - Day, - Month, - Sporadic, - Week, - Year, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; - match self { - Day => "day", - Month => "month", - Sporadic => "sporadic", - Week => "week", - Year => "year", - } - } -} - -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval::*; - match s { - "day" => Ok(Day), - "month" => Ok(Month), - "sporadic" => Ok(Sporadic), - "week" => Ok(Week), - "year" => Ok(Year), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies the type of mandates supported. Possible values are `india`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - India, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; - match self { - India => "india", - } - } -} - -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; - match s { - "india" => Ok(India), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Selected network to process this SetupIntent on. -/// Depends on the available networks of the card attached to the SetupIntent. -/// Can be only set confirm-time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - Amex, - CartesBancaires, - Diners, - Discover, - EftposAu, - Interac, - Jcb, - Mastercard, - Unionpay, - Unknown, - Visa, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardNetwork::*; - match self { - Amex => "amex", - CartesBancaires => "cartes_bancaires", - Diners => "diners", - Discover => "discover", - EftposAu => "eftpos_au", - Interac => "interac", - Jcb => "jcb", - Mastercard => "mastercard", - Unionpay => "unionpay", - Unknown => "unknown", - Visa => "visa", - } - } -} - -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardNetwork::*; - match s { - "amex" => Ok(Amex), - "cartes_bancaires" => Ok(CartesBancaires), - "diners" => Ok(Diners), - "discover" => Ok(Discover), - "eftpos_au" => Ok(EftposAu), - "interac" => Ok(Interac), - "jcb" => Ok(Jcb), - "mastercard" => Ok(Mastercard), - "unionpay" => Ok(Unionpay), - "unknown" => Ok(Unknown), - "visa" => Ok(Visa), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardNetwork { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). -/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. -/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { - Any, - Automatic, - Challenge, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { - pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; - match self { - Any => "any", - Automatic => "automatic", - Challenge => "challenge", - } - } -} - -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure::*; - match s { - "any" => Ok(Any), - "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardRequestThreeDSecure { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// If 3D Secure authentication was performed with a third-party provider, -/// the authentication details to use for this setup. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { - /// The `transStatus` returned from the card Issuer’s ACS in the ARes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ares_trans_status: - Option, - /// The cryptogram, also known as the "authentication value" (AAV, CAVV or - /// AEVV). This value is 20 bytes, base64-encoded into a 28-character string. - /// (Most 3D Secure providers will return the base64-encoded version, which - /// is what you should specify here.) - #[serde(skip_serializing_if = "Option::is_none")] - pub cryptogram: Option<&'a str>, - /// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure - /// provider and indicates what degree of authentication was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub electronic_commerce_indicator: - Option, - /// Network specific 3DS fields. Network specific arguments require an - /// explicit card brand choice. The parameter `payment_method_options.card.network`` - /// must be populated accordingly - #[serde(skip_serializing_if = "Option::is_none")] - pub network_options: - Option>, - /// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the - /// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99. - #[serde(skip_serializing_if = "Option::is_none")] - pub requestor_challenge_indicator: Option<&'a str>, - /// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server - /// Transaction ID (dsTransID). - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_id: Option<&'a str>, - /// The version of 3D Secure that was performed. - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, -} -impl<'a> ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecure<'a> { - pub fn new() -> Self { - Self::default() +impl serde::Serialize + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsAmountType +{ + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) } } -/// The `transStatus` returned from the card Issuer’s ACS in the ARes. +/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { - A, - C, - I, - N, - R, - U, - Y, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { + Day, + Month, + Sporadic, + Week, + Year, +} +impl ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match self { - A => "A", - C => "C", - I => "I", - N => "N", - R => "R", - U => "U", - Y => "Y", + Day => "day", + Month => "month", + Sporadic => "sporadic", + Week => "week", + Year => "year", } } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval::*; match s { - "A" => Ok(A), - "C" => Ok(C), - "I" => Ok(I), - "N" => Ok(N), - "R" => Ok(R), - "U" => Ok(U), - "Y" => Ok(Y), + "day" => Ok(Day), + "month" => Ok(Month), + "sporadic" => Ok(Sporadic), + "week" => Ok(Week), + "year" => Ok(Year), _ => Err(()), } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7540,47 +6809,34 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecure serializer.serialize_str(self.as_str()) } } -/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure -/// provider and indicates what degree of authentication was performed. +/// Specifies the type of mandates supported. Possible values are `india`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { + India, +} +impl ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", + India => "india", } } } impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes::*; match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), + "india" => Ok(India), _ => Err(()), } } } impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -7588,14 +6844,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator + for ConfirmSetupIntentBuilderPaymentMethodOptionsCardMandateOptionsSupportedTypes { fn serialize(&self, serializer: S) -> Result where @@ -7604,110 +6860,74 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Network specific 3DS fields. Network specific arguments require an -/// explicit card brand choice. The parameter `payment_method_options.card.network`` -/// must be populated accordingly -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - /// Cartes Bancaires-specific 3DS fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option< - ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a>, - >, -} -impl<'a> ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Cartes Bancaires-specific 3DS fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - /// The cryptogram calculation algorithm used by the card Issuer's ACS - /// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. - /// messageExtension: CB-AVALGO - pub cb_avalgo: - ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - /// The exemption indicator returned from Cartes Bancaires in the ARes. - /// message extension: CB-EXEMPTION; string (4 characters) - /// This is a 3 byte bitmap (low significant byte first and most significant - /// bit first) that has been Base64 encoded - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_exemption: Option<&'a str>, - /// The risk score returned from Cartes Bancaires in the ARes. - /// message extension: CB-SCORE; numeric value 0-99 - #[serde(skip_serializing_if = "Option::is_none")] - pub cb_score: Option, -} -impl<'a> ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires<'a> { - pub fn new( - cb_avalgo: ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo, - ) -> Self { - Self { cb_avalgo, cb_exemption: None, cb_score: None } - } -} -/// The cryptogram calculation algorithm used by the card Issuer's ACS -/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`. -/// messageExtension: CB-AVALGO +/// Selected network to process this SetupIntent on. +/// Depends on the available networks of the card attached to the SetupIntent. +/// Can be only set confirm-time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ - V0, - V1, - V2, - V3, - V4, - A, -} -impl ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { + Amex, + CartesBancaires, + Diners, + Discover, + EftposAu, + Interac, + Jcb, + Mastercard, + Unionpay, + Unknown, + Visa, +} +impl ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match self { - V0 => "0", - V1 => "1", - V2 => "2", - V3 => "3", - V4 => "4", - A => "A", + Amex => "amex", + CartesBancaires => "cartes_bancaires", + Diners => "diners", + Discover => "discover", + EftposAu => "eftpos_au", + Interac => "interac", + Jcb => "jcb", + Mastercard => "mastercard", + Unionpay => "unionpay", + Unknown => "unknown", + Visa => "visa", } } } -impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork::*; match s { - "0" => Ok(V0), - "1" => Ok(V1), - "2" => Ok(V2), - "3" => Ok(V3), - "4" => Ok(V4), - "A" => Ok(A), + "amex" => Ok(Amex), + "cartes_bancaires" => Ok(CartesBancaires), + "diners" => Ok(Diners), + "discover" => Ok(Discover), + "eftpos_au" => Ok(EftposAu), + "interac" => Ok(Interac), + "jcb" => Ok(Jcb), + "mastercard" => Ok(Mastercard), + "unionpay" => Ok(Unionpay), + "unknown" => Ok(Unknown), + "visa" => Ok(Visa), _ => Err(()), } } } -impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo -{ +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodOptionsCardNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7715,48 +6935,49 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// The version of 3D Secure that was performed. +/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). +/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. +/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { - V1_0_2, - V2_1_0, - V2_2_0, +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { + Any, + Automatic, } -impl ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match self { - V1_0_2 => "1.0.2", - V2_1_0 => "2.1.0", - V2_2_0 => "2.2.0", + Any => "any", + Automatic => "automatic", } } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::str::FromStr for ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure::*; match s { - "1.0.2" => Ok(V1_0_2), - "2.1.0" => Ok(V2_1_0), - "2.2.0" => Ok(V2_2_0), + "any" => Ok(Any), + "automatic" => Ok(Automatic), _ => Err(()), } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Display for ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl std::fmt::Debug for ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecureVersion { +impl serde::Serialize for ConfirmSetupIntentBuilderPaymentMethodOptionsCardRequestThreeDSecure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -7766,60 +6987,54 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardThreeDSecure } /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsSepaDebit<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { /// Additional fields for Mandate creation #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option<&'a serde_json::Value>, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsSepaDebit<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsSepaDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `us_bank_account` SetupIntent, this sub-hash contains details about the US bank account payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsUsBankAccount<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: - Option>, - /// Additional fields for Mandate creation - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, + Option>, /// Additional fields for network related functions #[serde(skip_serializing_if = "Option::is_none")] - pub networks: Option>, - /// Bank account verification method. + pub networks: Option>, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: - Option, + Option, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsUsBankAccount<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { - /// The list of permissions to request. +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { + /// The list of permissions to request. /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option< - &'a [ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions], - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub permissions: Option<&'a [ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions]>, /// List of data features that you would like to retrieve upon account creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option< - &'a [ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch], - >, - /// For webview integrations only. +#[serde(skip_serializing_if = "Option::is_none")] +pub prefetch: Option<&'a [ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch]>, + /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub return_url: Option<&'a str>, + } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { pub fn new() -> Self { Self::default() } @@ -7828,15 +7043,15 @@ impl<'a> ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnections /// If this parameter is passed, the `payment_method` permission must be included. /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { Balances, Ownership, PaymentMethod, Transactions, } -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match self { Balances => "balances", Ownership => "ownership", @@ -7847,11 +7062,11 @@ impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPerm } impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*; match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), @@ -7862,7 +7077,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -7870,14 +7085,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions { fn serialize(&self, serializer: S) -> Result where @@ -7888,99 +7103,32 @@ impl serde::Serialize } /// List of data features that you would like to retrieve upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { Balances, - Transactions, } -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Additional fields for Mandate creation -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - /// The method used to collect offline mandate customer acceptance. - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: - Option, -} -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptions { - pub fn new() -> Self { - Self::default() - } -} -/// The method used to collect offline mandate customer acceptance. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), _ => Err(()), } } } impl std::fmt::Display - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -7988,14 +7136,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch { fn serialize(&self, serializer: S) -> Result where @@ -8006,26 +7154,26 @@ impl serde::Serialize } /// Additional fields for network related functions #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +pub struct ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { /// Triggers validations to run across the selected networks #[serde(skip_serializing_if = "Option::is_none")] pub requested: - Option<&'a [ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested]>, + Option<&'a [ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested]>, } -impl<'a> ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworks<'a> { +impl<'a> ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworks<'a> { pub fn new() -> Self { Self::default() } } /// Triggers validations to run across the selected networks #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { Ach, UsDomesticWire, } -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -8033,10 +7181,12 @@ impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -8044,18 +7194,24 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNe } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl std::fmt::Debug + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNetworksRequested { +impl serde::Serialize + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountNetworksRequested +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8063,16 +7219,16 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountNet serializer.serialize_str(self.as_str()) } } -/// Bank account verification method. +/// Verification method for the intent #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +pub enum ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { Automatic, Instant, Microdeposits, } -impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod { pub fn as_str(self) -> &'static str { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match self { Automatic => "automatic", Instant => "instant", @@ -8081,10 +7237,12 @@ impl ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { } } -impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::str::FromStr + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ type Err = (); fn from_str(s: &str) -> Result { - use ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*; + use ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod::*; match s { "automatic" => Ok(Automatic), "instant" => Ok(Instant), @@ -8093,18 +7251,24 @@ impl std::str::FromStr for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVe } } } -impl std::fmt::Display for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Display + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl std::fmt::Debug + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod { +impl serde::Serialize + for ConfirmSetupIntentBuilderPaymentMethodOptionsUsBankAccountVerificationMethod +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -8112,35 +7276,163 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsUsBankAccountVer serializer.serialize_str(self.as_str()) } } +/// Confirm that your customer intends to set up the current or +/// provided payment method. For example, you would confirm a SetupIntent +/// when a customer hits the “Save” button on a payment method management +/// page on your website. +/// +/// If the selected payment method does not require any additional +/// steps from the customer, the SetupIntent will transition to the +/// `succeeded` status. +/// +/// Otherwise, it will transition to the `requires_action` status and +/// suggest additional actions via `next_action`. If setup fails, +/// the SetupIntent will transition to the +/// `requires_payment_method` status or the `canceled` status if the +/// confirmation limit is reached. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ConfirmSetupIntent<'a> { + inner: ConfirmSetupIntentBuilder<'a>, + intent: &'a stripe_shared::SetupIntentId, +} impl<'a> ConfirmSetupIntent<'a> { - /// Confirm that your customer intends to set up the current or - /// provided payment method. For example, you would confirm a SetupIntent - /// when a customer hits the “Save” button on a payment method management - /// page on your website. - /// - /// If the selected payment method does not require any additional - /// steps from the customer, the SetupIntent will transition to the - /// `succeeded` status. - /// - /// Otherwise, it will transition to the `requires_action` status and - /// suggest additional actions via `next_action`. If setup fails, - /// the SetupIntent will transition to the - /// `requires_payment_method` status or the `canceled` status if the - /// confirmation limit is reached. - pub fn send( + pub fn new(intent: &'a stripe_shared::SetupIntentId) -> Self { + Self { intent, inner: ConfirmSetupIntentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn mandate_data(mut self, mandate_data: ConfirmSetupIntentBuilderMandateData<'a>) -> Self { + self.inner.mandate_data = Some(mandate_data); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn payment_method_data( + mut self, + payment_method_data: ConfirmSetupIntentBuilderPaymentMethodData<'a>, + ) -> Self { + self.inner.payment_method_data = Some(payment_method_data); + self + } + + pub fn payment_method_options( + mut self, + payment_method_options: ConfirmSetupIntentBuilderPaymentMethodOptions<'a>, + ) -> Self { + self.inner.payment_method_options = Some(payment_method_options); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } + + pub fn use_stripe_sdk(mut self, use_stripe_sdk: bool) -> Self { + self.inner.use_stripe_sdk = Some(use_stripe_sdk); + self + } +} +impl ConfirmSetupIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::SetupIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/setup_intents/{intent}/confirm"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ConfirmSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/setup_intents/{intent}/confirm")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct VerifyMicrodepositsSetupIntent<'a> { +pub struct CancelSetupIntentBuilder<'a> { + /// Reason for canceling this SetupIntent. + /// Possible values are: `abandoned`, `requested_by_customer`, or `duplicate`. + #[serde(skip_serializing_if = "Option::is_none")] + pub cancellation_reason: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelSetupIntentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// You can cancel a SetupIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_confirmation`, or `requires_action`. +/// +/// +/// After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelSetupIntent<'a> { + inner: CancelSetupIntentBuilder<'a>, + intent: &'a stripe_shared::SetupIntentId, +} +impl<'a> CancelSetupIntent<'a> { + pub fn new(intent: &'a stripe_shared::SetupIntentId) -> Self { + Self { intent, inner: CancelSetupIntentBuilder::new() } + } + pub fn cancellation_reason( + mut self, + cancellation_reason: stripe_shared::SetupIntentCancellationReason, + ) -> Self { + self.inner.cancellation_reason = Some(cancellation_reason); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelSetupIntent<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new(StripeMethod::Post, format!("/setup_intents/{intent}/cancel")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct VerifyMicrodepositsSetupIntentBuilder<'a> { /// Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub amounts: Option<&'a [i64]>, @@ -8151,25 +7443,65 @@ pub struct VerifyMicrodepositsSetupIntent<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> VerifyMicrodepositsSetupIntent<'a> { +impl<'a> VerifyMicrodepositsSetupIntentBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Verifies microdeposits on a SetupIntent object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct VerifyMicrodepositsSetupIntent<'a> { + inner: VerifyMicrodepositsSetupIntentBuilder<'a>, + intent: &'a stripe_shared::SetupIntentId, +} impl<'a> VerifyMicrodepositsSetupIntent<'a> { - /// Verifies microdeposits on a SetupIntent object. - pub fn send( + pub fn new(intent: &'a stripe_shared::SetupIntentId) -> Self { + Self { intent, inner: VerifyMicrodepositsSetupIntentBuilder::new() } + } + pub fn amounts(mut self, amounts: &'a [i64]) -> Self { + self.inner.amounts = Some(amounts); + self + } + + pub fn descriptor_code(mut self, descriptor_code: &'a str) -> Self { + self.inner.descriptor_code = Some(descriptor_code); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl VerifyMicrodepositsSetupIntent<'_> { + pub async fn send( &self, - client: &stripe::Client, - intent: &stripe_shared::SetupIntentId, - ) -> stripe::Response { - client.send_form( - &format!("/setup_intents/{intent}/verify_microdeposits"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for VerifyMicrodepositsSetupIntent<'_> { + type Output = stripe_shared::SetupIntent; + + fn build(&self) -> RequestBuilder { + let intent = self.intent; + RequestBuilder::new( + StripeMethod::Post, + format!("/setup_intents/{intent}/verify_microdeposits"), ) + .form(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct OnlineParam<'a> { /// The IP address from which the Mandate was accepted by the customer. diff --git a/generated/stripe_core/src/token/requests.rs b/generated/stripe_core/src/token/requests.rs index 6271ce0f9..943d035d3 100644 --- a/generated/stripe_core/src/token/requests.rs +++ b/generated/stripe_core/src/token/requests.rs @@ -1,37 +1,70 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveToken<'a> { +pub struct RetrieveTokenBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveToken<'a> { +impl<'a> RetrieveTokenBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the token with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveToken<'a> { + inner: RetrieveTokenBuilder<'a>, + token: &'a stripe_core::TokenId, +} impl<'a> RetrieveToken<'a> { - /// Retrieves the token with the given ID. - pub fn send( + pub fn new(token: &'a stripe_core::TokenId) -> Self { + Self { token, inner: RetrieveTokenBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveToken<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - token: &stripe_core::TokenId, - ) -> stripe::Response { - client.get_query(&format!("/tokens/{token}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveToken<'_> { + type Output = stripe_core::Token; + + fn build(&self) -> RequestBuilder { + let token = self.token; + RequestBuilder::new(StripeMethod::Get, format!("/tokens/{token}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateToken<'a> { +pub struct CreateTokenBuilder<'a> { /// Information for the account this token represents. #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, + pub account: Option>, /// The bank account this token will represent. #[serde(skip_serializing_if = "Option::is_none")] - pub bank_account: Option>, + pub bank_account: Option>, /// The card this token will represent. /// If you also pass in a customer, the card must be the ID of a card belonging to the customer. /// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// Create a token for the customer, which is owned by the application's account. /// You can only use this with an [OAuth access token](https://stripe.com/docs/connect/standard-accounts) or [Stripe-Account header](https://stripe.com/docs/connect/authentication). /// Learn more about [cloning saved payment methods](https://stripe.com/docs/connect/cloning-saved-payment-methods). @@ -39,55 +72,55 @@ pub struct CreateToken<'a> { pub customer: Option<&'a str>, /// The updated CVC value this token represents. #[serde(skip_serializing_if = "Option::is_none")] - pub cvc_update: Option>, + pub cvc_update: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Information for the person this token represents. #[serde(skip_serializing_if = "Option::is_none")] - pub person: Option>, + pub person: Option>, /// The PII this token represents. #[serde(skip_serializing_if = "Option::is_none")] - pub pii: Option>, + pub pii: Option>, } -impl<'a> CreateToken<'a> { +impl<'a> CreateTokenBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Information for the account this token represents. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccount<'a> { +pub struct CreateTokenBuilderAccount<'a> { /// The business type. #[serde(skip_serializing_if = "Option::is_none")] - pub business_type: Option, + pub business_type: Option, /// Information about the company or business. #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, + pub company: Option>, /// Information about the person represented by the account. #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, + pub individual: Option>, /// Whether the user described by the data in the token has been shown [the Stripe Connected Account Agreement](https://stripe.com/docs/connect/account-tokens#stripe-connected-account-agreement). /// When creating an account token to create a new Connect account, this value must be `true`. #[serde(skip_serializing_if = "Option::is_none")] pub tos_shown_and_accepted: Option, } -impl<'a> CreateTokenAccount<'a> { +impl<'a> CreateTokenBuilderAccount<'a> { pub fn new() -> Self { Self::default() } } /// The business type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTokenAccountBusinessType { +pub enum CreateTokenBuilderAccountBusinessType { Company, GovernmentEntity, Individual, NonProfit, } -impl CreateTokenAccountBusinessType { +impl CreateTokenBuilderAccountBusinessType { pub fn as_str(self) -> &'static str { - use CreateTokenAccountBusinessType::*; + use CreateTokenBuilderAccountBusinessType::*; match self { Company => "company", GovernmentEntity => "government_entity", @@ -97,10 +130,10 @@ impl CreateTokenAccountBusinessType { } } -impl std::str::FromStr for CreateTokenAccountBusinessType { +impl std::str::FromStr for CreateTokenBuilderAccountBusinessType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTokenAccountBusinessType::*; + use CreateTokenBuilderAccountBusinessType::*; match s { "company" => Ok(Company), "government_entity" => Ok(GovernmentEntity), @@ -110,18 +143,18 @@ impl std::str::FromStr for CreateTokenAccountBusinessType { } } } -impl std::fmt::Display for CreateTokenAccountBusinessType { +impl std::fmt::Display for CreateTokenBuilderAccountBusinessType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTokenAccountBusinessType { +impl std::fmt::Debug for CreateTokenBuilderAccountBusinessType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTokenAccountBusinessType { +impl serde::Serialize for CreateTokenBuilderAccountBusinessType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -131,16 +164,16 @@ impl serde::Serialize for CreateTokenAccountBusinessType { } /// Information about the company or business. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompany<'a> { +pub struct CreateTokenBuilderAccountCompany<'a> { /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// Whether the company's directors have been provided. /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. @@ -171,7 +204,7 @@ pub struct CreateTokenAccountCompany<'a> { pub owners_provided: Option, /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. #[serde(skip_serializing_if = "Option::is_none")] - pub ownership_declaration: Option>, + pub ownership_declaration: Option>, /// Whether the user described by the data in the token has been shown the Ownership Declaration and indicated that it is correct. #[serde(skip_serializing_if = "Option::is_none")] pub ownership_declaration_shown_and_signed: Option, @@ -184,9 +217,8 @@ pub struct CreateTokenAccountCompany<'a> { pub registration_number: Option<&'a str>, /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. - /// Pass an empty string to unset this value. #[serde(skip_serializing_if = "Option::is_none")] - pub structure: Option, + pub structure: Option, /// The business ID number of the company, as appropriate for the company’s country. /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). #[serde(skip_serializing_if = "Option::is_none")] @@ -199,16 +231,16 @@ pub struct CreateTokenAccountCompany<'a> { pub vat_id: Option<&'a str>, /// Information on the verification state of the company. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub verification: Option>, } -impl<'a> CreateTokenAccountCompany<'a> { +impl<'a> CreateTokenBuilderAccountCompany<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyAddressKana<'a> { +pub struct CreateTokenBuilderAccountCompanyAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -231,14 +263,14 @@ pub struct CreateTokenAccountCompanyAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenAccountCompanyAddressKana<'a> { +impl<'a> CreateTokenBuilderAccountCompanyAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyAddressKanji<'a> { +pub struct CreateTokenBuilderAccountCompanyAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -261,14 +293,14 @@ pub struct CreateTokenAccountCompanyAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenAccountCompanyAddressKanji<'a> { +impl<'a> CreateTokenBuilderAccountCompanyAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyOwnershipDeclaration<'a> { +pub struct CreateTokenBuilderAccountCompanyOwnershipDeclaration<'a> { /// The Unix timestamp marking when the beneficial owner attestation was made. #[serde(skip_serializing_if = "Option::is_none")] pub date: Option, @@ -279,17 +311,16 @@ pub struct CreateTokenAccountCompanyOwnershipDeclaration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> CreateTokenAccountCompanyOwnershipDeclaration<'a> { +impl<'a> CreateTokenBuilderAccountCompanyOwnershipDeclaration<'a> { pub fn new() -> Self { Self::default() } } /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. -/// Pass an empty string to unset this value. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateTokenAccountCompanyStructure { +pub enum CreateTokenBuilderAccountCompanyStructure { FreeZoneEstablishment, FreeZoneLlc, GovernmentInstrumentality, @@ -305,7 +336,6 @@ pub enum CreateTokenAccountCompanyStructure { PublicCompany, PublicCorporation, PublicPartnership, - RegisteredCharity, SingleMemberLlc, SoleEstablishment, SoleProprietorship, @@ -316,9 +346,9 @@ pub enum CreateTokenAccountCompanyStructure { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateTokenAccountCompanyStructure { +impl CreateTokenBuilderAccountCompanyStructure { pub fn as_str(self) -> &'static str { - use CreateTokenAccountCompanyStructure::*; + use CreateTokenBuilderAccountCompanyStructure::*; match self { FreeZoneEstablishment => "free_zone_establishment", FreeZoneLlc => "free_zone_llc", @@ -335,7 +365,6 @@ impl CreateTokenAccountCompanyStructure { PublicCompany => "public_company", PublicCorporation => "public_corporation", PublicPartnership => "public_partnership", - RegisteredCharity => "registered_charity", SingleMemberLlc => "single_member_llc", SoleEstablishment => "sole_establishment", SoleProprietorship => "sole_proprietorship", @@ -348,10 +377,10 @@ impl CreateTokenAccountCompanyStructure { } } -impl std::str::FromStr for CreateTokenAccountCompanyStructure { +impl std::str::FromStr for CreateTokenBuilderAccountCompanyStructure { type Err = (); fn from_str(s: &str) -> Result { - use CreateTokenAccountCompanyStructure::*; + use CreateTokenBuilderAccountCompanyStructure::*; match s { "free_zone_establishment" => Ok(FreeZoneEstablishment), "free_zone_llc" => Ok(FreeZoneLlc), @@ -368,7 +397,6 @@ impl std::str::FromStr for CreateTokenAccountCompanyStructure { "public_company" => Ok(PublicCompany), "public_corporation" => Ok(PublicCorporation), "public_partnership" => Ok(PublicPartnership), - "registered_charity" => Ok(RegisteredCharity), "single_member_llc" => Ok(SingleMemberLlc), "sole_establishment" => Ok(SoleEstablishment), "sole_proprietorship" => Ok(SoleProprietorship), @@ -380,18 +408,18 @@ impl std::str::FromStr for CreateTokenAccountCompanyStructure { } } } -impl std::fmt::Display for CreateTokenAccountCompanyStructure { +impl std::fmt::Display for CreateTokenBuilderAccountCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTokenAccountCompanyStructure { +impl std::fmt::Debug for CreateTokenBuilderAccountCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTokenAccountCompanyStructure { +impl serde::Serialize for CreateTokenBuilderAccountCompanyStructure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -401,19 +429,19 @@ impl serde::Serialize for CreateTokenAccountCompanyStructure { } /// Information on the verification state of the company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyVerification<'a> { +pub struct CreateTokenBuilderAccountCompanyVerification<'a> { /// A document verifying the business. #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, + pub document: Option>, } -impl<'a> CreateTokenAccountCompanyVerification<'a> { +impl<'a> CreateTokenBuilderAccountCompanyVerification<'a> { pub fn new() -> Self { Self::default() } } /// A document verifying the business. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyVerificationDocument<'a> { +pub struct CreateTokenBuilderAccountCompanyVerificationDocument<'a> { /// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] @@ -423,23 +451,23 @@ pub struct CreateTokenAccountCompanyVerificationDocument<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub front: Option<&'a str>, } -impl<'a> CreateTokenAccountCompanyVerificationDocument<'a> { +impl<'a> CreateTokenBuilderAccountCompanyVerificationDocument<'a> { pub fn new() -> Self { Self::default() } } /// Information about the person represented by the account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividual<'a> { +pub struct CreateTokenBuilderAccountIndividual<'a> { /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, @@ -494,13 +522,10 @@ pub struct CreateTokenAccountIndividual<'a> { pub phone: Option<&'a str>, /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[serde(skip_serializing_if = "Option::is_none")] - pub political_exposure: Option, + pub political_exposure: Option, /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] pub registered_address: Option>, - /// Describes the person’s relationship to the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, @@ -508,14 +533,14 @@ pub struct CreateTokenAccountIndividual<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> CreateTokenAccountIndividual<'a> { +impl<'a> CreateTokenBuilderAccountIndividual<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualAddressKana<'a> { +pub struct CreateTokenBuilderAccountIndividualAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -538,14 +563,14 @@ pub struct CreateTokenAccountIndividualAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenAccountIndividualAddressKana<'a> { +impl<'a> CreateTokenBuilderAccountIndividualAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualAddressKanji<'a> { +pub struct CreateTokenBuilderAccountIndividualAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -568,20 +593,20 @@ pub struct CreateTokenAccountIndividualAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenAccountIndividualAddressKanji<'a> { +impl<'a> CreateTokenBuilderAccountIndividualAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTokenAccountIndividualPoliticalExposure { +pub enum CreateTokenBuilderAccountIndividualPoliticalExposure { Existing, None, } -impl CreateTokenAccountIndividualPoliticalExposure { +impl CreateTokenBuilderAccountIndividualPoliticalExposure { pub fn as_str(self) -> &'static str { - use CreateTokenAccountIndividualPoliticalExposure::*; + use CreateTokenBuilderAccountIndividualPoliticalExposure::*; match self { Existing => "existing", None => "none", @@ -589,10 +614,10 @@ impl CreateTokenAccountIndividualPoliticalExposure { } } -impl std::str::FromStr for CreateTokenAccountIndividualPoliticalExposure { +impl std::str::FromStr for CreateTokenBuilderAccountIndividualPoliticalExposure { type Err = (); fn from_str(s: &str) -> Result { - use CreateTokenAccountIndividualPoliticalExposure::*; + use CreateTokenBuilderAccountIndividualPoliticalExposure::*; match s { "existing" => Ok(Existing), "none" => Ok(None), @@ -600,18 +625,18 @@ impl std::str::FromStr for CreateTokenAccountIndividualPoliticalExposure { } } } -impl std::fmt::Display for CreateTokenAccountIndividualPoliticalExposure { +impl std::fmt::Display for CreateTokenBuilderAccountIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTokenAccountIndividualPoliticalExposure { +impl std::fmt::Debug for CreateTokenBuilderAccountIndividualPoliticalExposure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTokenAccountIndividualPoliticalExposure { +impl serde::Serialize for CreateTokenBuilderAccountIndividualPoliticalExposure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -619,34 +644,9 @@ impl serde::Serialize for CreateTokenAccountIndividualPoliticalExposure { serializer.serialize_str(self.as_str()) } } -/// Describes the person’s relationship to the account. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualRelationship<'a> { - /// Whether the person is a director of the account's legal entity. - /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. - #[serde(skip_serializing_if = "Option::is_none")] - pub director: Option, - /// Whether the person has significant responsibility to control, manage, or direct the organization. - #[serde(skip_serializing_if = "Option::is_none")] - pub executive: Option, - /// Whether the person is an owner of the account’s legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// The percent owned by the person of the account's legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub percent_ownership: Option, - /// The person's title (e.g., CEO, Support Engineer). - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option<&'a str>, -} -impl<'a> CreateTokenAccountIndividualRelationship<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The bank account this token will represent. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTokenBankAccount<'a> { +pub struct CreateTokenBuilderBankAccount<'a> { /// The name of the person or business that owns the bank account.This field is required when attaching the bank account to a `Customer` object. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, @@ -654,14 +654,14 @@ pub struct CreateTokenBankAccount<'a> { /// It can be `company` or `individual`. /// This field is required when attaching the bank account to a `Customer` object. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// The account number for the bank account, in string form. Must be a checking account. pub account_number: &'a str, /// 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, + pub account_type: Option, /// The country in which the bank account is located. pub country: &'a str, /// The currency the bank account is in. @@ -674,7 +674,7 @@ pub struct CreateTokenBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreateTokenBankAccount<'a> { +impl<'a> CreateTokenBuilderBankAccount<'a> { pub fn new(account_number: &'a str, country: &'a str) -> Self { Self { account_holder_name: None, @@ -691,13 +691,13 @@ impl<'a> CreateTokenBankAccount<'a> { /// It can be `company` or `individual`. /// This field is required when attaching the bank account to a `Customer` object. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTokenBankAccountAccountHolderType { +pub enum CreateTokenBuilderBankAccountAccountHolderType { Company, Individual, } -impl CreateTokenBankAccountAccountHolderType { +impl CreateTokenBuilderBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use CreateTokenBankAccountAccountHolderType::*; + use CreateTokenBuilderBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -705,10 +705,10 @@ impl CreateTokenBankAccountAccountHolderType { } } -impl std::str::FromStr for CreateTokenBankAccountAccountHolderType { +impl std::str::FromStr for CreateTokenBuilderBankAccountAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTokenBankAccountAccountHolderType::*; + use CreateTokenBuilderBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -716,18 +716,18 @@ impl std::str::FromStr for CreateTokenBankAccountAccountHolderType { } } } -impl std::fmt::Display for CreateTokenBankAccountAccountHolderType { +impl std::fmt::Display for CreateTokenBuilderBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTokenBankAccountAccountHolderType { +impl std::fmt::Debug for CreateTokenBuilderBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTokenBankAccountAccountHolderType { +impl serde::Serialize for CreateTokenBuilderBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -739,15 +739,15 @@ impl serde::Serialize for CreateTokenBankAccountAccountHolderType { /// This can only be `checking` or `savings` in most countries. /// In Japan, this can only be `futsu` or `toza`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTokenBankAccountAccountType { +pub enum CreateTokenBuilderBankAccountAccountType { Checking, Futsu, Savings, Toza, } -impl CreateTokenBankAccountAccountType { +impl CreateTokenBuilderBankAccountAccountType { pub fn as_str(self) -> &'static str { - use CreateTokenBankAccountAccountType::*; + use CreateTokenBuilderBankAccountAccountType::*; match self { Checking => "checking", Futsu => "futsu", @@ -757,10 +757,10 @@ impl CreateTokenBankAccountAccountType { } } -impl std::str::FromStr for CreateTokenBankAccountAccountType { +impl std::str::FromStr for CreateTokenBuilderBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTokenBankAccountAccountType::*; + use CreateTokenBuilderBankAccountAccountType::*; match s { "checking" => Ok(Checking), "futsu" => Ok(Futsu), @@ -770,18 +770,18 @@ impl std::str::FromStr for CreateTokenBankAccountAccountType { } } } -impl std::fmt::Display for CreateTokenBankAccountAccountType { +impl std::fmt::Display for CreateTokenBuilderBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTokenBankAccountAccountType { +impl std::fmt::Debug for CreateTokenBuilderBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTokenBankAccountAccountType { +impl serde::Serialize for CreateTokenBuilderBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -794,15 +794,15 @@ impl serde::Serialize for CreateTokenBankAccountAccountType { /// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateTokenCard<'a> { - CreditCardSpecs(CreateTokenCreditCardSpecs<'a>), +pub enum CreateTokenBuilderCard<'a> { + CreditCardSpecs(CreateTokenBuilderCreditCardSpecs<'a>), Str(&'a str), } /// The card this token will represent. /// If you also pass in a customer, the card must be the ID of a card belonging to the customer. /// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTokenCreditCardSpecs<'a> { +pub struct CreateTokenBuilderCreditCardSpecs<'a> { /// City / District / Suburb / Town / Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -838,7 +838,7 @@ pub struct CreateTokenCreditCardSpecs<'a> { /// The card number, as a string without any separators. pub number: &'a str, } -impl<'a> CreateTokenCreditCardSpecs<'a> { +impl<'a> CreateTokenBuilderCreditCardSpecs<'a> { pub fn new(exp_month: &'a str, exp_year: &'a str, number: &'a str) -> Self { Self { address_city: None, @@ -858,36 +858,36 @@ impl<'a> CreateTokenCreditCardSpecs<'a> { } /// The updated CVC value this token represents. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTokenCvcUpdate<'a> { +pub struct CreateTokenBuilderCvcUpdate<'a> { /// The CVC value, in string form. pub cvc: &'a str, } -impl<'a> CreateTokenCvcUpdate<'a> { +impl<'a> CreateTokenBuilderCvcUpdate<'a> { pub fn new(cvc: &'a str) -> Self { Self { cvc } } } /// Information for the person this token represents. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPerson<'a> { +pub struct CreateTokenBuilderPerson<'a> { /// Details on the legal guardian's acceptance of the required Stripe agreements. #[serde(skip_serializing_if = "Option::is_none")] - pub additional_tos_acceptances: Option>, + pub additional_tos_acceptances: Option>, /// The person's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, + pub documents: Option>, /// The person's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -949,7 +949,7 @@ pub struct CreateTokenPerson<'a> { pub registered_address: Option>, /// The relationship that this person has with the account's legal entity. #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, + pub relationship: Option>, /// The last four digits of the person's Social Security number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, @@ -957,26 +957,26 @@ pub struct CreateTokenPerson<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification: Option>, } -impl<'a> CreateTokenPerson<'a> { +impl<'a> CreateTokenBuilderPerson<'a> { pub fn new() -> Self { Self::default() } } /// Details on the legal guardian's acceptance of the required Stripe agreements. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonAdditionalTosAcceptances<'a> { +pub struct CreateTokenBuilderPersonAdditionalTosAcceptances<'a> { /// Details on the legal guardian's acceptance of the main Stripe service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, + pub account: Option>, } -impl<'a> CreateTokenPersonAdditionalTosAcceptances<'a> { +impl<'a> CreateTokenBuilderPersonAdditionalTosAcceptances<'a> { pub fn new() -> Self { Self::default() } } /// Details on the legal guardian's acceptance of the main Stripe service agreement. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonAdditionalTosAcceptancesAccount<'a> { +pub struct CreateTokenBuilderPersonAdditionalTosAcceptancesAccount<'a> { /// The Unix timestamp marking when the account representative accepted the service agreement. #[serde(skip_serializing_if = "Option::is_none")] pub date: Option, @@ -987,14 +987,14 @@ pub struct CreateTokenPersonAdditionalTosAcceptancesAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> CreateTokenPersonAdditionalTosAcceptancesAccount<'a> { +impl<'a> CreateTokenBuilderPersonAdditionalTosAcceptancesAccount<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonAddressKana<'a> { +pub struct CreateTokenBuilderPersonAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1017,14 +1017,14 @@ pub struct CreateTokenPersonAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenPersonAddressKana<'a> { +impl<'a> CreateTokenBuilderPersonAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonAddressKanji<'a> { +pub struct CreateTokenBuilderPersonAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1047,14 +1047,14 @@ pub struct CreateTokenPersonAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> CreateTokenPersonAddressKanji<'a> { +impl<'a> CreateTokenBuilderPersonAddressKanji<'a> { pub fn new() -> Self { Self::default() } } /// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonDocuments<'a> { +pub struct CreateTokenBuilderPersonDocuments<'a> { /// One or more documents that demonstrate proof that this person is authorized to represent the company. #[serde(skip_serializing_if = "Option::is_none")] pub company_authorization: Option>, @@ -1065,14 +1065,14 @@ pub struct CreateTokenPersonDocuments<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub visa: Option>, } -impl<'a> CreateTokenPersonDocuments<'a> { +impl<'a> CreateTokenBuilderPersonDocuments<'a> { pub fn new() -> Self { Self::default() } } /// The relationship that this person has with the account's legal entity. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonRelationship<'a> { +pub struct CreateTokenBuilderPersonRelationship<'a> { /// Whether the person is a director of the account's legal entity. /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. #[serde(skip_serializing_if = "Option::is_none")] @@ -1099,32 +1099,99 @@ pub struct CreateTokenPersonRelationship<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub title: Option<&'a str>, } -impl<'a> CreateTokenPersonRelationship<'a> { +impl<'a> CreateTokenBuilderPersonRelationship<'a> { pub fn new() -> Self { Self::default() } } /// The PII this token represents. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPii<'a> { +pub struct CreateTokenBuilderPii<'a> { /// The `id_number` for the PII, in string form. #[serde(skip_serializing_if = "Option::is_none")] pub id_number: Option<&'a str>, } -impl<'a> CreateTokenPii<'a> { +impl<'a> CreateTokenBuilderPii<'a> { pub fn new() -> Self { Self::default() } } +/// Creates a single-use token that represents a bank account’s details. +/// You can use this token with any API method in place of a bank account dictionary. +/// You can only use this token once. +/// To do so, attach it to a [Custom account](https://stripe.com/docs/api#accounts). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateToken<'a> { + inner: CreateTokenBuilder<'a>, +} impl<'a> CreateToken<'a> { - /// Creates a single-use token that represents a bank account’s details. - /// You can use this token with any API method in place of a bank account dictionary. - /// You can only use this token once. - /// To do so, attach it to a [Custom account](https://stripe.com/docs/api#accounts). - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tokens", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateTokenBuilder::new() } + } + pub fn account(mut self, account: CreateTokenBuilderAccount<'a>) -> Self { + self.inner.account = Some(account); + self + } + + pub fn bank_account(mut self, bank_account: CreateTokenBuilderBankAccount<'a>) -> Self { + self.inner.bank_account = Some(bank_account); + self + } + + pub fn card(mut self, card: CreateTokenBuilderCard<'a>) -> Self { + self.inner.card = Some(card); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn cvc_update(mut self, cvc_update: CreateTokenBuilderCvcUpdate<'a>) -> Self { + self.inner.cvc_update = Some(cvc_update); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn person(mut self, person: CreateTokenBuilderPerson<'a>) -> Self { + self.inner.person = Some(person); + self + } + + pub fn pii(mut self, pii: CreateTokenBuilderPii<'a>) -> Self { + self.inner.pii = Some(pii); + self } } +impl CreateToken<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateToken<'_> { + type Output = stripe_core::Token; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tokens").form(&self.inner) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct AddressSpecs<'a> { /// City, district, suburb, town, or village. diff --git a/generated/stripe_fraud/Cargo.toml b/generated/stripe_fraud/Cargo.toml index 98787509d..97b9c6fb5 100644 --- a/generated/stripe_fraud/Cargo.toml +++ b/generated/stripe_fraud/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - radar_early_fraud_warning = [] radar_value_list = [] radar_value_list_item = [] @@ -48,5 +37,5 @@ full = ["radar_early_fraud_warning", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_fraud/src/radar_early_fraud_warning/requests.rs b/generated/stripe_fraud/src/radar_early_fraud_warning/requests.rs index c98fb6961..fe520d712 100644 --- a/generated/stripe_fraud/src/radar_early_fraud_warning/requests.rs +++ b/generated/stripe_fraud/src/radar_early_fraud_warning/requests.rs @@ -1,11 +1,12 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListRadarEarlyFraudWarning<'a> { +pub struct ListRadarEarlyFraudWarningBuilder<'a> { /// Only return early fraud warnings for the charge specified by this charge ID. #[serde(skip_serializing_if = "Option::is_none")] pub charge: Option<&'a str>, - /// Only return early fraud warnings that were created during the given date interval. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -27,45 +28,126 @@ pub struct ListRadarEarlyFraudWarning<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListRadarEarlyFraudWarning<'a> { +impl<'a> ListRadarEarlyFraudWarningBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of early fraud warnings. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListRadarEarlyFraudWarning<'a> { + inner: ListRadarEarlyFraudWarningBuilder<'a>, +} impl<'a> ListRadarEarlyFraudWarning<'a> { - /// Returns a list of early fraud warnings. - pub fn send( + pub fn new() -> Self { + Self { inner: ListRadarEarlyFraudWarningBuilder::new() } + } + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListRadarEarlyFraudWarning<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/radar/early_fraud_warnings", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/radar/early_fraud_warnings", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListRadarEarlyFraudWarning<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/radar/early_fraud_warnings").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveRadarEarlyFraudWarning<'a> { +pub struct RetrieveRadarEarlyFraudWarningBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveRadarEarlyFraudWarning<'a> { +impl<'a> RetrieveRadarEarlyFraudWarningBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an early fraud warning that has previously been created. +/// +/// Please refer to the [early fraud warning](https://stripe.com/docs/api#early_fraud_warning_object) object reference for more details. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveRadarEarlyFraudWarning<'a> { + inner: RetrieveRadarEarlyFraudWarningBuilder<'a>, + early_fraud_warning: &'a stripe_fraud::RadarEarlyFraudWarningId, +} impl<'a> RetrieveRadarEarlyFraudWarning<'a> { - /// Retrieves the details of an early fraud warning that has previously been created. - /// - /// Please refer to the [early fraud warning](https://stripe.com/docs/api#early_fraud_warning_object) object reference for more details. - pub fn send( + pub fn new(early_fraud_warning: &'a stripe_fraud::RadarEarlyFraudWarningId) -> Self { + Self { early_fraud_warning, inner: RetrieveRadarEarlyFraudWarningBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveRadarEarlyFraudWarning<'_> { + pub async fn send( &self, - client: &stripe::Client, - early_fraud_warning: &stripe_fraud::RadarEarlyFraudWarningId, - ) -> stripe::Response { - client.get_query(&format!("/radar/early_fraud_warnings/{early_fraud_warning}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveRadarEarlyFraudWarning<'_> { + type Output = stripe_fraud::RadarEarlyFraudWarning; + + fn build(&self) -> RequestBuilder { + let early_fraud_warning = self.early_fraud_warning; + RequestBuilder::new( + StripeMethod::Get, + format!("/radar/early_fraud_warnings/{early_fraud_warning}"), + ) + .query(&self.inner) } } diff --git a/generated/stripe_fraud/src/radar_value_list/requests.rs b/generated/stripe_fraud/src/radar_value_list/requests.rs index a6655f0d3..05774e737 100644 --- a/generated/stripe_fraud/src/radar_value_list/requests.rs +++ b/generated/stripe_fraud/src/radar_value_list/requests.rs @@ -1,27 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteRadarValueList {} -impl DeleteRadarValueList { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteRadarValueList { - /// Deletes a `ValueList` object, also deleting any items contained within the value list. - /// To be deleted, a value list must not be referenced in any rules. - pub fn send( - &self, - client: &stripe::Client, - value_list: &stripe_fraud::RadarValueListId, - ) -> stripe::Response { - client.send_form( - &format!("/radar/value_lists/{value_list}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListRadarValueList<'a> { +pub struct ListRadarValueListBuilder<'a> { /// The alias used to reference the value list when writing rules. #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option<&'a str>, @@ -48,49 +30,132 @@ pub struct ListRadarValueList<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListRadarValueList<'a> { +impl<'a> ListRadarValueListBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of `ValueList` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListRadarValueList<'a> { + inner: ListRadarValueListBuilder<'a>, +} impl<'a> ListRadarValueList<'a> { - /// Returns a list of `ValueList` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListRadarValueListBuilder::new() } + } + pub fn alias(mut self, alias: &'a str) -> Self { + self.inner.alias = Some(alias); + self + } + + pub fn contains(mut self, contains: &'a str) -> Self { + self.inner.contains = Some(contains); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListRadarValueList<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/radar/value_lists", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/radar/value_lists", self) +} + +impl StripeRequest for ListRadarValueList<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/radar/value_lists").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveRadarValueList<'a> { +pub struct RetrieveRadarValueListBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveRadarValueList<'a> { +impl<'a> RetrieveRadarValueListBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a `ValueList` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveRadarValueList<'a> { + inner: RetrieveRadarValueListBuilder<'a>, + value_list: &'a stripe_fraud::RadarValueListId, +} impl<'a> RetrieveRadarValueList<'a> { - /// Retrieves a `ValueList` object. - pub fn send( + pub fn new(value_list: &'a stripe_fraud::RadarValueListId) -> Self { + Self { value_list, inner: RetrieveRadarValueListBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveRadarValueList<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - value_list: &stripe_fraud::RadarValueListId, - ) -> stripe::Response { - client.get_query(&format!("/radar/value_lists/{value_list}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveRadarValueList<'_> { + type Output = stripe_fraud::RadarValueList; + + fn build(&self) -> RequestBuilder { + let value_list = self.value_list; + RequestBuilder::new(StripeMethod::Get, format!("/radar/value_lists/{value_list}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateRadarValueList<'a> { +pub struct CreateRadarValueListBuilder<'a> { /// The name of the value list for use in rules. pub alias: &'a str, /// Specifies which fields in the response should be expanded. @@ -110,19 +175,60 @@ pub struct CreateRadarValueList<'a> { /// The human-readable name of the value list. pub name: &'a str, } -impl<'a> CreateRadarValueList<'a> { +impl<'a> CreateRadarValueListBuilder<'a> { pub fn new(alias: &'a str, name: &'a str) -> Self { Self { alias, expand: None, item_type: None, metadata: None, name } } } +/// Creates a new `ValueList` object, which can then be referenced in rules. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateRadarValueList<'a> { + inner: CreateRadarValueListBuilder<'a>, +} impl<'a> CreateRadarValueList<'a> { - /// Creates a new `ValueList` object, which can then be referenced in rules. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/radar/value_lists", self, http_types::Method::Post) + pub fn new(alias: &'a str, name: &'a str) -> Self { + Self { inner: CreateRadarValueListBuilder::new(alias, name) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn item_type(mut self, item_type: stripe_fraud::RadarValueListItemType) -> Self { + self.inner.item_type = Some(item_type); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateRadarValueList<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateRadarValueList<'_> { + type Output = stripe_fraud::RadarValueList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/radar/value_lists").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateRadarValueList<'a> { +pub struct UpdateRadarValueListBuilder<'a> { /// The name of the value list for use in rules. #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option<&'a str>, @@ -139,24 +245,100 @@ pub struct UpdateRadarValueList<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, } -impl<'a> UpdateRadarValueList<'a> { +impl<'a> UpdateRadarValueListBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates a `ValueList` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// Note that `item_type` is immutable. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateRadarValueList<'a> { + inner: UpdateRadarValueListBuilder<'a>, + value_list: &'a stripe_fraud::RadarValueListId, +} impl<'a> UpdateRadarValueList<'a> { - /// Updates a `ValueList` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// Note that `item_type` is immutable. - pub fn send( + pub fn new(value_list: &'a stripe_fraud::RadarValueListId) -> Self { + Self { value_list, inner: UpdateRadarValueListBuilder::new() } + } + pub fn alias(mut self, alias: &'a str) -> Self { + self.inner.alias = Some(alias); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl UpdateRadarValueList<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateRadarValueList<'_> { + type Output = stripe_fraud::RadarValueList; + + fn build(&self) -> RequestBuilder { + let value_list = self.value_list; + RequestBuilder::new(StripeMethod::Post, format!("/radar/value_lists/{value_list}")) + .form(&self.inner) + } +} +/// Deletes a `ValueList` object, also deleting any items contained within the value list. +/// To be deleted, a value list must not be referenced in any rules. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteRadarValueList<'a> { + value_list: &'a stripe_fraud::RadarValueListId, +} +impl<'a> DeleteRadarValueList<'a> { + pub fn new(value_list: &'a stripe_fraud::RadarValueListId) -> Self { + Self { value_list } + } +} +impl DeleteRadarValueList<'_> { + pub async fn send( &self, - client: &stripe::Client, - value_list: &stripe_fraud::RadarValueListId, - ) -> stripe::Response { - client.send_form( - &format!("/radar/value_lists/{value_list}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteRadarValueList<'_> { + type Output = stripe_fraud::DeletedRadarValueList; + + fn build(&self) -> RequestBuilder { + let value_list = self.value_list; + RequestBuilder::new(StripeMethod::Delete, format!("/radar/value_lists/{value_list}")) } } diff --git a/generated/stripe_fraud/src/radar_value_list_item/requests.rs b/generated/stripe_fraud/src/radar_value_list_item/requests.rs index d422febbb..820bdfb5f 100644 --- a/generated/stripe_fraud/src/radar_value_list_item/requests.rs +++ b/generated/stripe_fraud/src/radar_value_list_item/requests.rs @@ -1,26 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteRadarValueListItem {} -impl DeleteRadarValueListItem { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteRadarValueListItem { - /// Deletes a `ValueListItem` object, removing it from its parent value list. - pub fn send( - &self, - client: &stripe::Client, - item: &stripe_fraud::RadarValueListItemId, - ) -> stripe::Response { - client.send_form( - &format!("/radar/value_list_items/{item}"), - self, - http_types::Method::Delete, - ) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListRadarValueListItem<'a> { +pub struct ListRadarValueListItemBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A cursor for use in pagination. @@ -46,7 +29,7 @@ pub struct ListRadarValueListItem<'a> { /// Identifier for the parent value list this item belongs to. pub value_list: &'a str, } -impl<'a> ListRadarValueListItem<'a> { +impl<'a> ListRadarValueListItemBuilder<'a> { pub fn new(value_list: &'a str) -> Self { Self { created: None, @@ -59,44 +42,122 @@ impl<'a> ListRadarValueListItem<'a> { } } } +/// Returns a list of `ValueListItem` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListRadarValueListItem<'a> { + inner: ListRadarValueListItemBuilder<'a>, +} impl<'a> ListRadarValueListItem<'a> { - /// Returns a list of `ValueListItem` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( + pub fn new(value_list: &'a str) -> Self { + Self { inner: ListRadarValueListItemBuilder::new(value_list) } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn value(mut self, value: &'a str) -> Self { + self.inner.value = Some(value); + self + } +} +impl ListRadarValueListItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/radar/value_list_items", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/radar/value_list_items", self) +} + +impl StripeRequest for ListRadarValueListItem<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/radar/value_list_items").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveRadarValueListItem<'a> { +pub struct RetrieveRadarValueListItemBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveRadarValueListItem<'a> { +impl<'a> RetrieveRadarValueListItemBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a `ValueListItem` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveRadarValueListItem<'a> { + inner: RetrieveRadarValueListItemBuilder<'a>, + item: &'a stripe_fraud::RadarValueListItemId, +} impl<'a> RetrieveRadarValueListItem<'a> { - /// Retrieves a `ValueListItem` object. - pub fn send( + pub fn new(item: &'a stripe_fraud::RadarValueListItemId) -> Self { + Self { item, inner: RetrieveRadarValueListItemBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveRadarValueListItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - item: &stripe_fraud::RadarValueListItemId, - ) -> stripe::Response { - client.get_query(&format!("/radar/value_list_items/{item}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveRadarValueListItem<'_> { + type Output = stripe_fraud::RadarValueListItem; + + fn build(&self) -> RequestBuilder { + let item = self.item; + RequestBuilder::new(StripeMethod::Get, format!("/radar/value_list_items/{item}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateRadarValueListItem<'a> { +pub struct CreateRadarValueListItemBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -105,17 +166,79 @@ pub struct CreateRadarValueListItem<'a> { /// The identifier of the value list which the created item will be added to. pub value_list: &'a str, } -impl<'a> CreateRadarValueListItem<'a> { +impl<'a> CreateRadarValueListItemBuilder<'a> { pub fn new(value: &'a str, value_list: &'a str) -> Self { Self { expand: None, value, value_list } } } +/// Creates a new `ValueListItem` object, which is added to the specified parent value list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateRadarValueListItem<'a> { + inner: CreateRadarValueListItemBuilder<'a>, +} impl<'a> CreateRadarValueListItem<'a> { - /// Creates a new `ValueListItem` object, which is added to the specified parent value list. - pub fn send( + pub fn new(value: &'a str, value_list: &'a str) -> Self { + Self { inner: CreateRadarValueListItemBuilder::new(value, value_list) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreateRadarValueListItem<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/radar/value_list_items", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateRadarValueListItem<'_> { + type Output = stripe_fraud::RadarValueListItem; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/radar/value_list_items").form(&self.inner) + } +} +/// Deletes a `ValueListItem` object, removing it from its parent value list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteRadarValueListItem<'a> { + item: &'a stripe_fraud::RadarValueListItemId, +} +impl<'a> DeleteRadarValueListItem<'a> { + pub fn new(item: &'a stripe_fraud::RadarValueListItemId) -> Self { + Self { item } + } +} +impl DeleteRadarValueListItem<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteRadarValueListItem<'_> { + type Output = stripe_fraud::DeletedRadarValueListItem; + + fn build(&self) -> RequestBuilder { + let item = self.item; + RequestBuilder::new(StripeMethod::Delete, format!("/radar/value_list_items/{item}")) } } diff --git a/generated/stripe_fraud/src/review/requests.rs b/generated/stripe_fraud/src/review/requests.rs index 310572897..11ee60189 100644 --- a/generated/stripe_fraud/src/review/requests.rs +++ b/generated/stripe_fraud/src/review/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListReview<'a> { +pub struct ListReviewBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A cursor for use in pagination. @@ -20,63 +24,167 @@ pub struct ListReview<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListReview<'a> { +impl<'a> ListReviewBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of `Review` objects that have `open` set to `true`. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListReview<'a> { + inner: ListReviewBuilder<'a>, +} impl<'a> ListReview<'a> { - /// Returns a list of `Review` objects that have `open` set to `true`. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListReviewBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListReview<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/reviews", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/reviews", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListReview<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/reviews").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveReview<'a> { +pub struct RetrieveReviewBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveReview<'a> { +impl<'a> RetrieveReviewBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a `Review` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveReview<'a> { + inner: RetrieveReviewBuilder<'a>, + review: &'a stripe_shared::ReviewId, +} impl<'a> RetrieveReview<'a> { - /// Retrieves a `Review` object. - pub fn send( + pub fn new(review: &'a stripe_shared::ReviewId) -> Self { + Self { review, inner: RetrieveReviewBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveReview<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - review: &stripe_shared::ReviewId, - ) -> stripe::Response { - client.get_query(&format!("/reviews/{review}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveReview<'_> { + type Output = stripe_shared::Review; + + fn build(&self) -> RequestBuilder { + let review = self.review; + RequestBuilder::new(StripeMethod::Get, format!("/reviews/{review}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ApproveReview<'a> { +pub struct ApproveReviewBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ApproveReview<'a> { +impl<'a> ApproveReviewBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Approves a `Review` object, closing it and removing it from the list of reviews. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ApproveReview<'a> { + inner: ApproveReviewBuilder<'a>, + review: &'a stripe_shared::ReviewId, +} impl<'a> ApproveReview<'a> { - /// Approves a `Review` object, closing it and removing it from the list of reviews. - pub fn send( + pub fn new(review: &'a stripe_shared::ReviewId) -> Self { + Self { review, inner: ApproveReviewBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ApproveReview<'_> { + pub async fn send( &self, - client: &stripe::Client, - review: &stripe_shared::ReviewId, - ) -> stripe::Response { - client.send_form(&format!("/reviews/{review}/approve"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ApproveReview<'_> { + type Output = stripe_shared::Review; + + fn build(&self) -> RequestBuilder { + let review = self.review; + RequestBuilder::new(StripeMethod::Post, format!("/reviews/{review}/approve")) + .form(&self.inner) } } diff --git a/generated/stripe_issuing/Cargo.toml b/generated/stripe_issuing/Cargo.toml index 30e00b043..bd18ab637 100644 --- a/generated/stripe_issuing/Cargo.toml +++ b/generated/stripe_issuing/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - issuing_authorization = [] issuing_card = [] issuing_cardholder = [] @@ -52,5 +41,5 @@ full = ["issuing_authorization", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_issuing/src/issuing_authorization/requests.rs b/generated/stripe_issuing/src/issuing_authorization/requests.rs index 8e7337656..9aaa5c7a5 100644 --- a/generated/stripe_issuing/src/issuing_authorization/requests.rs +++ b/generated/stripe_issuing/src/issuing_authorization/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIssuingAuthorization<'a> { +pub struct ListIssuingAuthorizationBuilder<'a> { /// Only return authorizations that belong to the given card. #[serde(skip_serializing_if = "Option::is_none")] pub card: Option<&'a str>, @@ -30,49 +34,137 @@ pub struct ListIssuingAuthorization<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListIssuingAuthorization<'a> { +impl<'a> ListIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Issuing `Authorization` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingAuthorization<'a> { + inner: ListIssuingAuthorizationBuilder<'a>, +} impl<'a> ListIssuingAuthorization<'a> { - /// Returns a list of Issuing `Authorization` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListIssuingAuthorizationBuilder::new() } + } + pub fn card(mut self, card: &'a str) -> Self { + self.inner.card = Some(card); + self + } + + pub fn cardholder(mut self, cardholder: &'a str) -> Self { + self.inner.cardholder = Some(cardholder); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingAuthorizationStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListIssuingAuthorization<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/authorizations", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/authorizations", self) +} + +impl StripeRequest for ListIssuingAuthorization<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/authorizations").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingAuthorization<'a> { +pub struct RetrieveIssuingAuthorizationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveIssuingAuthorization<'a> { +impl<'a> RetrieveIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves an Issuing `Authorization` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingAuthorization<'a> { + inner: RetrieveIssuingAuthorizationBuilder<'a>, + authorization: &'a stripe_shared::IssuingAuthorizationId, +} impl<'a> RetrieveIssuingAuthorization<'a> { - /// Retrieves an Issuing `Authorization` object. - pub fn send( + pub fn new(authorization: &'a stripe_shared::IssuingAuthorizationId) -> Self { + Self { authorization, inner: RetrieveIssuingAuthorizationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingAuthorization<'_> { + pub async fn send( &self, - client: &stripe::Client, - authorization: &stripe_shared::IssuingAuthorizationId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/authorizations/{authorization}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/authorizations/{authorization}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingAuthorization<'a> { +pub struct UpdateIssuingAuthorizationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -83,28 +175,59 @@ pub struct UpdateIssuingAuthorization<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateIssuingAuthorization<'a> { +impl<'a> UpdateIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified Issuing `Authorization` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingAuthorization<'a> { + inner: UpdateIssuingAuthorizationBuilder<'a>, + authorization: &'a stripe_shared::IssuingAuthorizationId, +} impl<'a> UpdateIssuingAuthorization<'a> { - /// Updates the specified Issuing `Authorization` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(authorization: &'a stripe_shared::IssuingAuthorizationId) -> Self { + Self { authorization, inner: UpdateIssuingAuthorizationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateIssuingAuthorization<'_> { + pub async fn send( &self, - client: &stripe::Client, - authorization: &stripe_shared::IssuingAuthorizationId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/authorizations/{authorization}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/authorizations/{authorization}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ApproveIssuingAuthorization<'a> { +pub struct ApproveIssuingAuthorizationBuilder<'a> { /// If the authorization's `pending_request.is_amount_controllable` property is `true`, you may provide this value to control how much to hold for the authorization. /// Must be positive (use [`decline`](https://stripe.com/docs/api/issuing/authorizations/decline) to decline an authorization request). #[serde(skip_serializing_if = "Option::is_none")] @@ -119,31 +242,70 @@ pub struct ApproveIssuingAuthorization<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> ApproveIssuingAuthorization<'a> { +impl<'a> ApproveIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// \[Deprecated\] Approves a pending Issuing `Authorization` object. +/// This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. +/// +/// This method is deprecated. +/// Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling). +#[derive(Clone, Debug, serde::Serialize)] +pub struct ApproveIssuingAuthorization<'a> { + inner: ApproveIssuingAuthorizationBuilder<'a>, + authorization: &'a stripe_shared::IssuingAuthorizationId, +} impl<'a> ApproveIssuingAuthorization<'a> { - /// \[Deprecated\] Approves a pending Issuing `Authorization` object. - /// This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. - /// - /// This method is deprecated. - /// Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling). - pub fn send( + pub fn new(authorization: &'a stripe_shared::IssuingAuthorizationId) -> Self { + Self { authorization, inner: ApproveIssuingAuthorizationBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl ApproveIssuingAuthorization<'_> { + pub async fn send( &self, - client: &stripe::Client, - authorization: &stripe_shared::IssuingAuthorizationId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/authorizations/{authorization}/approve"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ApproveIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/issuing/authorizations/{authorization}/approve"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeclineIssuingAuthorization<'a> { +pub struct DeclineIssuingAuthorizationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -154,37 +316,71 @@ pub struct DeclineIssuingAuthorization<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> DeclineIssuingAuthorization<'a> { +impl<'a> DeclineIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// \[Deprecated\] Declines a pending Issuing `Authorization` object. +/// This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. +/// This method is deprecated. +/// Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling). +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeclineIssuingAuthorization<'a> { + inner: DeclineIssuingAuthorizationBuilder<'a>, + authorization: &'a stripe_shared::IssuingAuthorizationId, +} impl<'a> DeclineIssuingAuthorization<'a> { - /// \[Deprecated\] Declines a pending Issuing `Authorization` object. - /// This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. - /// This method is deprecated. - /// Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling). - pub fn send( + pub fn new(authorization: &'a stripe_shared::IssuingAuthorizationId) -> Self { + Self { authorization, inner: DeclineIssuingAuthorizationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl DeclineIssuingAuthorization<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - authorization: &stripe_shared::IssuingAuthorizationId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/authorizations/{authorization}/decline"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeclineIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/issuing/authorizations/{authorization}/decline"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingAuthorization<'a> { +pub struct CreateIssuingAuthorizationBuilder<'a> { /// The total amount to attempt to authorize. - /// This amount is in the provided currency, or defaults to the card's currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// This amount is in the provided currency, or defaults to the cards currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). pub amount: i64, /// Detailed breakdown of amount components. /// These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). #[serde(skip_serializing_if = "Option::is_none")] - pub amount_details: Option, + pub amount_details: Option, /// How the card details were provided. Defaults to online. #[serde(skip_serializing_if = "Option::is_none")] pub authorization_method: Option, @@ -204,20 +400,20 @@ pub struct CreateIssuingAuthorization<'a> { pub is_amount_controllable: Option, /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[serde(skip_serializing_if = "Option::is_none")] - pub merchant_data: Option>, + pub merchant_data: Option>, /// Details about the authorization, such as identifiers, set by the card network. #[serde(skip_serializing_if = "Option::is_none")] - pub network_data: Option>, + pub network_data: Option>, /// Verifications that Stripe performed on information that the cardholder provided to the merchant. #[serde(skip_serializing_if = "Option::is_none")] - pub verification_data: Option, + pub verification_data: Option, /// The digital wallet used for this transaction. /// One of `apple_pay`, `google_pay`, or `samsung_pay`. /// Will populate as `null` when no digital wallet was utilized. #[serde(skip_serializing_if = "Option::is_none")] - pub wallet: Option, + pub wallet: Option, } -impl<'a> CreateIssuingAuthorization<'a> { +impl<'a> CreateIssuingAuthorizationBuilder<'a> { pub fn new(amount: i64, card: &'a str) -> Self { Self { amount, @@ -237,7 +433,7 @@ impl<'a> CreateIssuingAuthorization<'a> { /// Detailed breakdown of amount components. /// These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingAuthorizationAmountDetails { +pub struct CreateIssuingAuthorizationBuilderAmountDetails { /// The ATM withdrawal fee. #[serde(skip_serializing_if = "Option::is_none")] pub atm_fee: Option, @@ -245,18 +441,18 @@ pub struct CreateIssuingAuthorizationAmountDetails { #[serde(skip_serializing_if = "Option::is_none")] pub cashback_amount: Option, } -impl CreateIssuingAuthorizationAmountDetails { +impl CreateIssuingAuthorizationBuilderAmountDetails { pub fn new() -> Self { Self::default() } } /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingAuthorizationMerchantData<'a> { +pub struct CreateIssuingAuthorizationBuilderMerchantData<'a> { /// A categorization of the seller's type of business. /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[serde(skip_serializing_if = "Option::is_none")] - pub category: Option, + pub category: Option, /// City where the seller is located #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -283,7 +479,7 @@ pub struct CreateIssuingAuthorizationMerchantData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> CreateIssuingAuthorizationMerchantData<'a> { +impl<'a> CreateIssuingAuthorizationBuilderMerchantData<'a> { pub fn new() -> Self { Self::default() } @@ -292,7 +488,7 @@ impl<'a> CreateIssuingAuthorizationMerchantData<'a> { /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingAuthorizationMerchantDataCategory { +pub enum CreateIssuingAuthorizationBuilderMerchantDataCategory { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -590,9 +786,9 @@ pub enum CreateIssuingAuthorizationMerchantDataCategory { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingAuthorizationMerchantDataCategory { +impl CreateIssuingAuthorizationBuilderMerchantDataCategory { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationMerchantDataCategory::*; + use CreateIssuingAuthorizationBuilderMerchantDataCategory::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -937,10 +1133,10 @@ impl CreateIssuingAuthorizationMerchantDataCategory { } } -impl std::str::FromStr for CreateIssuingAuthorizationMerchantDataCategory { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderMerchantDataCategory { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationMerchantDataCategory::*; + use CreateIssuingAuthorizationBuilderMerchantDataCategory::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -1288,18 +1484,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationMerchantDataCategory { } } } -impl std::fmt::Display for CreateIssuingAuthorizationMerchantDataCategory { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationMerchantDataCategory { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationMerchantDataCategory { +impl serde::Serialize for CreateIssuingAuthorizationBuilderMerchantDataCategory { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1309,55 +1505,56 @@ impl serde::Serialize for CreateIssuingAuthorizationMerchantDataCategory { } /// Details about the authorization, such as identifiers, set by the card network. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingAuthorizationNetworkData<'a> { +pub struct CreateIssuingAuthorizationBuilderNetworkData<'a> { /// Identifier assigned to the acquirer by the card network. #[serde(skip_serializing_if = "Option::is_none")] pub acquiring_institution_id: Option<&'a str>, } -impl<'a> CreateIssuingAuthorizationNetworkData<'a> { +impl<'a> CreateIssuingAuthorizationBuilderNetworkData<'a> { pub fn new() -> Self { Self::default() } } /// Verifications that Stripe performed on information that the cardholder provided to the merchant. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingAuthorizationVerificationData { +pub struct CreateIssuingAuthorizationBuilderVerificationData { /// Whether the cardholder provided an address first line and if it matched the cardholder’s `billing.address.line1`. #[serde(skip_serializing_if = "Option::is_none")] - pub address_line1_check: Option, + pub address_line1_check: + Option, /// Whether the cardholder provided a postal code and if it matched the cardholder’s `billing.address.postal_code`. #[serde(skip_serializing_if = "Option::is_none")] pub address_postal_code_check: - Option, + Option, /// The exemption applied to this authorization. #[serde(skip_serializing_if = "Option::is_none")] pub authentication_exemption: - Option, + Option, /// Whether the cardholder provided a CVC and if it matched Stripe’s record. #[serde(skip_serializing_if = "Option::is_none")] - pub cvc_check: Option, + pub cvc_check: Option, /// Whether the cardholder provided an expiry date and if it matched Stripe’s record. #[serde(skip_serializing_if = "Option::is_none")] - pub expiry_check: Option, + pub expiry_check: Option, /// 3D Secure details. #[serde(skip_serializing_if = "Option::is_none")] - pub three_d_secure: Option, + pub three_d_secure: Option, } -impl CreateIssuingAuthorizationVerificationData { +impl CreateIssuingAuthorizationBuilderVerificationData { pub fn new() -> Self { Self::default() } } /// Whether the cardholder provided an address first line and if it matched the cardholder’s `billing.address.line1`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataAddressLine1Check { +pub enum CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { Match, Mismatch, NotProvided, } -impl CreateIssuingAuthorizationVerificationDataAddressLine1Check { +impl CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataAddressLine1Check::*; + use CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check::*; match self { Match => "match", Mismatch => "mismatch", @@ -1366,10 +1563,10 @@ impl CreateIssuingAuthorizationVerificationDataAddressLine1Check { } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataAddressLine1Check { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataAddressLine1Check::*; + use CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check::*; match s { "match" => Ok(Match), "mismatch" => Ok(Mismatch), @@ -1378,18 +1575,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataAddressLine } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataAddressLine1Check { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataAddressLine1Check { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAddressLine1Check { +impl serde::Serialize for CreateIssuingAuthorizationBuilderVerificationDataAddressLine1Check { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1399,14 +1596,14 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAddressLine1 } /// Whether the cardholder provided a postal code and if it matched the cardholder’s `billing.address.postal_code`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +pub enum CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { Match, Mismatch, NotProvided, } -impl CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +impl CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck::*; match self { Match => "match", Mismatch => "mismatch", @@ -1415,10 +1612,10 @@ impl CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck::*; match s { "match" => Ok(Match), "mismatch" => Ok(Mismatch), @@ -1427,18 +1624,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataAddressPost } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAddressPostalCodeCheck { +impl serde::Serialize for CreateIssuingAuthorizationBuilderVerificationDataAddressPostalCodeCheck { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1448,30 +1645,31 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAddressPosta } /// The exemption applied to this authorization. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingAuthorizationVerificationDataAuthenticationExemption { +pub struct CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemption { /// The entity that requested the exemption, either the acquiring merchant or the Issuing user. - pub claimed_by: CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy, + pub claimed_by: + CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy, /// The specific exemption claimed for this authorization. #[serde(rename = "type")] - pub type_: CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType, + pub type_: CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType, } -impl CreateIssuingAuthorizationVerificationDataAuthenticationExemption { +impl CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemption { pub fn new( - claimed_by: CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy, - type_: CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType, + claimed_by: CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy, + type_: CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType, ) -> Self { Self { claimed_by, type_ } } } /// The entity that requested the exemption, either the acquiring merchant or the Issuing user. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy { +pub enum CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { Acquirer, Issuer, } -impl CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy { +impl CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy::*; + use CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy::*; match self { Acquirer => "acquirer", Issuer => "issuer", @@ -1480,11 +1678,11 @@ impl CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy } impl std::str::FromStr - for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy::*; + use CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy::*; match s { "acquirer" => Ok(Acquirer), "issuer" => Ok(Issuer), @@ -1493,7 +1691,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1501,14 +1699,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionClaimedBy + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionClaimedBy { fn serialize(&self, serializer: S) -> Result where @@ -1519,46 +1717,51 @@ impl serde::Serialize } /// The specific exemption claimed for this authorization. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +pub enum CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType { LowValueTransaction, TransactionRiskAnalysis, - Unknown, } -impl CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +impl CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType::*; + use CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType::*; match self { LowValueTransaction => "low_value_transaction", TransactionRiskAnalysis => "transaction_risk_analysis", - Unknown => "unknown", } } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +impl std::str::FromStr + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType::*; + use CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType::*; match s { "low_value_transaction" => Ok(LowValueTransaction), "transaction_risk_analysis" => Ok(TransactionRiskAnalysis), - "unknown" => Ok(Unknown), _ => Err(()), } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +impl std::fmt::Display + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +impl std::fmt::Debug + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAuthenticationExemptionType { +impl serde::Serialize + for CreateIssuingAuthorizationBuilderVerificationDataAuthenticationExemptionType +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1568,14 +1771,14 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataAuthenticati } /// Whether the cardholder provided a CVC and if it matched Stripe’s record. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataCvcCheck { +pub enum CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { Match, Mismatch, NotProvided, } -impl CreateIssuingAuthorizationVerificationDataCvcCheck { +impl CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataCvcCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataCvcCheck::*; match self { Match => "match", Mismatch => "mismatch", @@ -1584,10 +1787,10 @@ impl CreateIssuingAuthorizationVerificationDataCvcCheck { } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataCvcCheck { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataCvcCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataCvcCheck::*; match s { "match" => Ok(Match), "mismatch" => Ok(Mismatch), @@ -1596,18 +1799,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataCvcCheck { } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataCvcCheck { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataCvcCheck { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataCvcCheck { +impl serde::Serialize for CreateIssuingAuthorizationBuilderVerificationDataCvcCheck { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1617,14 +1820,14 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataCvcCheck { } /// Whether the cardholder provided an expiry date and if it matched Stripe’s record. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataExpiryCheck { +pub enum CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { Match, Mismatch, NotProvided, } -impl CreateIssuingAuthorizationVerificationDataExpiryCheck { +impl CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataExpiryCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck::*; match self { Match => "match", Mismatch => "mismatch", @@ -1633,10 +1836,10 @@ impl CreateIssuingAuthorizationVerificationDataExpiryCheck { } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataExpiryCheck { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataExpiryCheck::*; + use CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck::*; match s { "match" => Ok(Match), "mismatch" => Ok(Mismatch), @@ -1645,18 +1848,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataExpiryCheck } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataExpiryCheck { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataExpiryCheck { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataExpiryCheck { +impl serde::Serialize for CreateIssuingAuthorizationBuilderVerificationDataExpiryCheck { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1666,26 +1869,28 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataExpiryCheck } /// 3D Secure details. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingAuthorizationVerificationDataThreeDSecure { +pub struct CreateIssuingAuthorizationBuilderVerificationDataThreeDSecure { /// The outcome of the 3D Secure authentication request. - pub result: CreateIssuingAuthorizationVerificationDataThreeDSecureResult, + pub result: CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult, } -impl CreateIssuingAuthorizationVerificationDataThreeDSecure { - pub fn new(result: CreateIssuingAuthorizationVerificationDataThreeDSecureResult) -> Self { +impl CreateIssuingAuthorizationBuilderVerificationDataThreeDSecure { + pub fn new( + result: CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult, + ) -> Self { Self { result } } } /// The outcome of the 3D Secure authentication request. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +pub enum CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { AttemptAcknowledged, Authenticated, Failed, Required, } -impl CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +impl CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationVerificationDataThreeDSecureResult::*; + use CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult::*; match self { AttemptAcknowledged => "attempt_acknowledged", Authenticated => "authenticated", @@ -1695,10 +1900,10 @@ impl CreateIssuingAuthorizationVerificationDataThreeDSecureResult { } } -impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationVerificationDataThreeDSecureResult::*; + use CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult::*; match s { "attempt_acknowledged" => Ok(AttemptAcknowledged), "authenticated" => Ok(Authenticated), @@ -1708,18 +1913,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationVerificationDataThreeDSecur } } } -impl std::fmt::Display for CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationVerificationDataThreeDSecureResult { +impl serde::Serialize for CreateIssuingAuthorizationBuilderVerificationDataThreeDSecureResult { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1731,14 +1936,14 @@ impl serde::Serialize for CreateIssuingAuthorizationVerificationDataThreeDSecure /// One of `apple_pay`, `google_pay`, or `samsung_pay`. /// Will populate as `null` when no digital wallet was utilized. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationWallet { +pub enum CreateIssuingAuthorizationBuilderWallet { ApplePay, GooglePay, SamsungPay, } -impl CreateIssuingAuthorizationWallet { +impl CreateIssuingAuthorizationBuilderWallet { pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationWallet::*; + use CreateIssuingAuthorizationBuilderWallet::*; match self { ApplePay => "apple_pay", GooglePay => "google_pay", @@ -1747,10 +1952,10 @@ impl CreateIssuingAuthorizationWallet { } } -impl std::str::FromStr for CreateIssuingAuthorizationWallet { +impl std::str::FromStr for CreateIssuingAuthorizationBuilderWallet { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationWallet::*; + use CreateIssuingAuthorizationBuilderWallet::*; match s { "apple_pay" => Ok(ApplePay), "google_pay" => Ok(GooglePay), @@ -1759,18 +1964,18 @@ impl std::str::FromStr for CreateIssuingAuthorizationWallet { } } } -impl std::fmt::Display for CreateIssuingAuthorizationWallet { +impl std::fmt::Display for CreateIssuingAuthorizationBuilderWallet { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingAuthorizationWallet { +impl std::fmt::Debug for CreateIssuingAuthorizationBuilderWallet { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingAuthorizationWallet { +impl serde::Serialize for CreateIssuingAuthorizationBuilderWallet { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1778,17 +1983,284 @@ impl serde::Serialize for CreateIssuingAuthorizationWallet { serializer.serialize_str(self.as_str()) } } +/// Create a test-mode authorization. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIssuingAuthorization<'a> { + inner: CreateIssuingAuthorizationBuilder<'a>, +} impl<'a> CreateIssuingAuthorization<'a> { - /// Create a test-mode authorization. - pub fn send( + pub fn new(amount: i64, card: &'a str) -> Self { + Self { inner: CreateIssuingAuthorizationBuilder::new(amount, card) } + } + pub fn amount_details( + mut self, + amount_details: CreateIssuingAuthorizationBuilderAmountDetails, + ) -> Self { + self.inner.amount_details = Some(amount_details); + self + } + + pub fn authorization_method( + mut self, + authorization_method: stripe_shared::IssuingAuthorizationAuthorizationMethod, + ) -> Self { + self.inner.authorization_method = Some(authorization_method); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn is_amount_controllable(mut self, is_amount_controllable: bool) -> Self { + self.inner.is_amount_controllable = Some(is_amount_controllable); + self + } + + pub fn merchant_data( + mut self, + merchant_data: CreateIssuingAuthorizationBuilderMerchantData<'a>, + ) -> Self { + self.inner.merchant_data = Some(merchant_data); + self + } + + pub fn network_data( + mut self, + network_data: CreateIssuingAuthorizationBuilderNetworkData<'a>, + ) -> Self { + self.inner.network_data = Some(network_data); + self + } + + pub fn verification_data( + mut self, + verification_data: CreateIssuingAuthorizationBuilderVerificationData, + ) -> Self { + self.inner.verification_data = Some(verification_data); + self + } + + pub fn wallet(mut self, wallet: CreateIssuingAuthorizationBuilderWallet) -> Self { + self.inner.wallet = Some(wallet); + self + } +} +impl CreateIssuingAuthorization<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/test_helpers/issuing/authorizations", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/test_helpers/issuing/authorizations") + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct IncrementIssuingAuthorizationBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// The amount to increment the authorization by. + /// This amount is in the authorization currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + pub increment_amount: i64, + /// If set `true`, you may provide [amount](https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_amount_controllable: Option, +} +impl<'a> IncrementIssuingAuthorizationBuilder<'a> { + pub fn new(increment_amount: i64) -> Self { + Self { expand: None, increment_amount, is_amount_controllable: None } + } +} +/// Increment a test-mode Authorization. +#[derive(Clone, Debug, serde::Serialize)] +pub struct IncrementIssuingAuthorization<'a> { + inner: IncrementIssuingAuthorizationBuilder<'a>, + authorization: &'a str, +} +impl<'a> IncrementIssuingAuthorization<'a> { + pub fn new(authorization: &'a str, increment_amount: i64) -> Self { + Self { authorization, inner: IncrementIssuingAuthorizationBuilder::new(increment_amount) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn is_amount_controllable(mut self, is_amount_controllable: bool) -> Self { + self.inner.is_amount_controllable = Some(is_amount_controllable); + self + } +} +impl IncrementIssuingAuthorization<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for IncrementIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/authorizations/{authorization}/increment"), + ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorization<'a> { +pub struct ReverseIssuingAuthorizationBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// The amount to reverse from the authorization. + /// If not provided, the full amount of the authorization will be reversed. + /// This amount is in the authorization currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + #[serde(skip_serializing_if = "Option::is_none")] + pub reverse_amount: Option, +} +impl<'a> ReverseIssuingAuthorizationBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Reverse a test-mode Authorization. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReverseIssuingAuthorization<'a> { + inner: ReverseIssuingAuthorizationBuilder<'a>, + authorization: &'a str, +} +impl<'a> ReverseIssuingAuthorization<'a> { + pub fn new(authorization: &'a str) -> Self { + Self { authorization, inner: ReverseIssuingAuthorizationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn reverse_amount(mut self, reverse_amount: i64) -> Self { + self.inner.reverse_amount = Some(reverse_amount); + self + } +} +impl ReverseIssuingAuthorization<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ReverseIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/authorizations/{authorization}/reverse"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ExpireIssuingAuthorizationBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> ExpireIssuingAuthorizationBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Expire a test-mode Authorization. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ExpireIssuingAuthorization<'a> { + inner: ExpireIssuingAuthorizationBuilder<'a>, + authorization: &'a str, +} +impl<'a> ExpireIssuingAuthorization<'a> { + pub fn new(authorization: &'a str) -> Self { + Self { authorization, inner: ExpireIssuingAuthorizationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ExpireIssuingAuthorization<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ExpireIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/authorizations/{authorization}/expire"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CaptureIssuingAuthorizationBuilder<'a> { /// The amount to capture from the authorization. /// If not provided, the full amount of the authorization will be captured. /// This amount is in the authorization currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -1804,40 +2276,40 @@ pub struct CaptureIssuingAuthorization<'a> { pub expand: Option<&'a [&'a str]>, /// Additional purchase information that is optionally provided by the merchant. #[serde(skip_serializing_if = "Option::is_none")] - pub purchase_details: Option>, + pub purchase_details: Option>, } -impl<'a> CaptureIssuingAuthorization<'a> { +impl<'a> CaptureIssuingAuthorizationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Additional purchase information that is optionally provided by the merchant. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetails<'a> { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetails<'a> { /// Information about the flight that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub flight: Option>, + pub flight: Option>, /// Information about fuel that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub fuel: Option>, + pub fuel: Option>, /// Information about lodging that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub lodging: Option, + pub lodging: Option, /// The line items in the purchase. #[serde(skip_serializing_if = "Option::is_none")] - pub receipt: Option<&'a [CaptureIssuingAuthorizationPurchaseDetailsReceipt<'a>]>, + pub receipt: Option<&'a [CaptureIssuingAuthorizationBuilderPurchaseDetailsReceipt<'a>]>, /// A merchant-specific order number. #[serde(skip_serializing_if = "Option::is_none")] pub reference: Option<&'a str>, } -impl<'a> CaptureIssuingAuthorizationPurchaseDetails<'a> { +impl<'a> CaptureIssuingAuthorizationBuilderPurchaseDetails<'a> { pub fn new() -> Self { Self::default() } } /// Information about the flight that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetailsFlight<'a> { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetailsFlight<'a> { /// The time that the flight departed. #[serde(skip_serializing_if = "Option::is_none")] pub departure_at: Option, @@ -1849,19 +2321,19 @@ pub struct CaptureIssuingAuthorizationPurchaseDetailsFlight<'a> { pub refundable: Option, /// The legs of the trip. #[serde(skip_serializing_if = "Option::is_none")] - pub segments: Option<&'a [CaptureIssuingAuthorizationPurchaseDetailsFlightSegments<'a>]>, + pub segments: Option<&'a [CaptureIssuingAuthorizationBuilderPurchaseDetailsFlightSegments<'a>]>, /// The travel agency that issued the ticket. #[serde(skip_serializing_if = "Option::is_none")] pub travel_agency: Option<&'a str>, } -impl<'a> CaptureIssuingAuthorizationPurchaseDetailsFlight<'a> { +impl<'a> CaptureIssuingAuthorizationBuilderPurchaseDetailsFlight<'a> { pub fn new() -> Self { Self::default() } } /// The legs of the trip. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetailsFlightSegments<'a> { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetailsFlightSegments<'a> { /// The three-letter IATA airport code of the flight's destination. #[serde(skip_serializing_if = "Option::is_none")] pub arrival_airport_code: Option<&'a str>, @@ -1881,22 +2353,22 @@ pub struct CaptureIssuingAuthorizationPurchaseDetailsFlightSegments<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub stopover_allowed: Option, } -impl<'a> CaptureIssuingAuthorizationPurchaseDetailsFlightSegments<'a> { +impl<'a> CaptureIssuingAuthorizationBuilderPurchaseDetailsFlightSegments<'a> { pub fn new() -> Self { Self::default() } } /// Information about fuel that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetailsFuel<'a> { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[serde(skip_serializing_if = "Option::is_none")] - pub unit: Option, + pub unit: Option, /// The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. #[serde(skip_serializing_if = "Option::is_none")] pub unit_cost_decimal: Option<&'a str>, @@ -1904,7 +2376,7 @@ pub struct CaptureIssuingAuthorizationPurchaseDetailsFuel<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub volume_decimal: Option<&'a str>, } -impl<'a> CaptureIssuingAuthorizationPurchaseDetailsFuel<'a> { +impl<'a> CaptureIssuingAuthorizationBuilderPurchaseDetailsFuel<'a> { pub fn new() -> Self { Self::default() } @@ -1912,16 +2384,16 @@ impl<'a> CaptureIssuingAuthorizationPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CaptureIssuingAuthorizationPurchaseDetailsFuelType { +pub enum CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { Diesel, Other, UnleadedPlus, UnleadedRegular, UnleadedSuper, } -impl CaptureIssuingAuthorizationPurchaseDetailsFuelType { +impl CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { pub fn as_str(self) -> &'static str { - use CaptureIssuingAuthorizationPurchaseDetailsFuelType::*; + use CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType::*; match self { Diesel => "diesel", Other => "other", @@ -1932,10 +2404,10 @@ impl CaptureIssuingAuthorizationPurchaseDetailsFuelType { } } -impl std::str::FromStr for CaptureIssuingAuthorizationPurchaseDetailsFuelType { +impl std::str::FromStr for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { type Err = (); fn from_str(s: &str) -> Result { - use CaptureIssuingAuthorizationPurchaseDetailsFuelType::*; + use CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType::*; match s { "diesel" => Ok(Diesel), "other" => Ok(Other), @@ -1946,18 +2418,18 @@ impl std::str::FromStr for CaptureIssuingAuthorizationPurchaseDetailsFuelType { } } } -impl std::fmt::Display for CaptureIssuingAuthorizationPurchaseDetailsFuelType { +impl std::fmt::Display for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CaptureIssuingAuthorizationPurchaseDetailsFuelType { +impl std::fmt::Debug for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CaptureIssuingAuthorizationPurchaseDetailsFuelType { +impl serde::Serialize for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1967,13 +2439,13 @@ impl serde::Serialize for CaptureIssuingAuthorizationPurchaseDetailsFuelType { } /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +pub enum CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { Liter, UsGallon, } -impl CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +impl CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { pub fn as_str(self) -> &'static str { - use CaptureIssuingAuthorizationPurchaseDetailsFuelUnit::*; + use CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit::*; match self { Liter => "liter", UsGallon => "us_gallon", @@ -1981,10 +2453,10 @@ impl CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { } } -impl std::str::FromStr for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +impl std::str::FromStr for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { type Err = (); fn from_str(s: &str) -> Result { - use CaptureIssuingAuthorizationPurchaseDetailsFuelUnit::*; + use CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit::*; match s { "liter" => Ok(Liter), "us_gallon" => Ok(UsGallon), @@ -1992,18 +2464,18 @@ impl std::str::FromStr for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { } } } -impl std::fmt::Display for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +impl std::fmt::Display for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +impl std::fmt::Debug for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { +impl serde::Serialize for CaptureIssuingAuthorizationBuilderPurchaseDetailsFuelUnit { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2013,7 +2485,7 @@ impl serde::Serialize for CaptureIssuingAuthorizationPurchaseDetailsFuelUnit { } /// Information about lodging that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetailsLodging { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetailsLodging { /// The time of checking into the lodging. #[serde(skip_serializing_if = "Option::is_none")] pub check_in_at: Option, @@ -2021,14 +2493,14 @@ pub struct CaptureIssuingAuthorizationPurchaseDetailsLodging { #[serde(skip_serializing_if = "Option::is_none")] pub nights: Option, } -impl CaptureIssuingAuthorizationPurchaseDetailsLodging { +impl CaptureIssuingAuthorizationBuilderPurchaseDetailsLodging { pub fn new() -> Self { Self::default() } } /// The line items in the purchase. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CaptureIssuingAuthorizationPurchaseDetailsReceipt<'a> { +pub struct CaptureIssuingAuthorizationBuilderPurchaseDetailsReceipt<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] @@ -2038,108 +2510,69 @@ pub struct CaptureIssuingAuthorizationPurchaseDetailsReceipt<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_cost: Option, } -impl<'a> CaptureIssuingAuthorizationPurchaseDetailsReceipt<'a> { +impl<'a> CaptureIssuingAuthorizationBuilderPurchaseDetailsReceipt<'a> { pub fn new() -> Self { Self::default() } } +/// Capture a test-mode authorization. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CaptureIssuingAuthorization<'a> { + inner: CaptureIssuingAuthorizationBuilder<'a>, + authorization: &'a str, +} impl<'a> CaptureIssuingAuthorization<'a> { - /// Capture a test-mode authorization. - pub fn send( - &self, - client: &stripe::Client, - authorization: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/authorizations/{authorization}/capture"), - self, - http_types::Method::Post, - ) + pub fn new(authorization: &'a str) -> Self { + Self { authorization, inner: CaptureIssuingAuthorizationBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ExpireIssuingAuthorization<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> ExpireIssuingAuthorization<'a> { - pub fn new() -> Self { - Self::default() + pub fn capture_amount(mut self, capture_amount: i64) -> Self { + self.inner.capture_amount = Some(capture_amount); + self } -} -impl<'a> ExpireIssuingAuthorization<'a> { - /// Expire a test-mode Authorization. - pub fn send( - &self, - client: &stripe::Client, - authorization: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/authorizations/{authorization}/expire"), - self, - http_types::Method::Post, - ) + + pub fn close_authorization(mut self, close_authorization: bool) -> Self { + self.inner.close_authorization = Some(close_authorization); + self } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct IncrementIssuingAuthorization<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The amount to increment the authorization by. - /// This amount is in the authorization currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - pub increment_amount: i64, - /// If set `true`, you may provide [amount](https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_amount_controllable: Option, -} -impl<'a> IncrementIssuingAuthorization<'a> { - pub fn new(increment_amount: i64) -> Self { - Self { expand: None, increment_amount, is_amount_controllable: None } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn purchase_details( + mut self, + purchase_details: CaptureIssuingAuthorizationBuilderPurchaseDetails<'a>, + ) -> Self { + self.inner.purchase_details = Some(purchase_details); + self } } -impl<'a> IncrementIssuingAuthorization<'a> { - /// Increment a test-mode Authorization. - pub fn send( +impl CaptureIssuingAuthorization<'_> { + pub async fn send( &self, - client: &stripe::Client, - authorization: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/authorizations/{authorization}/increment"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReverseIssuingAuthorization<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The amount to reverse from the authorization. - /// If not provided, the full amount of the authorization will be reversed. - /// This amount is in the authorization currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - #[serde(skip_serializing_if = "Option::is_none")] - pub reverse_amount: Option, -} -impl<'a> ReverseIssuingAuthorization<'a> { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> ReverseIssuingAuthorization<'a> { - /// Reverse a test-mode Authorization. - pub fn send( - &self, - client: &stripe::Client, - authorization: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/authorizations/{authorization}/reverse"), - self, - http_types::Method::Post, + +impl StripeRequest for CaptureIssuingAuthorization<'_> { + type Output = stripe_shared::IssuingAuthorization; + + fn build(&self) -> RequestBuilder { + let authorization = self.authorization; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/authorizations/{authorization}/capture"), ) + .form(&self.inner) } } diff --git a/generated/stripe_issuing/src/issuing_card/requests.rs b/generated/stripe_issuing/src/issuing_card/requests.rs index fc21ffa15..8219e2d72 100644 --- a/generated/stripe_issuing/src/issuing_card/requests.rs +++ b/generated/stripe_issuing/src/issuing_card/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIssuingCard<'a> { +pub struct ListIssuingCardBuilder<'a> { /// Only return cards belonging to the Cardholder with the provided ID. #[serde(skip_serializing_if = "Option::is_none")] pub cardholder: Option<&'a str>, @@ -40,47 +44,101 @@ pub struct ListIssuingCard<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> ListIssuingCard<'a> { +impl<'a> ListIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Issuing `Card` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingCard<'a> { + inner: ListIssuingCardBuilder<'a>, +} impl<'a> ListIssuingCard<'a> { - /// Returns a list of Issuing `Card` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/cards", self) + pub fn new() -> Self { + Self { inner: ListIssuingCardBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/cards", self) + pub fn cardholder(mut self, cardholder: &'a str) -> Self { + self.inner.cardholder = Some(cardholder); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingCard<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIssuingCard<'a> { - pub fn new() -> Self { - Self::default() + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn exp_month(mut self, exp_month: i64) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: i64) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn last4(mut self, last4: &'a str) -> Self { + self.inner.last4 = Some(last4); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingCardStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn type_(mut self, type_: stripe_shared::IssuingCardType) -> Self { + self.inner.type_ = Some(type_); + self } } -impl<'a> RetrieveIssuingCard<'a> { - /// Retrieves an Issuing `Card` object. - pub fn send( +impl ListIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - card: &stripe_shared::IssuingCardId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/cards/{card}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIssuingCard<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/cards").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCard<'a> { +pub struct CreateIssuingCardBuilder<'a> { /// The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) object with which the card will be associated. #[serde(skip_serializing_if = "Option::is_none")] pub cardholder: Option<&'a str>, @@ -97,9 +155,6 @@ pub struct CreateIssuingCard<'a> { /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, - /// The desired PIN for this card. - #[serde(skip_serializing_if = "Option::is_none")] - pub pin: Option>, /// The card this is meant to be a replacement for (if any). #[serde(skip_serializing_if = "Option::is_none")] pub replacement_for: Option<&'a str>, @@ -108,21 +163,21 @@ pub struct CreateIssuingCard<'a> { pub replacement_reason: Option, /// The address where the card will be shipped. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// Rules that control spending for this card. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_controls: Option>, + pub spending_controls: Option>, /// Whether authorizations can be approved on this card. /// May be blocked from activating cards depending on past-due Cardholder requirements. /// Defaults to `inactive`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// The type of card to issue. Possible values are `physical` or `virtual`. #[serde(rename = "type")] pub type_: stripe_shared::IssuingCardType, } -impl<'a> CreateIssuingCard<'a> { +impl<'a> CreateIssuingCardBuilder<'a> { pub fn new(currency: stripe_types::Currency, type_: stripe_shared::IssuingCardType) -> Self { Self { cardholder: None, @@ -130,7 +185,6 @@ impl<'a> CreateIssuingCard<'a> { expand: None, financial_account: None, metadata: None, - pin: None, replacement_for: None, replacement_reason: None, shipping: None, @@ -142,12 +196,12 @@ impl<'a> CreateIssuingCard<'a> { } /// The address where the card will be shipped. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardShipping<'a> { +pub struct CreateIssuingCardBuilderShipping<'a> { /// The address that the card is shipped to. - pub address: CreateIssuingCardShippingAddress<'a>, + pub address: CreateIssuingCardBuilderShippingAddress<'a>, /// Customs information for the shipment. #[serde(skip_serializing_if = "Option::is_none")] - pub customs: Option>, + pub customs: Option>, /// The name printed on the shipping label when shipping the card. pub name: &'a str, /// Phone number of the recipient of the shipment. @@ -158,14 +212,14 @@ pub struct CreateIssuingCardShipping<'a> { pub require_signature: Option, /// Shipment service. #[serde(skip_serializing_if = "Option::is_none")] - pub service: Option, + pub service: Option, /// Packaging options. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> CreateIssuingCardShipping<'a> { - pub fn new(address: CreateIssuingCardShippingAddress<'a>, name: &'a str) -> Self { +impl<'a> CreateIssuingCardBuilderShipping<'a> { + pub fn new(address: CreateIssuingCardBuilderShippingAddress<'a>, name: &'a str) -> Self { Self { address, customs: None, @@ -179,7 +233,7 @@ impl<'a> CreateIssuingCardShipping<'a> { } /// The address that the card is shipped to. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardShippingAddress<'a> { +pub struct CreateIssuingCardBuilderShippingAddress<'a> { /// City, district, suburb, town, or village. pub city: &'a str, /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). @@ -195,34 +249,34 @@ pub struct CreateIssuingCardShippingAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateIssuingCardShippingAddress<'a> { +impl<'a> CreateIssuingCardBuilderShippingAddress<'a> { pub fn new(city: &'a str, country: &'a str, line1: &'a str, postal_code: &'a str) -> Self { Self { city, country, line1, line2: None, postal_code, state: None } } } /// Customs information for the shipment. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardShippingCustoms<'a> { +pub struct CreateIssuingCardBuilderShippingCustoms<'a> { /// The Economic Operators Registration and Identification (EORI) number to use for Customs. /// Required for bulk shipments to Europe. #[serde(skip_serializing_if = "Option::is_none")] pub eori_number: Option<&'a str>, } -impl<'a> CreateIssuingCardShippingCustoms<'a> { +impl<'a> CreateIssuingCardBuilderShippingCustoms<'a> { pub fn new() -> Self { Self::default() } } /// Shipment service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardShippingService { +pub enum CreateIssuingCardBuilderShippingService { Express, Priority, Standard, } -impl CreateIssuingCardShippingService { +impl CreateIssuingCardBuilderShippingService { pub fn as_str(self) -> &'static str { - use CreateIssuingCardShippingService::*; + use CreateIssuingCardBuilderShippingService::*; match self { Express => "express", Priority => "priority", @@ -231,10 +285,10 @@ impl CreateIssuingCardShippingService { } } -impl std::str::FromStr for CreateIssuingCardShippingService { +impl std::str::FromStr for CreateIssuingCardBuilderShippingService { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardShippingService::*; + use CreateIssuingCardBuilderShippingService::*; match s { "express" => Ok(Express), "priority" => Ok(Priority), @@ -243,18 +297,18 @@ impl std::str::FromStr for CreateIssuingCardShippingService { } } } -impl std::fmt::Display for CreateIssuingCardShippingService { +impl std::fmt::Display for CreateIssuingCardBuilderShippingService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardShippingService { +impl std::fmt::Debug for CreateIssuingCardBuilderShippingService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardShippingService { +impl serde::Serialize for CreateIssuingCardBuilderShippingService { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -264,13 +318,13 @@ impl serde::Serialize for CreateIssuingCardShippingService { } /// Packaging options. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardShippingType { +pub enum CreateIssuingCardBuilderShippingType { Bulk, Individual, } -impl CreateIssuingCardShippingType { +impl CreateIssuingCardBuilderShippingType { pub fn as_str(self) -> &'static str { - use CreateIssuingCardShippingType::*; + use CreateIssuingCardBuilderShippingType::*; match self { Bulk => "bulk", Individual => "individual", @@ -278,10 +332,10 @@ impl CreateIssuingCardShippingType { } } -impl std::str::FromStr for CreateIssuingCardShippingType { +impl std::str::FromStr for CreateIssuingCardBuilderShippingType { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardShippingType::*; + use CreateIssuingCardBuilderShippingType::*; match s { "bulk" => Ok(Bulk), "individual" => Ok(Individual), @@ -289,18 +343,18 @@ impl std::str::FromStr for CreateIssuingCardShippingType { } } } -impl std::fmt::Display for CreateIssuingCardShippingType { +impl std::fmt::Display for CreateIssuingCardBuilderShippingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardShippingType { +impl std::fmt::Debug for CreateIssuingCardBuilderShippingType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardShippingType { +impl serde::Serialize for CreateIssuingCardBuilderShippingType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -311,22 +365,22 @@ impl serde::Serialize for CreateIssuingCardShippingType { /// Rules that control spending for this card. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardSpendingControls<'a> { +pub struct CreateIssuingCardBuilderSpendingControls<'a> { /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. /// All other categories will be blocked. /// Cannot be set with `blocked_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_categories: Option<&'a [CreateIssuingCardSpendingControlsAllowedCategories]>, + pub allowed_categories: Option<&'a [CreateIssuingCardBuilderSpendingControlsAllowedCategories]>, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. /// All other categories will be allowed. /// Cannot be set with `allowed_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub blocked_categories: Option<&'a [CreateIssuingCardSpendingControlsBlockedCategories]>, + pub blocked_categories: Option<&'a [CreateIssuingCardBuilderSpendingControlsBlockedCategories]>, /// Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). #[serde(skip_serializing_if = "Option::is_none")] - pub spending_limits: Option<&'a [CreateIssuingCardSpendingControlsSpendingLimits<'a>]>, + pub spending_limits: Option<&'a [CreateIssuingCardBuilderSpendingControlsSpendingLimits<'a>]>, } -impl<'a> CreateIssuingCardSpendingControls<'a> { +impl<'a> CreateIssuingCardBuilderSpendingControls<'a> { pub fn new() -> Self { Self::default() } @@ -336,7 +390,7 @@ impl<'a> CreateIssuingCardSpendingControls<'a> { /// Cannot be set with `blocked_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardSpendingControlsAllowedCategories { +pub enum CreateIssuingCardBuilderSpendingControlsAllowedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -635,9 +689,9 @@ pub enum CreateIssuingCardSpendingControlsAllowedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardSpendingControlsAllowedCategories { +impl CreateIssuingCardBuilderSpendingControlsAllowedCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardSpendingControlsAllowedCategories::*; + use CreateIssuingCardBuilderSpendingControlsAllowedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -983,10 +1037,10 @@ impl CreateIssuingCardSpendingControlsAllowedCategories { } } -impl std::str::FromStr for CreateIssuingCardSpendingControlsAllowedCategories { +impl std::str::FromStr for CreateIssuingCardBuilderSpendingControlsAllowedCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardSpendingControlsAllowedCategories::*; + use CreateIssuingCardBuilderSpendingControlsAllowedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -1335,18 +1389,18 @@ impl std::str::FromStr for CreateIssuingCardSpendingControlsAllowedCategories { } } } -impl std::fmt::Display for CreateIssuingCardSpendingControlsAllowedCategories { +impl std::fmt::Display for CreateIssuingCardBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardSpendingControlsAllowedCategories { +impl std::fmt::Debug for CreateIssuingCardBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardSpendingControlsAllowedCategories { +impl serde::Serialize for CreateIssuingCardBuilderSpendingControlsAllowedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1359,7 +1413,7 @@ impl serde::Serialize for CreateIssuingCardSpendingControlsAllowedCategories { /// Cannot be set with `allowed_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardSpendingControlsBlockedCategories { +pub enum CreateIssuingCardBuilderSpendingControlsBlockedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -1658,9 +1712,9 @@ pub enum CreateIssuingCardSpendingControlsBlockedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardSpendingControlsBlockedCategories { +impl CreateIssuingCardBuilderSpendingControlsBlockedCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardSpendingControlsBlockedCategories::*; + use CreateIssuingCardBuilderSpendingControlsBlockedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -2006,10 +2060,10 @@ impl CreateIssuingCardSpendingControlsBlockedCategories { } } -impl std::str::FromStr for CreateIssuingCardSpendingControlsBlockedCategories { +impl std::str::FromStr for CreateIssuingCardBuilderSpendingControlsBlockedCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardSpendingControlsBlockedCategories::*; + use CreateIssuingCardBuilderSpendingControlsBlockedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -2358,18 +2412,18 @@ impl std::str::FromStr for CreateIssuingCardSpendingControlsBlockedCategories { } } } -impl std::fmt::Display for CreateIssuingCardSpendingControlsBlockedCategories { +impl std::fmt::Display for CreateIssuingCardBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardSpendingControlsBlockedCategories { +impl std::fmt::Debug for CreateIssuingCardBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardSpendingControlsBlockedCategories { +impl serde::Serialize for CreateIssuingCardBuilderSpendingControlsBlockedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2379,20 +2433,20 @@ impl serde::Serialize for CreateIssuingCardSpendingControlsBlockedCategories { } /// Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardSpendingControlsSpendingLimits<'a> { +pub struct CreateIssuingCardBuilderSpendingControlsSpendingLimits<'a> { /// Maximum amount allowed to spend per interval. pub amount: i64, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. /// Omitting this field will apply the limit to all categories. #[serde(skip_serializing_if = "Option::is_none")] - pub categories: Option<&'a [CreateIssuingCardSpendingControlsSpendingLimitsCategories]>, + pub categories: Option<&'a [CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories]>, /// Interval (or event) to which the amount applies. - pub interval: CreateIssuingCardSpendingControlsSpendingLimitsInterval, + pub interval: CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval, } -impl<'a> CreateIssuingCardSpendingControlsSpendingLimits<'a> { +impl<'a> CreateIssuingCardBuilderSpendingControlsSpendingLimits<'a> { pub fn new( amount: i64, - interval: CreateIssuingCardSpendingControlsSpendingLimitsInterval, + interval: CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval, ) -> Self { Self { amount, categories: None, interval } } @@ -2401,7 +2455,7 @@ impl<'a> CreateIssuingCardSpendingControlsSpendingLimits<'a> { /// Omitting this field will apply the limit to all categories. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardSpendingControlsSpendingLimitsCategories { +pub enum CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -2700,9 +2754,9 @@ pub enum CreateIssuingCardSpendingControlsSpendingLimitsCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardSpendingControlsSpendingLimitsCategories { +impl CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardSpendingControlsSpendingLimitsCategories::*; + use CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -3048,10 +3102,10 @@ impl CreateIssuingCardSpendingControlsSpendingLimitsCategories { } } -impl std::str::FromStr for CreateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::str::FromStr for CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardSpendingControlsSpendingLimitsCategories::*; + use CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -3400,18 +3454,18 @@ impl std::str::FromStr for CreateIssuingCardSpendingControlsSpendingLimitsCatego } } } -impl std::fmt::Display for CreateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::fmt::Display for CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::fmt::Debug for CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardSpendingControlsSpendingLimitsCategories { +impl serde::Serialize for CreateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3421,7 +3475,7 @@ impl serde::Serialize for CreateIssuingCardSpendingControlsSpendingLimitsCategor } /// Interval (or event) to which the amount applies. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardSpendingControlsSpendingLimitsInterval { +pub enum CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { AllTime, Daily, Monthly, @@ -3429,9 +3483,9 @@ pub enum CreateIssuingCardSpendingControlsSpendingLimitsInterval { Weekly, Yearly, } -impl CreateIssuingCardSpendingControlsSpendingLimitsInterval { +impl CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { pub fn as_str(self) -> &'static str { - use CreateIssuingCardSpendingControlsSpendingLimitsInterval::*; + use CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval::*; match self { AllTime => "all_time", Daily => "daily", @@ -3443,10 +3497,10 @@ impl CreateIssuingCardSpendingControlsSpendingLimitsInterval { } } -impl std::str::FromStr for CreateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::str::FromStr for CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardSpendingControlsSpendingLimitsInterval::*; + use CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval::*; match s { "all_time" => Ok(AllTime), "daily" => Ok(Daily), @@ -3458,18 +3512,18 @@ impl std::str::FromStr for CreateIssuingCardSpendingControlsSpendingLimitsInterv } } } -impl std::fmt::Display for CreateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::fmt::Display for CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::fmt::Debug for CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardSpendingControlsSpendingLimitsInterval { +impl serde::Serialize for CreateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3481,13 +3535,13 @@ impl serde::Serialize for CreateIssuingCardSpendingControlsSpendingLimitsInterva /// May be blocked from activating cards depending on past-due Cardholder requirements. /// Defaults to `inactive`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardStatus { +pub enum CreateIssuingCardBuilderStatus { Active, Inactive, } -impl CreateIssuingCardStatus { +impl CreateIssuingCardBuilderStatus { pub fn as_str(self) -> &'static str { - use CreateIssuingCardStatus::*; + use CreateIssuingCardBuilderStatus::*; match self { Active => "active", Inactive => "inactive", @@ -3495,10 +3549,10 @@ impl CreateIssuingCardStatus { } } -impl std::str::FromStr for CreateIssuingCardStatus { +impl std::str::FromStr for CreateIssuingCardBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardStatus::*; + use CreateIssuingCardBuilderStatus::*; match s { "active" => Ok(Active), "inactive" => Ok(Inactive), @@ -3506,18 +3560,18 @@ impl std::str::FromStr for CreateIssuingCardStatus { } } } -impl std::fmt::Display for CreateIssuingCardStatus { +impl std::fmt::Display for CreateIssuingCardBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardStatus { +impl std::fmt::Debug for CreateIssuingCardBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardStatus { +impl serde::Serialize for CreateIssuingCardBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3525,17 +3579,144 @@ impl serde::Serialize for CreateIssuingCardStatus { serializer.serialize_str(self.as_str()) } } +/// Creates an Issuing `Card` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIssuingCard<'a> { + inner: CreateIssuingCardBuilder<'a>, +} impl<'a> CreateIssuingCard<'a> { - /// Creates an Issuing `Card` object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/issuing/cards", self, http_types::Method::Post) + pub fn new(currency: stripe_types::Currency, type_: stripe_shared::IssuingCardType) -> Self { + Self { inner: CreateIssuingCardBuilder::new(currency, type_) } + } + pub fn cardholder(mut self, cardholder: &'a str) -> Self { + self.inner.cardholder = Some(cardholder); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn financial_account(mut self, financial_account: &'a str) -> Self { + self.inner.financial_account = Some(financial_account); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn replacement_for(mut self, replacement_for: &'a str) -> Self { + self.inner.replacement_for = Some(replacement_for); + self + } + + pub fn replacement_reason( + mut self, + replacement_reason: stripe_shared::IssuingCardReplacementReason, + ) -> Self { + self.inner.replacement_reason = Some(replacement_reason); + self + } + + pub fn shipping(mut self, shipping: CreateIssuingCardBuilderShipping<'a>) -> Self { + self.inner.shipping = Some(shipping); + self + } + + pub fn spending_controls( + mut self, + spending_controls: CreateIssuingCardBuilderSpendingControls<'a>, + ) -> Self { + self.inner.spending_controls = Some(spending_controls); + self + } + + pub fn status(mut self, status: CreateIssuingCardBuilderStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl CreateIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/issuing/cards").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCard<'a> { +pub struct RetrieveIssuingCardBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveIssuingCardBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves an Issuing `Card` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingCard<'a> { + inner: RetrieveIssuingCardBuilder<'a>, + card: &'a stripe_shared::IssuingCardId, +} +impl<'a> RetrieveIssuingCard<'a> { + pub fn new(card: &'a stripe_shared::IssuingCardId) -> Self { + Self { card, inner: RetrieveIssuingCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/cards/{card}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateIssuingCardBuilder<'a> { /// Reason why the `status` of this card is `canceled`. #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option, + pub cancellation_reason: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -3547,11 +3728,11 @@ pub struct UpdateIssuingCard<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// The desired new PIN for this card. #[serde(skip_serializing_if = "Option::is_none")] - pub pin: Option>, + pub pin: Option>, /// Rules that control spending for this card. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_controls: Option>, + pub spending_controls: Option>, /// Dictates whether authorizations can be approved on this card. /// May be blocked from activating cards depending on past-due Cardholder requirements. /// Defaults to `inactive`. @@ -3559,20 +3740,20 @@ pub struct UpdateIssuingCard<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> UpdateIssuingCard<'a> { +impl<'a> UpdateIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Reason why the `status` of this card is `canceled`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardCancellationReason { +pub enum UpdateIssuingCardBuilderCancellationReason { Lost, Stolen, } -impl UpdateIssuingCardCancellationReason { +impl UpdateIssuingCardBuilderCancellationReason { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardCancellationReason::*; + use UpdateIssuingCardBuilderCancellationReason::*; match self { Lost => "lost", Stolen => "stolen", @@ -3580,10 +3761,10 @@ impl UpdateIssuingCardCancellationReason { } } -impl std::str::FromStr for UpdateIssuingCardCancellationReason { +impl std::str::FromStr for UpdateIssuingCardBuilderCancellationReason { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardCancellationReason::*; + use UpdateIssuingCardBuilderCancellationReason::*; match s { "lost" => Ok(Lost), "stolen" => Ok(Stolen), @@ -3591,18 +3772,18 @@ impl std::str::FromStr for UpdateIssuingCardCancellationReason { } } } -impl std::fmt::Display for UpdateIssuingCardCancellationReason { +impl std::fmt::Display for UpdateIssuingCardBuilderCancellationReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardCancellationReason { +impl std::fmt::Debug for UpdateIssuingCardBuilderCancellationReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardCancellationReason { +impl serde::Serialize for UpdateIssuingCardBuilderCancellationReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3610,25 +3791,37 @@ impl serde::Serialize for UpdateIssuingCardCancellationReason { serializer.serialize_str(self.as_str()) } } +/// The desired new PIN for this card. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateIssuingCardBuilderPin<'a> { + /// The card's desired new PIN, encrypted under Stripe's public key. + #[serde(skip_serializing_if = "Option::is_none")] + pub encrypted_number: Option<&'a str>, +} +impl<'a> UpdateIssuingCardBuilderPin<'a> { + pub fn new() -> Self { + Self::default() + } +} /// Rules that control spending for this card. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardSpendingControls<'a> { +pub struct UpdateIssuingCardBuilderSpendingControls<'a> { /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. /// All other categories will be blocked. /// Cannot be set with `blocked_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_categories: Option<&'a [UpdateIssuingCardSpendingControlsAllowedCategories]>, + pub allowed_categories: Option<&'a [UpdateIssuingCardBuilderSpendingControlsAllowedCategories]>, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. /// All other categories will be allowed. /// Cannot be set with `allowed_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub blocked_categories: Option<&'a [UpdateIssuingCardSpendingControlsBlockedCategories]>, + pub blocked_categories: Option<&'a [UpdateIssuingCardBuilderSpendingControlsBlockedCategories]>, /// Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). #[serde(skip_serializing_if = "Option::is_none")] - pub spending_limits: Option<&'a [UpdateIssuingCardSpendingControlsSpendingLimits<'a>]>, + pub spending_limits: Option<&'a [UpdateIssuingCardBuilderSpendingControlsSpendingLimits<'a>]>, } -impl<'a> UpdateIssuingCardSpendingControls<'a> { +impl<'a> UpdateIssuingCardBuilderSpendingControls<'a> { pub fn new() -> Self { Self::default() } @@ -3638,7 +3831,7 @@ impl<'a> UpdateIssuingCardSpendingControls<'a> { /// Cannot be set with `blocked_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardSpendingControlsAllowedCategories { +pub enum UpdateIssuingCardBuilderSpendingControlsAllowedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -3937,9 +4130,9 @@ pub enum UpdateIssuingCardSpendingControlsAllowedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardSpendingControlsAllowedCategories { +impl UpdateIssuingCardBuilderSpendingControlsAllowedCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardSpendingControlsAllowedCategories::*; + use UpdateIssuingCardBuilderSpendingControlsAllowedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -4285,10 +4478,10 @@ impl UpdateIssuingCardSpendingControlsAllowedCategories { } } -impl std::str::FromStr for UpdateIssuingCardSpendingControlsAllowedCategories { +impl std::str::FromStr for UpdateIssuingCardBuilderSpendingControlsAllowedCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardSpendingControlsAllowedCategories::*; + use UpdateIssuingCardBuilderSpendingControlsAllowedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -4637,18 +4830,18 @@ impl std::str::FromStr for UpdateIssuingCardSpendingControlsAllowedCategories { } } } -impl std::fmt::Display for UpdateIssuingCardSpendingControlsAllowedCategories { +impl std::fmt::Display for UpdateIssuingCardBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardSpendingControlsAllowedCategories { +impl std::fmt::Debug for UpdateIssuingCardBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardSpendingControlsAllowedCategories { +impl serde::Serialize for UpdateIssuingCardBuilderSpendingControlsAllowedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4661,7 +4854,7 @@ impl serde::Serialize for UpdateIssuingCardSpendingControlsAllowedCategories { /// Cannot be set with `allowed_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardSpendingControlsBlockedCategories { +pub enum UpdateIssuingCardBuilderSpendingControlsBlockedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -4960,9 +5153,9 @@ pub enum UpdateIssuingCardSpendingControlsBlockedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardSpendingControlsBlockedCategories { +impl UpdateIssuingCardBuilderSpendingControlsBlockedCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardSpendingControlsBlockedCategories::*; + use UpdateIssuingCardBuilderSpendingControlsBlockedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -5308,10 +5501,10 @@ impl UpdateIssuingCardSpendingControlsBlockedCategories { } } -impl std::str::FromStr for UpdateIssuingCardSpendingControlsBlockedCategories { +impl std::str::FromStr for UpdateIssuingCardBuilderSpendingControlsBlockedCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardSpendingControlsBlockedCategories::*; + use UpdateIssuingCardBuilderSpendingControlsBlockedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -5660,18 +5853,18 @@ impl std::str::FromStr for UpdateIssuingCardSpendingControlsBlockedCategories { } } } -impl std::fmt::Display for UpdateIssuingCardSpendingControlsBlockedCategories { +impl std::fmt::Display for UpdateIssuingCardBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardSpendingControlsBlockedCategories { +impl std::fmt::Debug for UpdateIssuingCardBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardSpendingControlsBlockedCategories { +impl serde::Serialize for UpdateIssuingCardBuilderSpendingControlsBlockedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5681,20 +5874,20 @@ impl serde::Serialize for UpdateIssuingCardSpendingControlsBlockedCategories { } /// Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingCardSpendingControlsSpendingLimits<'a> { +pub struct UpdateIssuingCardBuilderSpendingControlsSpendingLimits<'a> { /// Maximum amount allowed to spend per interval. pub amount: i64, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. /// Omitting this field will apply the limit to all categories. #[serde(skip_serializing_if = "Option::is_none")] - pub categories: Option<&'a [UpdateIssuingCardSpendingControlsSpendingLimitsCategories]>, + pub categories: Option<&'a [UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories]>, /// Interval (or event) to which the amount applies. - pub interval: UpdateIssuingCardSpendingControlsSpendingLimitsInterval, + pub interval: UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval, } -impl<'a> UpdateIssuingCardSpendingControlsSpendingLimits<'a> { +impl<'a> UpdateIssuingCardBuilderSpendingControlsSpendingLimits<'a> { pub fn new( amount: i64, - interval: UpdateIssuingCardSpendingControlsSpendingLimitsInterval, + interval: UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval, ) -> Self { Self { amount, categories: None, interval } } @@ -5703,7 +5896,7 @@ impl<'a> UpdateIssuingCardSpendingControlsSpendingLimits<'a> { /// Omitting this field will apply the limit to all categories. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +pub enum UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -6002,9 +6195,9 @@ pub enum UpdateIssuingCardSpendingControlsSpendingLimitsCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +impl UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardSpendingControlsSpendingLimitsCategories::*; + use UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -6350,10 +6543,10 @@ impl UpdateIssuingCardSpendingControlsSpendingLimitsCategories { } } -impl std::str::FromStr for UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::str::FromStr for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardSpendingControlsSpendingLimitsCategories::*; + use UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -6702,18 +6895,18 @@ impl std::str::FromStr for UpdateIssuingCardSpendingControlsSpendingLimitsCatego } } } -impl std::fmt::Display for UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::fmt::Display for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +impl std::fmt::Debug for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardSpendingControlsSpendingLimitsCategories { +impl serde::Serialize for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6723,7 +6916,7 @@ impl serde::Serialize for UpdateIssuingCardSpendingControlsSpendingLimitsCategor } /// Interval (or event) to which the amount applies. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +pub enum UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { AllTime, Daily, Monthly, @@ -6731,9 +6924,9 @@ pub enum UpdateIssuingCardSpendingControlsSpendingLimitsInterval { Weekly, Yearly, } -impl UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +impl UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardSpendingControlsSpendingLimitsInterval::*; + use UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval::*; match self { AllTime => "all_time", Daily => "daily", @@ -6745,10 +6938,10 @@ impl UpdateIssuingCardSpendingControlsSpendingLimitsInterval { } } -impl std::str::FromStr for UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::str::FromStr for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardSpendingControlsSpendingLimitsInterval::*; + use UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval::*; match s { "all_time" => Ok(AllTime), "daily" => Ok(Daily), @@ -6760,18 +6953,18 @@ impl std::str::FromStr for UpdateIssuingCardSpendingControlsSpendingLimitsInterv } } } -impl std::fmt::Display for UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::fmt::Display for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +impl std::fmt::Debug for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardSpendingControlsSpendingLimitsInterval { +impl serde::Serialize for UpdateIssuingCardBuilderSpendingControlsSpendingLimitsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6779,125 +6972,290 @@ impl serde::Serialize for UpdateIssuingCardSpendingControlsSpendingLimitsInterva serializer.serialize_str(self.as_str()) } } +/// Updates the specified Issuing `Card` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingCard<'a> { + inner: UpdateIssuingCardBuilder<'a>, + card: &'a stripe_shared::IssuingCardId, +} impl<'a> UpdateIssuingCard<'a> { - /// Updates the specified Issuing `Card` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(card: &'a stripe_shared::IssuingCardId) -> Self { + Self { card, inner: UpdateIssuingCardBuilder::new() } + } + pub fn cancellation_reason( + mut self, + cancellation_reason: UpdateIssuingCardBuilderCancellationReason, + ) -> Self { + self.inner.cancellation_reason = Some(cancellation_reason); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn pin(mut self, pin: UpdateIssuingCardBuilderPin<'a>) -> Self { + self.inner.pin = Some(pin); + self + } + + pub fn spending_controls( + mut self, + spending_controls: UpdateIssuingCardBuilderSpendingControls<'a>, + ) -> Self { + self.inner.spending_controls = Some(spending_controls); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingCardStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl UpdateIssuingCard<'_> { + pub async fn send( &self, - client: &stripe::Client, - card: &stripe_shared::IssuingCardId, - ) -> stripe::Response { - client.send_form(&format!("/issuing/cards/{card}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/cards/{card}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeliverCardIssuingCard<'a> { +pub struct DeliverCardIssuingCardBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> DeliverCardIssuingCard<'a> { +impl<'a> DeliverCardIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the shipping status of the specified Issuing `Card` object to `delivered`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeliverCardIssuingCard<'a> { + inner: DeliverCardIssuingCardBuilder<'a>, + card: &'a str, +} impl<'a> DeliverCardIssuingCard<'a> { - /// Updates the shipping status of the specified Issuing `Card` object to `delivered`. - pub fn send( + pub fn new(card: &'a str) -> Self { + Self { card, inner: DeliverCardIssuingCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DeliverCardIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - card: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/cards/{card}/shipping/deliver"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeliverCardIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/cards/{card}/shipping/deliver"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FailCardIssuingCard<'a> { +pub struct ShipCardIssuingCardBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> FailCardIssuingCard<'a> { +impl<'a> ShipCardIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> FailCardIssuingCard<'a> { - /// Updates the shipping status of the specified Issuing `Card` object to `failure`. - pub fn send( +/// Updates the shipping status of the specified Issuing `Card` object to `shipped`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ShipCardIssuingCard<'a> { + inner: ShipCardIssuingCardBuilder<'a>, + card: &'a str, +} +impl<'a> ShipCardIssuingCard<'a> { + pub fn new(card: &'a str) -> Self { + Self { card, inner: ShipCardIssuingCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ShipCardIssuingCard<'_> { + pub async fn send( &self, - client: &stripe::Client, - card: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/cards/{card}/shipping/fail"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ShipCardIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/cards/{card}/shipping/ship"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnCardIssuingCard<'a> { +pub struct ReturnCardIssuingCardBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ReturnCardIssuingCard<'a> { +impl<'a> ReturnCardIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the shipping status of the specified Issuing `Card` object to `returned`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReturnCardIssuingCard<'a> { + inner: ReturnCardIssuingCardBuilder<'a>, + card: &'a str, +} impl<'a> ReturnCardIssuingCard<'a> { - /// Updates the shipping status of the specified Issuing `Card` object to `returned`. - pub fn send( + pub fn new(card: &'a str) -> Self { + Self { card, inner: ReturnCardIssuingCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ReturnCardIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - card: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/cards/{card}/shipping/return"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ReturnCardIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/cards/{card}/shipping/return"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ShipCardIssuingCard<'a> { +pub struct FailCardIssuingCardBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ShipCardIssuingCard<'a> { +impl<'a> FailCardIssuingCardBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ShipCardIssuingCard<'a> { - /// Updates the shipping status of the specified Issuing `Card` object to `shipped`. - pub fn send( - &self, - client: &stripe::Client, - card: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/cards/{card}/shipping/ship"), - self, - http_types::Method::Post, - ) +/// Updates the shipping status of the specified Issuing `Card` object to `failure`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FailCardIssuingCard<'a> { + inner: FailCardIssuingCardBuilder<'a>, + card: &'a str, +} +impl<'a> FailCardIssuingCard<'a> { + pub fn new(card: &'a str) -> Self { + Self { card, inner: FailCardIssuingCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct EncryptedPinParam<'a> { - /// The card's desired new PIN, encrypted under Stripe's public key. - #[serde(skip_serializing_if = "Option::is_none")] - pub encrypted_number: Option<&'a str>, +impl FailCardIssuingCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } } -impl<'a> EncryptedPinParam<'a> { - pub fn new() -> Self { - Self::default() + +impl StripeRequest for FailCardIssuingCard<'_> { + type Output = stripe_shared::IssuingCard; + + fn build(&self) -> RequestBuilder { + let card = self.card; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/cards/{card}/shipping/fail"), + ) + .form(&self.inner) } } diff --git a/generated/stripe_issuing/src/issuing_cardholder/requests.rs b/generated/stripe_issuing/src/issuing_cardholder/requests.rs index fe09025bd..921ff23eb 100644 --- a/generated/stripe_issuing/src/issuing_cardholder/requests.rs +++ b/generated/stripe_issuing/src/issuing_cardholder/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIssuingCardholder<'a> { +pub struct ListIssuingCardholderBuilder<'a> { /// Only return cardholders that were created during the given date interval. #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, @@ -34,49 +38,91 @@ pub struct ListIssuingCardholder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> ListIssuingCardholder<'a> { +impl<'a> ListIssuingCardholderBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Issuing `Cardholder` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingCardholder<'a> { + inner: ListIssuingCardholderBuilder<'a>, +} impl<'a> ListIssuingCardholder<'a> { - /// Returns a list of Issuing `Cardholder` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/cardholders", self) + pub fn new() -> Self { + Self { inner: ListIssuingCardholderBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/cardholders", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingCardholder<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIssuingCardholder<'a> { - pub fn new() -> Self { - Self::default() + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn phone_number(mut self, phone_number: &'a str) -> Self { + self.inner.phone_number = Some(phone_number); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingCardholderStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn type_(mut self, type_: stripe_shared::IssuingCardholderType) -> Self { + self.inner.type_ = Some(type_); + self } } -impl<'a> RetrieveIssuingCardholder<'a> { - /// Retrieves an Issuing `Cardholder` object. - pub fn send( +impl ListIssuingCardholder<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - cardholder: &stripe_shared::IssuingCardholderId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/cardholders/{cardholder}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIssuingCardholder<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/cardholders").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardholder<'a> { +pub struct CreateIssuingCardholderBuilder<'a> { /// The cardholder's billing address. pub billing: BillingSpecs<'a>, /// Additional information about a `company` cardholder. @@ -116,17 +162,17 @@ pub struct CreateIssuingCardholder<'a> { /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_controls: Option>, + pub spending_controls: Option>, /// Specifies whether to permit authorizations on this cardholder's cards. Defaults to `active`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// One of `individual` or `company`. /// See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> CreateIssuingCardholder<'a> { +impl<'a> CreateIssuingCardholderBuilder<'a> { pub fn new(billing: BillingSpecs<'a>, name: &'a str) -> Self { Self { billing, @@ -147,25 +193,28 @@ impl<'a> CreateIssuingCardholder<'a> { /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderSpendingControls<'a> { +pub struct CreateIssuingCardholderBuilderSpendingControls<'a> { /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. /// All other categories will be blocked. /// Cannot be set with `blocked_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_categories: Option<&'a [CreateIssuingCardholderSpendingControlsAllowedCategories]>, + pub allowed_categories: + Option<&'a [CreateIssuingCardholderBuilderSpendingControlsAllowedCategories]>, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. /// All other categories will be allowed. /// Cannot be set with `allowed_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub blocked_categories: Option<&'a [CreateIssuingCardholderSpendingControlsBlockedCategories]>, + pub blocked_categories: + Option<&'a [CreateIssuingCardholderBuilderSpendingControlsBlockedCategories]>, /// Limit spending with amount-based rules that apply across this cardholder's cards. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_limits: Option<&'a [CreateIssuingCardholderSpendingControlsSpendingLimits<'a>]>, + pub spending_limits: + Option<&'a [CreateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a>]>, /// Currency of amounts within `spending_limits`. Defaults to your merchant country's currency. #[serde(skip_serializing_if = "Option::is_none")] pub spending_limits_currency: Option, } -impl<'a> CreateIssuingCardholderSpendingControls<'a> { +impl<'a> CreateIssuingCardholderBuilderSpendingControls<'a> { pub fn new() -> Self { Self::default() } @@ -175,7 +224,7 @@ impl<'a> CreateIssuingCardholderSpendingControls<'a> { /// Cannot be set with `blocked_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardholderSpendingControlsAllowedCategories { +pub enum CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -474,9 +523,9 @@ pub enum CreateIssuingCardholderSpendingControlsAllowedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardholderSpendingControlsAllowedCategories { +impl CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderSpendingControlsAllowedCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsAllowedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -822,10 +871,10 @@ impl CreateIssuingCardholderSpendingControlsAllowedCategories { } } -impl std::str::FromStr for CreateIssuingCardholderSpendingControlsAllowedCategories { +impl std::str::FromStr for CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardholderSpendingControlsAllowedCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsAllowedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -1174,18 +1223,18 @@ impl std::str::FromStr for CreateIssuingCardholderSpendingControlsAllowedCategor } } } -impl std::fmt::Display for CreateIssuingCardholderSpendingControlsAllowedCategories { +impl std::fmt::Display for CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardholderSpendingControlsAllowedCategories { +impl std::fmt::Debug for CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardholderSpendingControlsAllowedCategories { +impl serde::Serialize for CreateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1198,7 +1247,7 @@ impl serde::Serialize for CreateIssuingCardholderSpendingControlsAllowedCategori /// Cannot be set with `allowed_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardholderSpendingControlsBlockedCategories { +pub enum CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -1497,9 +1546,9 @@ pub enum CreateIssuingCardholderSpendingControlsBlockedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardholderSpendingControlsBlockedCategories { +impl CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderSpendingControlsBlockedCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsBlockedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -1845,10 +1894,10 @@ impl CreateIssuingCardholderSpendingControlsBlockedCategories { } } -impl std::str::FromStr for CreateIssuingCardholderSpendingControlsBlockedCategories { +impl std::str::FromStr for CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardholderSpendingControlsBlockedCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsBlockedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -2197,18 +2246,18 @@ impl std::str::FromStr for CreateIssuingCardholderSpendingControlsBlockedCategor } } } -impl std::fmt::Display for CreateIssuingCardholderSpendingControlsBlockedCategories { +impl std::fmt::Display for CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardholderSpendingControlsBlockedCategories { +impl std::fmt::Debug for CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardholderSpendingControlsBlockedCategories { +impl serde::Serialize for CreateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2218,20 +2267,21 @@ impl serde::Serialize for CreateIssuingCardholderSpendingControlsBlockedCategori } /// Limit spending with amount-based rules that apply across this cardholder's cards. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardholderSpendingControlsSpendingLimits<'a> { +pub struct CreateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a> { /// Maximum amount allowed to spend per interval. pub amount: i64, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. /// Omitting this field will apply the limit to all categories. #[serde(skip_serializing_if = "Option::is_none")] - pub categories: Option<&'a [CreateIssuingCardholderSpendingControlsSpendingLimitsCategories]>, + pub categories: + Option<&'a [CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories]>, /// Interval (or event) to which the amount applies. - pub interval: CreateIssuingCardholderSpendingControlsSpendingLimitsInterval, + pub interval: CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval, } -impl<'a> CreateIssuingCardholderSpendingControlsSpendingLimits<'a> { +impl<'a> CreateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a> { pub fn new( amount: i64, - interval: CreateIssuingCardholderSpendingControlsSpendingLimitsInterval, + interval: CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval, ) -> Self { Self { amount, categories: None, interval } } @@ -2240,7 +2290,7 @@ impl<'a> CreateIssuingCardholderSpendingControlsSpendingLimits<'a> { /// Omitting this field will apply the limit to all categories. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +pub enum CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -2539,9 +2589,9 @@ pub enum CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderSpendingControlsSpendingLimitsCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -2887,10 +2937,10 @@ impl CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { } } -impl std::str::FromStr for CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::str::FromStr for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardholderSpendingControlsSpendingLimitsCategories::*; + use CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -3239,18 +3289,18 @@ impl std::str::FromStr for CreateIssuingCardholderSpendingControlsSpendingLimits } } } -impl std::fmt::Display for CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::fmt::Display for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::fmt::Debug for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl serde::Serialize for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3260,7 +3310,7 @@ impl serde::Serialize for CreateIssuingCardholderSpendingControlsSpendingLimitsC } /// Interval (or event) to which the amount applies. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +pub enum CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { AllTime, Daily, Monthly, @@ -3268,9 +3318,9 @@ pub enum CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { Weekly, Yearly, } -impl CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderSpendingControlsSpendingLimitsInterval::*; + use CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval::*; match self { AllTime => "all_time", Daily => "daily", @@ -3282,10 +3332,10 @@ impl CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { } } -impl std::str::FromStr for CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::str::FromStr for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardholderSpendingControlsSpendingLimitsInterval::*; + use CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval::*; match s { "all_time" => Ok(AllTime), "daily" => Ok(Daily), @@ -3297,18 +3347,18 @@ impl std::str::FromStr for CreateIssuingCardholderSpendingControlsSpendingLimits } } } -impl std::fmt::Display for CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::fmt::Display for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::fmt::Debug for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl serde::Serialize for CreateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3318,13 +3368,13 @@ impl serde::Serialize for CreateIssuingCardholderSpendingControlsSpendingLimitsI } /// Specifies whether to permit authorizations on this cardholder's cards. Defaults to `active`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardholderStatus { +pub enum CreateIssuingCardholderBuilderStatus { Active, Inactive, } -impl CreateIssuingCardholderStatus { +impl CreateIssuingCardholderBuilderStatus { pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderStatus::*; + use CreateIssuingCardholderBuilderStatus::*; match self { Active => "active", Inactive => "inactive", @@ -3332,10 +3382,10 @@ impl CreateIssuingCardholderStatus { } } -impl std::str::FromStr for CreateIssuingCardholderStatus { +impl std::str::FromStr for CreateIssuingCardholderBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingCardholderStatus::*; + use CreateIssuingCardholderBuilderStatus::*; match s { "active" => Ok(Active), "inactive" => Ok(Inactive), @@ -3343,18 +3393,18 @@ impl std::str::FromStr for CreateIssuingCardholderStatus { } } } -impl std::fmt::Display for CreateIssuingCardholderStatus { +impl std::fmt::Display for CreateIssuingCardholderBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingCardholderStatus { +impl std::fmt::Debug for CreateIssuingCardholderBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingCardholderStatus { +impl serde::Serialize for CreateIssuingCardholderBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3362,17 +3412,147 @@ impl serde::Serialize for CreateIssuingCardholderStatus { serializer.serialize_str(self.as_str()) } } +/// Creates a new Issuing `Cardholder` object that can be issued cards. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIssuingCardholder<'a> { + inner: CreateIssuingCardholderBuilder<'a>, +} impl<'a> CreateIssuingCardholder<'a> { - /// Creates a new Issuing `Cardholder` object that can be issued cards. - pub fn send( + pub fn new(billing: BillingSpecs<'a>, name: &'a str) -> Self { + Self { inner: CreateIssuingCardholderBuilder::new(billing, name) } + } + pub fn company(mut self, company: CompanyParam<'a>) -> Self { + self.inner.company = Some(company); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn individual(mut self, individual: IndividualParam<'a>) -> Self { + self.inner.individual = Some(individual); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn phone_number(mut self, phone_number: &'a str) -> Self { + self.inner.phone_number = Some(phone_number); + self + } + + pub fn preferred_locales( + mut self, + preferred_locales: &'a [stripe_shared::IssuingCardholderPreferredLocales], + ) -> Self { + self.inner.preferred_locales = Some(preferred_locales); + self + } + + pub fn spending_controls( + mut self, + spending_controls: CreateIssuingCardholderBuilderSpendingControls<'a>, + ) -> Self { + self.inner.spending_controls = Some(spending_controls); + self + } + + pub fn status(mut self, status: CreateIssuingCardholderBuilderStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn type_(mut self, type_: stripe_shared::IssuingCardholderType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl CreateIssuingCardholder<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/issuing/cardholders", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIssuingCardholder<'_> { + type Output = stripe_shared::IssuingCardholder; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/issuing/cardholders").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholder<'a> { +pub struct RetrieveIssuingCardholderBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveIssuingCardholderBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves an Issuing `Cardholder` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingCardholder<'a> { + inner: RetrieveIssuingCardholderBuilder<'a>, + cardholder: &'a stripe_shared::IssuingCardholderId, +} +impl<'a> RetrieveIssuingCardholder<'a> { + pub fn new(cardholder: &'a stripe_shared::IssuingCardholderId) -> Self { + Self { cardholder, inner: RetrieveIssuingCardholderBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingCardholder<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingCardholder<'_> { + type Output = stripe_shared::IssuingCardholder; + + fn build(&self) -> RequestBuilder { + let cardholder = self.cardholder; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/cardholders/{cardholder}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateIssuingCardholderBuilder<'a> { /// The cardholder's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing: Option>, @@ -3407,12 +3587,12 @@ pub struct UpdateIssuingCardholder<'a> { /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_controls: Option>, + pub spending_controls: Option>, /// Specifies whether to permit authorizations on this cardholder's cards. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } -impl<'a> UpdateIssuingCardholder<'a> { +impl<'a> UpdateIssuingCardholderBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -3420,25 +3600,28 @@ impl<'a> UpdateIssuingCardholder<'a> { /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderSpendingControls<'a> { +pub struct UpdateIssuingCardholderBuilderSpendingControls<'a> { /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. /// All other categories will be blocked. /// Cannot be set with `blocked_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_categories: Option<&'a [UpdateIssuingCardholderSpendingControlsAllowedCategories]>, + pub allowed_categories: + Option<&'a [UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories]>, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. /// All other categories will be allowed. /// Cannot be set with `allowed_categories`. #[serde(skip_serializing_if = "Option::is_none")] - pub blocked_categories: Option<&'a [UpdateIssuingCardholderSpendingControlsBlockedCategories]>, + pub blocked_categories: + Option<&'a [UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories]>, /// Limit spending with amount-based rules that apply across this cardholder's cards. #[serde(skip_serializing_if = "Option::is_none")] - pub spending_limits: Option<&'a [UpdateIssuingCardholderSpendingControlsSpendingLimits<'a>]>, + pub spending_limits: + Option<&'a [UpdateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a>]>, /// Currency of amounts within `spending_limits`. Defaults to your merchant country's currency. #[serde(skip_serializing_if = "Option::is_none")] pub spending_limits_currency: Option, } -impl<'a> UpdateIssuingCardholderSpendingControls<'a> { +impl<'a> UpdateIssuingCardholderBuilderSpendingControls<'a> { pub fn new() -> Self { Self::default() } @@ -3448,7 +3631,7 @@ impl<'a> UpdateIssuingCardholderSpendingControls<'a> { /// Cannot be set with `blocked_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardholderSpendingControlsAllowedCategories { +pub enum UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -3747,9 +3930,9 @@ pub enum UpdateIssuingCardholderSpendingControlsAllowedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardholderSpendingControlsAllowedCategories { +impl UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderSpendingControlsAllowedCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -4095,10 +4278,10 @@ impl UpdateIssuingCardholderSpendingControlsAllowedCategories { } } -impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsAllowedCategories { +impl std::str::FromStr for UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderSpendingControlsAllowedCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -4447,18 +4630,18 @@ impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsAllowedCategor } } } -impl std::fmt::Display for UpdateIssuingCardholderSpendingControlsAllowedCategories { +impl std::fmt::Display for UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardholderSpendingControlsAllowedCategories { +impl std::fmt::Debug for UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardholderSpendingControlsAllowedCategories { +impl serde::Serialize for UpdateIssuingCardholderBuilderSpendingControlsAllowedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4471,7 +4654,7 @@ impl serde::Serialize for UpdateIssuingCardholderSpendingControlsAllowedCategori /// Cannot be set with `allowed_categories`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardholderSpendingControlsBlockedCategories { +pub enum UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -4770,9 +4953,9 @@ pub enum UpdateIssuingCardholderSpendingControlsBlockedCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardholderSpendingControlsBlockedCategories { +impl UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderSpendingControlsBlockedCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -5118,10 +5301,10 @@ impl UpdateIssuingCardholderSpendingControlsBlockedCategories { } } -impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsBlockedCategories { +impl std::str::FromStr for UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderSpendingControlsBlockedCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -5470,18 +5653,18 @@ impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsBlockedCategor } } } -impl std::fmt::Display for UpdateIssuingCardholderSpendingControlsBlockedCategories { +impl std::fmt::Display for UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardholderSpendingControlsBlockedCategories { +impl std::fmt::Debug for UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardholderSpendingControlsBlockedCategories { +impl serde::Serialize for UpdateIssuingCardholderBuilderSpendingControlsBlockedCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5491,20 +5674,21 @@ impl serde::Serialize for UpdateIssuingCardholderSpendingControlsBlockedCategori } /// Limit spending with amount-based rules that apply across this cardholder's cards. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingCardholderSpendingControlsSpendingLimits<'a> { +pub struct UpdateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a> { /// Maximum amount allowed to spend per interval. pub amount: i64, /// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. /// Omitting this field will apply the limit to all categories. #[serde(skip_serializing_if = "Option::is_none")] - pub categories: Option<&'a [UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories]>, + pub categories: + Option<&'a [UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories]>, /// Interval (or event) to which the amount applies. - pub interval: UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval, + pub interval: UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval, } -impl<'a> UpdateIssuingCardholderSpendingControlsSpendingLimits<'a> { +impl<'a> UpdateIssuingCardholderBuilderSpendingControlsSpendingLimits<'a> { pub fn new( amount: i64, - interval: UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval, + interval: UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval, ) -> Self { Self { amount, categories: None, interval } } @@ -5513,7 +5697,7 @@ impl<'a> UpdateIssuingCardholderSpendingControlsSpendingLimits<'a> { /// Omitting this field will apply the limit to all categories. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +pub enum UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -5812,9 +5996,9 @@ pub enum UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -6160,10 +6344,10 @@ impl UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { } } -impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::str::FromStr for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories::*; + use UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -6512,18 +6696,18 @@ impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsSpendingLimits } } } -impl std::fmt::Display for UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::fmt::Display for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl std::fmt::Debug for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardholderSpendingControlsSpendingLimitsCategories { +impl serde::Serialize for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsCategories { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6533,7 +6717,7 @@ impl serde::Serialize for UpdateIssuingCardholderSpendingControlsSpendingLimitsC } /// Interval (or event) to which the amount applies. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +pub enum UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { AllTime, Daily, Monthly, @@ -6541,9 +6725,9 @@ pub enum UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { Weekly, Yearly, } -impl UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval::*; + use UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval::*; match self { AllTime => "all_time", Daily => "daily", @@ -6555,10 +6739,10 @@ impl UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { } } -impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::str::FromStr for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval::*; + use UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval::*; match s { "all_time" => Ok(AllTime), "daily" => Ok(Daily), @@ -6570,18 +6754,18 @@ impl std::str::FromStr for UpdateIssuingCardholderSpendingControlsSpendingLimits } } } -impl std::fmt::Display for UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::fmt::Display for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl std::fmt::Debug for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardholderSpendingControlsSpendingLimitsInterval { +impl serde::Serialize for UpdateIssuingCardholderBuilderSpendingControlsSpendingLimitsInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6591,13 +6775,13 @@ impl serde::Serialize for UpdateIssuingCardholderSpendingControlsSpendingLimitsI } /// Specifies whether to permit authorizations on this cardholder's cards. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardholderStatus { +pub enum UpdateIssuingCardholderBuilderStatus { Active, Inactive, } -impl UpdateIssuingCardholderStatus { +impl UpdateIssuingCardholderBuilderStatus { pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderStatus::*; + use UpdateIssuingCardholderBuilderStatus::*; match self { Active => "active", Inactive => "inactive", @@ -6605,10 +6789,10 @@ impl UpdateIssuingCardholderStatus { } } -impl std::str::FromStr for UpdateIssuingCardholderStatus { +impl std::str::FromStr for UpdateIssuingCardholderBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderStatus::*; + use UpdateIssuingCardholderBuilderStatus::*; match s { "active" => Ok(Active), "inactive" => Ok(Inactive), @@ -6616,18 +6800,18 @@ impl std::str::FromStr for UpdateIssuingCardholderStatus { } } } -impl std::fmt::Display for UpdateIssuingCardholderStatus { +impl std::fmt::Display for UpdateIssuingCardholderBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingCardholderStatus { +impl std::fmt::Debug for UpdateIssuingCardholderBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingCardholderStatus { +impl serde::Serialize for UpdateIssuingCardholderBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -6635,21 +6819,99 @@ impl serde::Serialize for UpdateIssuingCardholderStatus { serializer.serialize_str(self.as_str()) } } +/// Updates the specified Issuing `Cardholder` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingCardholder<'a> { + inner: UpdateIssuingCardholderBuilder<'a>, + cardholder: &'a stripe_shared::IssuingCardholderId, +} impl<'a> UpdateIssuingCardholder<'a> { - /// Updates the specified Issuing `Cardholder` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(cardholder: &'a stripe_shared::IssuingCardholderId) -> Self { + Self { cardholder, inner: UpdateIssuingCardholderBuilder::new() } + } + pub fn billing(mut self, billing: BillingSpecs<'a>) -> Self { + self.inner.billing = Some(billing); + self + } + + pub fn company(mut self, company: CompanyParam<'a>) -> Self { + self.inner.company = Some(company); + self + } + + pub fn email(mut self, email: &'a str) -> Self { + self.inner.email = Some(email); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn individual(mut self, individual: IndividualParam<'a>) -> Self { + self.inner.individual = Some(individual); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn phone_number(mut self, phone_number: &'a str) -> Self { + self.inner.phone_number = Some(phone_number); + self + } + + pub fn preferred_locales( + mut self, + preferred_locales: &'a [stripe_shared::IssuingCardholderPreferredLocales], + ) -> Self { + self.inner.preferred_locales = Some(preferred_locales); + self + } + + pub fn spending_controls( + mut self, + spending_controls: UpdateIssuingCardholderBuilderSpendingControls<'a>, + ) -> Self { + self.inner.spending_controls = Some(spending_controls); + self + } + + pub fn status(mut self, status: UpdateIssuingCardholderBuilderStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl UpdateIssuingCardholder<'_> { + pub async fn send( &self, - client: &stripe::Client, - cardholder: &stripe_shared::IssuingCardholderId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/cardholders/{cardholder}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingCardholder<'_> { + type Output = stripe_shared::IssuingCardholder; + + fn build(&self) -> RequestBuilder { + let cardholder = self.cardholder; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/cardholders/{cardholder}")) + .form(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct RequiredAddress<'a> { /// City, district, suburb, town, or village. @@ -6742,8 +7004,7 @@ impl<'a> BillingSpecs<'a> { } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CardIssuingParam<'a> { - /// Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). - /// Required for cards backed by a Celtic program. + /// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). #[serde(skip_serializing_if = "Option::is_none")] pub user_terms_acceptance: Option>, } diff --git a/generated/stripe_issuing/src/issuing_dispute/requests.rs b/generated/stripe_issuing/src/issuing_dispute/requests.rs index 7d993bcb9..c690328c6 100644 --- a/generated/stripe_issuing/src/issuing_dispute/requests.rs +++ b/generated/stripe_issuing/src/issuing_dispute/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIssuingDispute<'a> { +pub struct ListIssuingDisputeBuilder<'a> { /// Select Issuing disputes that were created during the given date interval. #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, @@ -27,56 +31,88 @@ pub struct ListIssuingDispute<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transaction: Option<&'a str>, } -impl<'a> ListIssuingDispute<'a> { +impl<'a> ListIssuingDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Issuing `Dispute` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingDispute<'a> { + inner: ListIssuingDisputeBuilder<'a>, +} impl<'a> ListIssuingDispute<'a> { - /// Returns a list of Issuing `Dispute` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/disputes", self) + pub fn new() -> Self { + Self { inner: ListIssuingDisputeBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/disputes", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingDispute<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIssuingDispute<'a> { - pub fn new() -> Self { - Self::default() + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingDisputeStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn transaction(mut self, transaction: &'a str) -> Self { + self.inner.transaction = Some(transaction); + self } } -impl<'a> RetrieveIssuingDispute<'a> { - /// Retrieves an Issuing `Dispute` object. - pub fn send( +impl ListIssuingDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - dispute: &stripe_shared::IssuingDisputeId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/disputes/{dispute}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIssuingDispute<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/disputes").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDispute<'a> { +pub struct CreateIssuingDisputeBuilder<'a> { /// The dispute amount in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). /// If not set, defaults to the full transaction amount. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, /// Evidence provided for the dispute. #[serde(skip_serializing_if = "Option::is_none")] - pub evidence: Option>, + pub evidence: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -92,19 +128,19 @@ pub struct CreateIssuingDispute<'a> { pub transaction: Option<&'a str>, /// Params for disputes related to Treasury FinancialAccounts #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option>, + pub treasury: Option>, } -impl<'a> CreateIssuingDispute<'a> { +impl<'a> CreateIssuingDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Evidence provided for the dispute. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidence<'a> { +pub struct CreateIssuingDisputeBuilderEvidence<'a> { /// Evidence provided when `reason` is 'canceled'. #[serde(skip_serializing_if = "Option::is_none")] - pub canceled: Option>, + pub canceled: Option>, /// Evidence provided when `reason` is 'duplicate'. #[serde(skip_serializing_if = "Option::is_none")] pub duplicate: Option>, @@ -114,28 +150,28 @@ pub struct CreateIssuingDisputeEvidence<'a> { /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub merchandise_not_as_described: - Option>, + Option>, /// Evidence provided when `reason` is 'not_received'. #[serde(skip_serializing_if = "Option::is_none")] - pub not_received: Option>, + pub not_received: Option>, /// Evidence provided when `reason` is 'other'. #[serde(skip_serializing_if = "Option::is_none")] - pub other: Option>, + pub other: Option>, /// The reason for filing the dispute. The evidence should be submitted in the field of the same name. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// Evidence provided when `reason` is 'service_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub service_not_as_described: Option>, } -impl<'a> CreateIssuingDisputeEvidence<'a> { +impl<'a> CreateIssuingDisputeBuilderEvidence<'a> { pub fn new() -> Self { Self::default() } } /// Evidence provided when `reason` is 'canceled'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceCanceled<'a> { +pub struct CreateIssuingDisputeBuilderEvidenceCanceled<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -159,28 +195,28 @@ pub struct CreateIssuingDisputeEvidenceCanceled<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, /// Result of cardholder's attempt to return the product. #[serde(skip_serializing_if = "Option::is_none")] - pub return_status: Option, + pub return_status: Option, /// Date when the product was returned or attempted to be returned. #[serde(skip_serializing_if = "Option::is_none")] pub returned_at: Option, } -impl<'a> CreateIssuingDisputeEvidenceCanceled<'a> { +impl<'a> CreateIssuingDisputeBuilderEvidenceCanceled<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceCanceledProductType { +pub enum CreateIssuingDisputeBuilderEvidenceCanceledProductType { Merchandise, Service, } -impl CreateIssuingDisputeEvidenceCanceledProductType { +impl CreateIssuingDisputeBuilderEvidenceCanceledProductType { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceCanceledProductType::*; + use CreateIssuingDisputeBuilderEvidenceCanceledProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -188,10 +224,10 @@ impl CreateIssuingDisputeEvidenceCanceledProductType { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceCanceledProductType { +impl std::str::FromStr for CreateIssuingDisputeBuilderEvidenceCanceledProductType { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceCanceledProductType::*; + use CreateIssuingDisputeBuilderEvidenceCanceledProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -199,18 +235,18 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceCanceledProductType { } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceCanceledProductType { +impl std::fmt::Display for CreateIssuingDisputeBuilderEvidenceCanceledProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceCanceledProductType { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceCanceledProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceCanceledProductType { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceCanceledProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -220,13 +256,13 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceCanceledProductType { } /// Result of cardholder's attempt to return the product. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceCanceledReturnStatus { +pub enum CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { MerchantRejected, Successful, } -impl CreateIssuingDisputeEvidenceCanceledReturnStatus { +impl CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceCanceledReturnStatus::*; + use CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus::*; match self { MerchantRejected => "merchant_rejected", Successful => "successful", @@ -234,10 +270,10 @@ impl CreateIssuingDisputeEvidenceCanceledReturnStatus { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::str::FromStr for CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceCanceledReturnStatus::*; + use CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus::*; match s { "merchant_rejected" => Ok(MerchantRejected), "successful" => Ok(Successful), @@ -245,18 +281,18 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceCanceledReturnStatus { } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::fmt::Display for CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceCanceledReturnStatus { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -266,7 +302,7 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceCanceledReturnStatus { } /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { +pub struct CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribed<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -281,25 +317,26 @@ pub struct CreateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { pub return_description: Option<&'a str>, /// Result of cardholder's attempt to return the product. #[serde(skip_serializing_if = "Option::is_none")] - pub return_status: Option, + pub return_status: + Option, /// Date when the product was returned or attempted to be returned. #[serde(skip_serializing_if = "Option::is_none")] pub returned_at: Option, } -impl<'a> CreateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { +impl<'a> CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribed<'a> { pub fn new() -> Self { Self::default() } } /// Result of cardholder's attempt to return the product. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +pub enum CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { MerchantRejected, Successful, } -impl CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus::*; + use CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus::*; match self { MerchantRejected => "merchant_rejected", Successful => "successful", @@ -307,10 +344,12 @@ impl CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::str::FromStr + for CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus +{ type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus::*; + use CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus::*; match s { "merchant_rejected" => Ok(MerchantRejected), "successful" => Ok(Successful), @@ -318,18 +357,20 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribed } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::fmt::Display + for CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -339,7 +380,7 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceMerchandiseNotAsDescribedR } /// Evidence provided when `reason` is 'not_received'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceNotReceived<'a> { +pub struct CreateIssuingDisputeBuilderEvidenceNotReceived<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -354,22 +395,22 @@ pub struct CreateIssuingDisputeEvidenceNotReceived<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, } -impl<'a> CreateIssuingDisputeEvidenceNotReceived<'a> { +impl<'a> CreateIssuingDisputeBuilderEvidenceNotReceived<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceNotReceivedProductType { +pub enum CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { Merchandise, Service, } -impl CreateIssuingDisputeEvidenceNotReceivedProductType { +impl CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceNotReceivedProductType::*; + use CreateIssuingDisputeBuilderEvidenceNotReceivedProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -377,10 +418,10 @@ impl CreateIssuingDisputeEvidenceNotReceivedProductType { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceNotReceivedProductType { +impl std::str::FromStr for CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceNotReceivedProductType::*; + use CreateIssuingDisputeBuilderEvidenceNotReceivedProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -388,18 +429,18 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceNotReceivedProductType { } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceNotReceivedProductType { +impl std::fmt::Display for CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceNotReceivedProductType { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceNotReceivedProductType { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -409,7 +450,7 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceNotReceivedProductType { } /// Evidence provided when `reason` is 'other'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceOther<'a> { +pub struct CreateIssuingDisputeBuilderEvidenceOther<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -421,22 +462,22 @@ pub struct CreateIssuingDisputeEvidenceOther<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, } -impl<'a> CreateIssuingDisputeEvidenceOther<'a> { +impl<'a> CreateIssuingDisputeBuilderEvidenceOther<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceOtherProductType { +pub enum CreateIssuingDisputeBuilderEvidenceOtherProductType { Merchandise, Service, } -impl CreateIssuingDisputeEvidenceOtherProductType { +impl CreateIssuingDisputeBuilderEvidenceOtherProductType { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceOtherProductType::*; + use CreateIssuingDisputeBuilderEvidenceOtherProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -444,10 +485,10 @@ impl CreateIssuingDisputeEvidenceOtherProductType { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceOtherProductType { +impl std::str::FromStr for CreateIssuingDisputeBuilderEvidenceOtherProductType { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceOtherProductType::*; + use CreateIssuingDisputeBuilderEvidenceOtherProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -455,18 +496,18 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceOtherProductType { } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceOtherProductType { +impl std::fmt::Display for CreateIssuingDisputeBuilderEvidenceOtherProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceOtherProductType { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceOtherProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceOtherProductType { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceOtherProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -476,7 +517,7 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceOtherProductType { } /// The reason for filing the dispute. The evidence should be submitted in the field of the same name. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingDisputeEvidenceReason { +pub enum CreateIssuingDisputeBuilderEvidenceReason { Canceled, Duplicate, Fraudulent, @@ -485,9 +526,9 @@ pub enum CreateIssuingDisputeEvidenceReason { Other, ServiceNotAsDescribed, } -impl CreateIssuingDisputeEvidenceReason { +impl CreateIssuingDisputeBuilderEvidenceReason { pub fn as_str(self) -> &'static str { - use CreateIssuingDisputeEvidenceReason::*; + use CreateIssuingDisputeBuilderEvidenceReason::*; match self { Canceled => "canceled", Duplicate => "duplicate", @@ -500,10 +541,10 @@ impl CreateIssuingDisputeEvidenceReason { } } -impl std::str::FromStr for CreateIssuingDisputeEvidenceReason { +impl std::str::FromStr for CreateIssuingDisputeBuilderEvidenceReason { type Err = (); fn from_str(s: &str) -> Result { - use CreateIssuingDisputeEvidenceReason::*; + use CreateIssuingDisputeBuilderEvidenceReason::*; match s { "canceled" => Ok(Canceled), "duplicate" => Ok(Duplicate), @@ -516,18 +557,18 @@ impl std::str::FromStr for CreateIssuingDisputeEvidenceReason { } } } -impl std::fmt::Display for CreateIssuingDisputeEvidenceReason { +impl std::fmt::Display for CreateIssuingDisputeBuilderEvidenceReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIssuingDisputeEvidenceReason { +impl std::fmt::Debug for CreateIssuingDisputeBuilderEvidenceReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIssuingDisputeEvidenceReason { +impl serde::Serialize for CreateIssuingDisputeBuilderEvidenceReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -537,32 +578,88 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceReason { } /// Params for disputes related to Treasury FinancialAccounts #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingDisputeTreasury<'a> { +pub struct CreateIssuingDisputeBuilderTreasury<'a> { /// The ID of the ReceivedDebit to initiate an Issuings dispute for. pub received_debit: &'a str, } -impl<'a> CreateIssuingDisputeTreasury<'a> { +impl<'a> CreateIssuingDisputeBuilderTreasury<'a> { pub fn new(received_debit: &'a str) -> Self { Self { received_debit } } } +/// Creates an Issuing `Dispute` object. +/// Individual pieces of evidence within the `evidence` object are optional at this point. +/// Stripe only validates that required evidence is present during submission. +/// Refer to [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence) for more details about evidence requirements. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIssuingDispute<'a> { + inner: CreateIssuingDisputeBuilder<'a>, +} impl<'a> CreateIssuingDispute<'a> { - /// Creates an Issuing `Dispute` object. - /// Individual pieces of evidence within the `evidence` object are optional at this point. - /// Stripe only validates that required evidence is present during submission. - /// Refer to [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence) for more details about evidence requirements. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/issuing/disputes", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateIssuingDisputeBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn evidence(mut self, evidence: CreateIssuingDisputeBuilderEvidence<'a>) -> Self { + self.inner.evidence = Some(evidence); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn transaction(mut self, transaction: &'a str) -> Self { + self.inner.transaction = Some(transaction); + self + } + + pub fn treasury(mut self, treasury: CreateIssuingDisputeBuilderTreasury<'a>) -> Self { + self.inner.treasury = Some(treasury); + self + } +} +impl CreateIssuingDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIssuingDispute<'_> { + type Output = stripe_shared::IssuingDispute; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/issuing/disputes").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDispute<'a> { +pub struct UpdateIssuingDisputeBuilder<'a> { /// The dispute amount in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, /// Evidence provided for the dispute. #[serde(skip_serializing_if = "Option::is_none")] - pub evidence: Option>, + pub evidence: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -573,17 +670,17 @@ pub struct UpdateIssuingDispute<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateIssuingDispute<'a> { +impl<'a> UpdateIssuingDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Evidence provided for the dispute. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidence<'a> { +pub struct UpdateIssuingDisputeBuilderEvidence<'a> { /// Evidence provided when `reason` is 'canceled'. #[serde(skip_serializing_if = "Option::is_none")] - pub canceled: Option>, + pub canceled: Option>, /// Evidence provided when `reason` is 'duplicate'. #[serde(skip_serializing_if = "Option::is_none")] pub duplicate: Option>, @@ -593,28 +690,28 @@ pub struct UpdateIssuingDisputeEvidence<'a> { /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub merchandise_not_as_described: - Option>, + Option>, /// Evidence provided when `reason` is 'not_received'. #[serde(skip_serializing_if = "Option::is_none")] - pub not_received: Option>, + pub not_received: Option>, /// Evidence provided when `reason` is 'other'. #[serde(skip_serializing_if = "Option::is_none")] - pub other: Option>, + pub other: Option>, /// The reason for filing the dispute. The evidence should be submitted in the field of the same name. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// Evidence provided when `reason` is 'service_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub service_not_as_described: Option>, } -impl<'a> UpdateIssuingDisputeEvidence<'a> { +impl<'a> UpdateIssuingDisputeBuilderEvidence<'a> { pub fn new() -> Self { Self::default() } } /// Evidence provided when `reason` is 'canceled'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceCanceled<'a> { +pub struct UpdateIssuingDisputeBuilderEvidenceCanceled<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -638,28 +735,28 @@ pub struct UpdateIssuingDisputeEvidenceCanceled<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, /// Result of cardholder's attempt to return the product. #[serde(skip_serializing_if = "Option::is_none")] - pub return_status: Option, + pub return_status: Option, /// Date when the product was returned or attempted to be returned. #[serde(skip_serializing_if = "Option::is_none")] pub returned_at: Option, } -impl<'a> UpdateIssuingDisputeEvidenceCanceled<'a> { +impl<'a> UpdateIssuingDisputeBuilderEvidenceCanceled<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceCanceledProductType { +pub enum UpdateIssuingDisputeBuilderEvidenceCanceledProductType { Merchandise, Service, } -impl UpdateIssuingDisputeEvidenceCanceledProductType { +impl UpdateIssuingDisputeBuilderEvidenceCanceledProductType { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceCanceledProductType::*; + use UpdateIssuingDisputeBuilderEvidenceCanceledProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -667,10 +764,10 @@ impl UpdateIssuingDisputeEvidenceCanceledProductType { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceCanceledProductType { +impl std::str::FromStr for UpdateIssuingDisputeBuilderEvidenceCanceledProductType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceCanceledProductType::*; + use UpdateIssuingDisputeBuilderEvidenceCanceledProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -678,18 +775,18 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceCanceledProductType { } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceCanceledProductType { +impl std::fmt::Display for UpdateIssuingDisputeBuilderEvidenceCanceledProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceCanceledProductType { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceCanceledProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceCanceledProductType { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceCanceledProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -699,13 +796,13 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceCanceledProductType { } /// Result of cardholder's attempt to return the product. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceCanceledReturnStatus { +pub enum UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { MerchantRejected, Successful, } -impl UpdateIssuingDisputeEvidenceCanceledReturnStatus { +impl UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceCanceledReturnStatus::*; + use UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus::*; match self { MerchantRejected => "merchant_rejected", Successful => "successful", @@ -713,10 +810,10 @@ impl UpdateIssuingDisputeEvidenceCanceledReturnStatus { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::str::FromStr for UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceCanceledReturnStatus::*; + use UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus::*; match s { "merchant_rejected" => Ok(MerchantRejected), "successful" => Ok(Successful), @@ -724,18 +821,18 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceCanceledReturnStatus { } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::fmt::Display for UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceCanceledReturnStatus { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceCanceledReturnStatus { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceCanceledReturnStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -745,7 +842,7 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceCanceledReturnStatus { } /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { +pub struct UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribed<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -760,25 +857,26 @@ pub struct UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { pub return_description: Option<&'a str>, /// Result of cardholder's attempt to return the product. #[serde(skip_serializing_if = "Option::is_none")] - pub return_status: Option, + pub return_status: + Option, /// Date when the product was returned or attempted to be returned. #[serde(skip_serializing_if = "Option::is_none")] pub returned_at: Option, } -impl<'a> UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { +impl<'a> UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribed<'a> { pub fn new() -> Self { Self::default() } } /// Result of cardholder's attempt to return the product. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +pub enum UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { MerchantRejected, Successful, } -impl UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus::*; + use UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus::*; match self { MerchantRejected => "merchant_rejected", Successful => "successful", @@ -786,10 +884,12 @@ impl UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::str::FromStr + for UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus::*; + use UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus::*; match s { "merchant_rejected" => Ok(MerchantRejected), "successful" => Ok(Successful), @@ -797,18 +897,20 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribed } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::fmt::Display + for UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceMerchandiseNotAsDescribedReturnStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -818,7 +920,7 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribedR } /// Evidence provided when `reason` is 'not_received'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceNotReceived<'a> { +pub struct UpdateIssuingDisputeBuilderEvidenceNotReceived<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -833,22 +935,22 @@ pub struct UpdateIssuingDisputeEvidenceNotReceived<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, } -impl<'a> UpdateIssuingDisputeEvidenceNotReceived<'a> { +impl<'a> UpdateIssuingDisputeBuilderEvidenceNotReceived<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceNotReceivedProductType { +pub enum UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { Merchandise, Service, } -impl UpdateIssuingDisputeEvidenceNotReceivedProductType { +impl UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceNotReceivedProductType::*; + use UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -856,10 +958,10 @@ impl UpdateIssuingDisputeEvidenceNotReceivedProductType { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceNotReceivedProductType { +impl std::str::FromStr for UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceNotReceivedProductType::*; + use UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -867,18 +969,18 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceNotReceivedProductType { } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceNotReceivedProductType { +impl std::fmt::Display for UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceNotReceivedProductType { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceNotReceivedProductType { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceNotReceivedProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -888,7 +990,7 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceNotReceivedProductType { } /// Evidence provided when `reason` is 'other'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceOther<'a> { +pub struct UpdateIssuingDisputeBuilderEvidenceOther<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. #[serde(skip_serializing_if = "Option::is_none")] pub additional_documentation: Option<&'a str>, @@ -900,22 +1002,22 @@ pub struct UpdateIssuingDisputeEvidenceOther<'a> { pub product_description: Option<&'a str>, /// Whether the product was a merchandise or service. #[serde(skip_serializing_if = "Option::is_none")] - pub product_type: Option, + pub product_type: Option, } -impl<'a> UpdateIssuingDisputeEvidenceOther<'a> { +impl<'a> UpdateIssuingDisputeBuilderEvidenceOther<'a> { pub fn new() -> Self { Self::default() } } /// Whether the product was a merchandise or service. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceOtherProductType { +pub enum UpdateIssuingDisputeBuilderEvidenceOtherProductType { Merchandise, Service, } -impl UpdateIssuingDisputeEvidenceOtherProductType { +impl UpdateIssuingDisputeBuilderEvidenceOtherProductType { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceOtherProductType::*; + use UpdateIssuingDisputeBuilderEvidenceOtherProductType::*; match self { Merchandise => "merchandise", Service => "service", @@ -923,10 +1025,10 @@ impl UpdateIssuingDisputeEvidenceOtherProductType { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceOtherProductType { +impl std::str::FromStr for UpdateIssuingDisputeBuilderEvidenceOtherProductType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceOtherProductType::*; + use UpdateIssuingDisputeBuilderEvidenceOtherProductType::*; match s { "merchandise" => Ok(Merchandise), "service" => Ok(Service), @@ -934,18 +1036,18 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceOtherProductType { } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceOtherProductType { +impl std::fmt::Display for UpdateIssuingDisputeBuilderEvidenceOtherProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceOtherProductType { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceOtherProductType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceOtherProductType { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceOtherProductType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -955,7 +1057,7 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceOtherProductType { } /// The reason for filing the dispute. The evidence should be submitted in the field of the same name. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingDisputeEvidenceReason { +pub enum UpdateIssuingDisputeBuilderEvidenceReason { Canceled, Duplicate, Fraudulent, @@ -964,9 +1066,9 @@ pub enum UpdateIssuingDisputeEvidenceReason { Other, ServiceNotAsDescribed, } -impl UpdateIssuingDisputeEvidenceReason { +impl UpdateIssuingDisputeBuilderEvidenceReason { pub fn as_str(self) -> &'static str { - use UpdateIssuingDisputeEvidenceReason::*; + use UpdateIssuingDisputeBuilderEvidenceReason::*; match self { Canceled => "canceled", Duplicate => "duplicate", @@ -979,10 +1081,10 @@ impl UpdateIssuingDisputeEvidenceReason { } } -impl std::str::FromStr for UpdateIssuingDisputeEvidenceReason { +impl std::str::FromStr for UpdateIssuingDisputeBuilderEvidenceReason { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingDisputeEvidenceReason::*; + use UpdateIssuingDisputeBuilderEvidenceReason::*; match s { "canceled" => Ok(Canceled), "duplicate" => Ok(Duplicate), @@ -995,18 +1097,18 @@ impl std::str::FromStr for UpdateIssuingDisputeEvidenceReason { } } } -impl std::fmt::Display for UpdateIssuingDisputeEvidenceReason { +impl std::fmt::Display for UpdateIssuingDisputeBuilderEvidenceReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingDisputeEvidenceReason { +impl std::fmt::Debug for UpdateIssuingDisputeBuilderEvidenceReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingDisputeEvidenceReason { +impl serde::Serialize for UpdateIssuingDisputeBuilderEvidenceReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1014,20 +1116,116 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceReason { serializer.serialize_str(self.as_str()) } } +/// Updates the specified Issuing `Dispute` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// Properties on the `evidence` object can be unset by passing in an empty string. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingDispute<'a> { + inner: UpdateIssuingDisputeBuilder<'a>, + dispute: &'a stripe_shared::IssuingDisputeId, +} impl<'a> UpdateIssuingDispute<'a> { - /// Updates the specified Issuing `Dispute` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// Properties on the `evidence` object can be unset by passing in an empty string. - pub fn send( + pub fn new(dispute: &'a stripe_shared::IssuingDisputeId) -> Self { + Self { dispute, inner: UpdateIssuingDisputeBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn evidence(mut self, evidence: UpdateIssuingDisputeBuilderEvidence<'a>) -> Self { + self.inner.evidence = Some(evidence); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateIssuingDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - dispute: &stripe_shared::IssuingDisputeId, - ) -> stripe::Response { - client.send_form(&format!("/issuing/disputes/{dispute}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingDispute<'_> { + type Output = stripe_shared::IssuingDispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/disputes/{dispute}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct SubmitIssuingDispute<'a> { +pub struct RetrieveIssuingDisputeBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveIssuingDisputeBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves an Issuing `Dispute` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingDispute<'a> { + inner: RetrieveIssuingDisputeBuilder<'a>, + dispute: &'a stripe_shared::IssuingDisputeId, +} +impl<'a> RetrieveIssuingDispute<'a> { + pub fn new(dispute: &'a stripe_shared::IssuingDisputeId) -> Self { + Self { dispute, inner: RetrieveIssuingDisputeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingDispute<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingDispute<'_> { + type Output = stripe_shared::IssuingDispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/disputes/{dispute}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SubmitIssuingDisputeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -1038,27 +1236,59 @@ pub struct SubmitIssuingDispute<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> SubmitIssuingDispute<'a> { +impl<'a> SubmitIssuingDisputeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Submits an Issuing `Dispute` to the card network. +/// Stripe validates that all evidence fields required for the dispute’s reason are present. +/// For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence). +#[derive(Clone, Debug, serde::Serialize)] +pub struct SubmitIssuingDispute<'a> { + inner: SubmitIssuingDisputeBuilder<'a>, + dispute: &'a stripe_shared::IssuingDisputeId, +} impl<'a> SubmitIssuingDispute<'a> { - /// Submits an Issuing `Dispute` to the card network. - /// Stripe validates that all evidence fields required for the dispute’s reason are present. - /// For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence). - pub fn send( + pub fn new(dispute: &'a stripe_shared::IssuingDisputeId) -> Self { + Self { dispute, inner: SubmitIssuingDisputeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl SubmitIssuingDispute<'_> { + pub async fn send( &self, - client: &stripe::Client, - dispute: &stripe_shared::IssuingDisputeId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/disputes/{dispute}/submit"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for SubmitIssuingDispute<'_> { + type Output = stripe_shared::IssuingDispute; + + fn build(&self) -> RequestBuilder { + let dispute = self.dispute; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/disputes/{dispute}/submit")) + .form(&self.inner) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct Duplicate<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. diff --git a/generated/stripe_issuing/src/issuing_token/requests.rs b/generated/stripe_issuing/src/issuing_token/requests.rs index cb01672aa..c060c1367 100644 --- a/generated/stripe_issuing/src/issuing_token/requests.rs +++ b/generated/stripe_issuing/src/issuing_token/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListIssuingToken<'a> { +pub struct ListIssuingTokenBuilder<'a> { /// The Issuing card identifier to list tokens for. pub card: &'a str, /// Select Issuing tokens that were created during the given date interval. @@ -26,7 +30,7 @@ pub struct ListIssuingToken<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListIssuingToken<'a> { +impl<'a> ListIssuingTokenBuilder<'a> { pub fn new(card: &'a str) -> Self { Self { card, @@ -39,64 +43,142 @@ impl<'a> ListIssuingToken<'a> { } } } +/// Lists all Issuing `Token` objects for a given card. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingToken<'a> { + inner: ListIssuingTokenBuilder<'a>, +} impl<'a> ListIssuingToken<'a> { - /// Lists all Issuing `Token` objects for a given card. - pub fn send( + pub fn new(card: &'a str) -> Self { + Self { inner: ListIssuingTokenBuilder::new(card) } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_shared::IssuingTokenStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListIssuingToken<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/tokens", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/tokens", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIssuingToken<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/tokens").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingToken<'a> { +pub struct RetrieveIssuingTokenBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveIssuingToken<'a> { +impl<'a> RetrieveIssuingTokenBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves an Issuing `Token` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingToken<'a> { + inner: RetrieveIssuingTokenBuilder<'a>, + token: &'a stripe_shared::IssuingTokenId, +} impl<'a> RetrieveIssuingToken<'a> { - /// Retrieves an Issuing `Token` object. - pub fn send( + pub fn new(token: &'a stripe_shared::IssuingTokenId) -> Self { + Self { token, inner: RetrieveIssuingTokenBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingToken<'_> { + pub async fn send( &self, - client: &stripe::Client, - token: &stripe_shared::IssuingTokenId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/tokens/{token}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingToken<'_> { + type Output = stripe_shared::IssuingToken; + + fn build(&self) -> RequestBuilder { + let token = self.token; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/tokens/{token}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingToken<'a> { +pub struct UpdateIssuingTokenBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Specifies which status the token should be updated to. - pub status: UpdateIssuingTokenStatus, + pub status: UpdateIssuingTokenBuilderStatus, } -impl<'a> UpdateIssuingToken<'a> { - pub fn new(status: UpdateIssuingTokenStatus) -> Self { +impl<'a> UpdateIssuingTokenBuilder<'a> { + pub fn new(status: UpdateIssuingTokenBuilderStatus) -> Self { Self { expand: None, status } } } /// Specifies which status the token should be updated to. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingTokenStatus { +pub enum UpdateIssuingTokenBuilderStatus { Active, Deleted, Suspended, } -impl UpdateIssuingTokenStatus { +impl UpdateIssuingTokenBuilderStatus { pub fn as_str(self) -> &'static str { - use UpdateIssuingTokenStatus::*; + use UpdateIssuingTokenBuilderStatus::*; match self { Active => "active", Deleted => "deleted", @@ -105,10 +187,10 @@ impl UpdateIssuingTokenStatus { } } -impl std::str::FromStr for UpdateIssuingTokenStatus { +impl std::str::FromStr for UpdateIssuingTokenBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIssuingTokenStatus::*; + use UpdateIssuingTokenBuilderStatus::*; match s { "active" => Ok(Active), "deleted" => Ok(Deleted), @@ -117,18 +199,18 @@ impl std::str::FromStr for UpdateIssuingTokenStatus { } } } -impl std::fmt::Display for UpdateIssuingTokenStatus { +impl std::fmt::Display for UpdateIssuingTokenBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIssuingTokenStatus { +impl std::fmt::Debug for UpdateIssuingTokenBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIssuingTokenStatus { +impl serde::Serialize for UpdateIssuingTokenBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -136,13 +218,46 @@ impl serde::Serialize for UpdateIssuingTokenStatus { serializer.serialize_str(self.as_str()) } } +/// Attempts to update the specified Issuing `Token` object to the status specified. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingToken<'a> { + inner: UpdateIssuingTokenBuilder<'a>, + token: &'a stripe_shared::IssuingTokenId, +} impl<'a> UpdateIssuingToken<'a> { - /// Attempts to update the specified Issuing `Token` object to the status specified. - pub fn send( + pub fn new( + token: &'a stripe_shared::IssuingTokenId, + status: UpdateIssuingTokenBuilderStatus, + ) -> Self { + Self { token, inner: UpdateIssuingTokenBuilder::new(status) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl UpdateIssuingToken<'_> { + pub async fn send( &self, - client: &stripe::Client, - token: &stripe_shared::IssuingTokenId, - ) -> stripe::Response { - client.send_form(&format!("/issuing/tokens/{token}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingToken<'_> { + type Output = stripe_shared::IssuingToken; + + fn build(&self) -> RequestBuilder { + let token = self.token; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/tokens/{token}")) + .form(&self.inner) } } diff --git a/generated/stripe_issuing/src/issuing_transaction/requests.rs b/generated/stripe_issuing/src/issuing_transaction/requests.rs index d4381d15b..50cfd512e 100644 --- a/generated/stripe_issuing/src/issuing_transaction/requests.rs +++ b/generated/stripe_issuing/src/issuing_transaction/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIssuingTransaction<'a> { +pub struct ListIssuingTransactionBuilder<'a> { /// Only return transactions that belong to the given card. #[serde(skip_serializing_if = "Option::is_none")] pub card: Option<&'a str>, @@ -31,49 +35,137 @@ pub struct ListIssuingTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> ListIssuingTransaction<'a> { +impl<'a> ListIssuingTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Issuing `Transaction` objects. +/// The objects are sorted in descending order by creation date, with the most recently created object appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIssuingTransaction<'a> { + inner: ListIssuingTransactionBuilder<'a>, +} impl<'a> ListIssuingTransaction<'a> { - /// Returns a list of Issuing `Transaction` objects. - /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListIssuingTransactionBuilder::new() } + } + pub fn card(mut self, card: &'a str) -> Self { + self.inner.card = Some(card); + self + } + + pub fn cardholder(mut self, cardholder: &'a str) -> Self { + self.inner.cardholder = Some(cardholder); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: stripe_shared::IssuingTransactionType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl ListIssuingTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/issuing/transactions", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/issuing/transactions", self) +} + +impl StripeRequest for ListIssuingTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/issuing/transactions").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingTransaction<'a> { +pub struct RetrieveIssuingTransactionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveIssuingTransaction<'a> { +impl<'a> RetrieveIssuingTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves an Issuing `Transaction` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIssuingTransaction<'a> { + inner: RetrieveIssuingTransactionBuilder<'a>, + transaction: &'a stripe_shared::IssuingTransactionId, +} impl<'a> RetrieveIssuingTransaction<'a> { - /// Retrieves an Issuing `Transaction` object. - pub fn send( + pub fn new(transaction: &'a stripe_shared::IssuingTransactionId) -> Self { + Self { transaction, inner: RetrieveIssuingTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIssuingTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - transaction: &stripe_shared::IssuingTransactionId, - ) -> stripe::Response { - client.get_query(&format!("/issuing/transactions/{transaction}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIssuingTransaction<'_> { + type Output = stripe_shared::IssuingTransaction; + + fn build(&self) -> RequestBuilder { + let transaction = self.transaction; + RequestBuilder::new(StripeMethod::Get, format!("/issuing/transactions/{transaction}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingTransaction<'a> { +pub struct UpdateIssuingTransactionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -84,57 +176,59 @@ pub struct UpdateIssuingTransaction<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateIssuingTransaction<'a> { +impl<'a> UpdateIssuingTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified Issuing `Transaction` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIssuingTransaction<'a> { + inner: UpdateIssuingTransactionBuilder<'a>, + transaction: &'a stripe_shared::IssuingTransactionId, +} impl<'a> UpdateIssuingTransaction<'a> { - /// Updates the specified Issuing `Transaction` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( - &self, - client: &stripe::Client, - transaction: &stripe_shared::IssuingTransactionId, - ) -> stripe::Response { - client.send_form( - &format!("/issuing/transactions/{transaction}"), - self, - http_types::Method::Post, - ) + pub fn new(transaction: &'a stripe_shared::IssuingTransactionId) -> Self { + Self { transaction, inner: UpdateIssuingTransactionBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RefundIssuingTransaction<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The total amount to attempt to refund. - /// This amount is in the provided currency, or defaults to the cards currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - #[serde(skip_serializing_if = "Option::is_none")] - pub refund_amount: Option, -} -impl<'a> RefundIssuingTransaction<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self } } -impl<'a> RefundIssuingTransaction<'a> { - /// Refund a test-mode Transaction. - pub fn send( +impl UpdateIssuingTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - transaction: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/issuing/transactions/{transaction}/refund"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateIssuingTransaction<'_> { + type Output = stripe_shared::IssuingTransaction; + + fn build(&self) -> RequestBuilder { + let transaction = self.transaction; + RequestBuilder::new(StripeMethod::Post, format!("/issuing/transactions/{transaction}")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransaction<'a> { +pub struct CreateForceCaptureIssuingTransactionBuilder<'a> { /// The total amount to attempt to capture. /// This amount is in the provided currency, or defaults to the cards currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). pub amount: i64, @@ -151,12 +245,12 @@ pub struct CreateForceCaptureIssuingTransaction<'a> { pub expand: Option<&'a [&'a str]>, /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[serde(skip_serializing_if = "Option::is_none")] - pub merchant_data: Option>, + pub merchant_data: Option>, /// Additional purchase information that is optionally provided by the merchant. #[serde(skip_serializing_if = "Option::is_none")] - pub purchase_details: Option>, + pub purchase_details: Option>, } -impl<'a> CreateForceCaptureIssuingTransaction<'a> { +impl<'a> CreateForceCaptureIssuingTransactionBuilder<'a> { pub fn new(amount: i64, card: &'a str) -> Self { Self { amount, @@ -170,11 +264,11 @@ impl<'a> CreateForceCaptureIssuingTransaction<'a> { } /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionMerchantData<'a> { +pub struct CreateForceCaptureIssuingTransactionBuilderMerchantData<'a> { /// A categorization of the seller's type of business. /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[serde(skip_serializing_if = "Option::is_none")] - pub category: Option, + pub category: Option, /// City where the seller is located #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -201,7 +295,7 @@ pub struct CreateForceCaptureIssuingTransactionMerchantData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> CreateForceCaptureIssuingTransactionMerchantData<'a> { +impl<'a> CreateForceCaptureIssuingTransactionBuilderMerchantData<'a> { pub fn new() -> Self { Self::default() } @@ -210,7 +304,7 @@ impl<'a> CreateForceCaptureIssuingTransactionMerchantData<'a> { /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateForceCaptureIssuingTransactionMerchantDataCategory { +pub enum CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -508,9 +602,9 @@ pub enum CreateForceCaptureIssuingTransactionMerchantDataCategory { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateForceCaptureIssuingTransactionMerchantDataCategory { +impl CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { pub fn as_str(self) -> &'static str { - use CreateForceCaptureIssuingTransactionMerchantDataCategory::*; + use CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -855,10 +949,10 @@ impl CreateForceCaptureIssuingTransactionMerchantDataCategory { } } -impl std::str::FromStr for CreateForceCaptureIssuingTransactionMerchantDataCategory { +impl std::str::FromStr for CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { type Err = (); fn from_str(s: &str) -> Result { - use CreateForceCaptureIssuingTransactionMerchantDataCategory::*; + use CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -1206,18 +1300,18 @@ impl std::str::FromStr for CreateForceCaptureIssuingTransactionMerchantDataCateg } } } -impl std::fmt::Display for CreateForceCaptureIssuingTransactionMerchantDataCategory { +impl std::fmt::Display for CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateForceCaptureIssuingTransactionMerchantDataCategory { +impl std::fmt::Debug for CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateForceCaptureIssuingTransactionMerchantDataCategory { +impl serde::Serialize for CreateForceCaptureIssuingTransactionBuilderMerchantDataCategory { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1227,13 +1321,13 @@ impl serde::Serialize for CreateForceCaptureIssuingTransactionMerchantDataCatego } /// Additional purchase information that is optionally provided by the merchant. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetails<'a> { +pub struct CreateForceCaptureIssuingTransactionBuilderPurchaseDetails<'a> { /// Information about the flight that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub flight: Option>, /// Information about fuel that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub fuel: Option>, + pub fuel: Option>, /// Information about lodging that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub lodging: Option, @@ -1244,22 +1338,22 @@ pub struct CreateForceCaptureIssuingTransactionPurchaseDetails<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub reference: Option<&'a str>, } -impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetails<'a> { +impl<'a> CreateForceCaptureIssuingTransactionBuilderPurchaseDetails<'a> { pub fn new() -> Self { Self::default() } } /// Information about fuel that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsFuel<'a> { +pub struct CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[serde(skip_serializing_if = "Option::is_none")] - pub unit: Option, + pub unit: Option, /// The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. #[serde(skip_serializing_if = "Option::is_none")] pub unit_cost_decimal: Option<&'a str>, @@ -1267,7 +1361,7 @@ pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsFuel<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub volume_decimal: Option<&'a str>, } -impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetailsFuel<'a> { +impl<'a> CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuel<'a> { pub fn new() -> Self { Self::default() } @@ -1275,16 +1369,16 @@ impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +pub enum CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { Diesel, Other, UnleadedPlus, UnleadedRegular, UnleadedSuper, } -impl CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +impl CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { pub fn as_str(self) -> &'static str { - use CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType::*; + use CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType::*; match self { Diesel => "diesel", Other => "other", @@ -1295,10 +1389,10 @@ impl CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { } } -impl std::str::FromStr for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +impl std::str::FromStr for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { type Err = (); fn from_str(s: &str) -> Result { - use CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType::*; + use CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType::*; match s { "diesel" => Ok(Diesel), "other" => Ok(Other), @@ -1309,18 +1403,18 @@ impl std::str::FromStr for CreateForceCaptureIssuingTransactionPurchaseDetailsFu } } } -impl std::fmt::Display for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +impl std::fmt::Display for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +impl std::fmt::Debug for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelType { +impl serde::Serialize for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1330,13 +1424,13 @@ impl serde::Serialize for CreateForceCaptureIssuingTransactionPurchaseDetailsFue } /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +pub enum CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { Liter, UsGallon, } -impl CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +impl CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { pub fn as_str(self) -> &'static str { - use CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit::*; + use CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit::*; match self { Liter => "liter", UsGallon => "us_gallon", @@ -1344,10 +1438,10 @@ impl CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { } } -impl std::str::FromStr for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +impl std::str::FromStr for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit::*; + use CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit::*; match s { "liter" => Ok(Liter), "us_gallon" => Ok(UsGallon), @@ -1355,18 +1449,18 @@ impl std::str::FromStr for CreateForceCaptureIssuingTransactionPurchaseDetailsFu } } } -impl std::fmt::Display for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +impl std::fmt::Display for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +impl std::fmt::Debug for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateForceCaptureIssuingTransactionPurchaseDetailsFuelUnit { +impl serde::Serialize for CreateForceCaptureIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1374,21 +1468,70 @@ impl serde::Serialize for CreateForceCaptureIssuingTransactionPurchaseDetailsFue serializer.serialize_str(self.as_str()) } } +/// Allows the user to capture an arbitrary amount, also known as a forced capture. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateForceCaptureIssuingTransaction<'a> { + inner: CreateForceCaptureIssuingTransactionBuilder<'a>, +} impl<'a> CreateForceCaptureIssuingTransaction<'a> { - /// Allows the user to capture an arbitrary amount, also known as a forced capture. - pub fn send( + pub fn new(amount: i64, card: &'a str) -> Self { + Self { inner: CreateForceCaptureIssuingTransactionBuilder::new(amount, card) } + } + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn merchant_data( + mut self, + merchant_data: CreateForceCaptureIssuingTransactionBuilderMerchantData<'a>, + ) -> Self { + self.inner.merchant_data = Some(merchant_data); + self + } + + pub fn purchase_details( + mut self, + purchase_details: CreateForceCaptureIssuingTransactionBuilderPurchaseDetails<'a>, + ) -> Self { + self.inner.purchase_details = Some(purchase_details); + self + } +} +impl CreateForceCaptureIssuingTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form( + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateForceCaptureIssuingTransaction<'_> { + type Output = stripe_shared::IssuingTransaction; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new( + StripeMethod::Post, "/test_helpers/issuing/transactions/create_force_capture", - self, - http_types::Method::Post, ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransaction<'a> { +pub struct CreateUnlinkedRefundIssuingTransactionBuilder<'a> { /// The total amount to attempt to refund. /// This amount is in the provided currency, or defaults to the cards currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). pub amount: i64, @@ -1405,12 +1548,12 @@ pub struct CreateUnlinkedRefundIssuingTransaction<'a> { pub expand: Option<&'a [&'a str]>, /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[serde(skip_serializing_if = "Option::is_none")] - pub merchant_data: Option>, + pub merchant_data: Option>, /// Additional purchase information that is optionally provided by the merchant. #[serde(skip_serializing_if = "Option::is_none")] - pub purchase_details: Option>, + pub purchase_details: Option>, } -impl<'a> CreateUnlinkedRefundIssuingTransaction<'a> { +impl<'a> CreateUnlinkedRefundIssuingTransactionBuilder<'a> { pub fn new(amount: i64, card: &'a str) -> Self { Self { amount, @@ -1424,11 +1567,11 @@ impl<'a> CreateUnlinkedRefundIssuingTransaction<'a> { } /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionMerchantData<'a> { +pub struct CreateUnlinkedRefundIssuingTransactionBuilderMerchantData<'a> { /// A categorization of the seller's type of business. /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[serde(skip_serializing_if = "Option::is_none")] - pub category: Option, + pub category: Option, /// City where the seller is located #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1455,7 +1598,7 @@ pub struct CreateUnlinkedRefundIssuingTransactionMerchantData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> CreateUnlinkedRefundIssuingTransactionMerchantData<'a> { +impl<'a> CreateUnlinkedRefundIssuingTransactionBuilderMerchantData<'a> { pub fn new() -> Self { Self::default() } @@ -1464,7 +1607,7 @@ impl<'a> CreateUnlinkedRefundIssuingTransactionMerchantData<'a> { /// See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +pub enum CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { AcRefrigerationRepair, AccountingBookkeepingServices, AdvertisingServices, @@ -1762,9 +1905,9 @@ pub enum CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +impl CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { pub fn as_str(self) -> &'static str { - use CreateUnlinkedRefundIssuingTransactionMerchantDataCategory::*; + use CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory::*; match self { AcRefrigerationRepair => "ac_refrigeration_repair", AccountingBookkeepingServices => "accounting_bookkeeping_services", @@ -2109,10 +2252,10 @@ impl CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { } } -impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { type Err = (); fn from_str(s: &str) -> Result { - use CreateUnlinkedRefundIssuingTransactionMerchantDataCategory::*; + use CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory::*; match s { "ac_refrigeration_repair" => Ok(AcRefrigerationRepair), "accounting_bookkeeping_services" => Ok(AccountingBookkeepingServices), @@ -2460,18 +2603,18 @@ impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionMerchantDataCat } } } -impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionMerchantDataCategory { +impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionBuilderMerchantDataCategory { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2481,13 +2624,13 @@ impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionMerchantDataCate } /// Additional purchase information that is optionally provided by the merchant. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetails<'a> { +pub struct CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetails<'a> { /// Information about the flight that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub flight: Option>, /// Information about fuel that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub fuel: Option>, + pub fuel: Option>, /// Information about lodging that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub lodging: Option, @@ -2498,22 +2641,22 @@ pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetails<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub reference: Option<&'a str>, } -impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetails<'a> { +impl<'a> CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetails<'a> { pub fn new() -> Self { Self::default() } } /// Information about fuel that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuel<'a> { +pub struct CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[serde(skip_serializing_if = "Option::is_none")] - pub unit: Option, + pub unit: Option, /// The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. #[serde(skip_serializing_if = "Option::is_none")] pub unit_cost_decimal: Option<&'a str>, @@ -2521,7 +2664,7 @@ pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuel<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub volume_decimal: Option<&'a str>, } -impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuel<'a> { +impl<'a> CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuel<'a> { pub fn new() -> Self { Self::default() } @@ -2529,16 +2672,16 @@ impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuel<'a> { /// The type of fuel that was purchased. /// One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +pub enum CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { Diesel, Other, UnleadedPlus, UnleadedRegular, UnleadedSuper, } -impl CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +impl CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { pub fn as_str(self) -> &'static str { - use CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType::*; + use CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType::*; match self { Diesel => "diesel", Other => "other", @@ -2549,10 +2692,10 @@ impl CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { } } -impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { type Err = (); fn from_str(s: &str) -> Result { - use CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType::*; + use CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType::*; match s { "diesel" => Ok(Diesel), "other" => Ok(Other), @@ -2563,18 +2706,18 @@ impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionPurchaseDetails } } } -impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelType { +impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2584,13 +2727,13 @@ impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsF } /// The units for `volume_decimal`. One of `us_gallon` or `liter`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +pub enum CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { Liter, UsGallon, } -impl CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +impl CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { pub fn as_str(self) -> &'static str { - use CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit::*; + use CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit::*; match self { Liter => "liter", UsGallon => "us_gallon", @@ -2598,10 +2741,10 @@ impl CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { } } -impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit::*; + use CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit::*; match s { "liter" => Ok(Liter), "us_gallon" => Ok(UsGallon), @@ -2609,18 +2752,18 @@ impl std::str::FromStr for CreateUnlinkedRefundIssuingTransactionPurchaseDetails } } } -impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +impl std::fmt::Display for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +impl std::fmt::Debug for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuelUnit { +impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetailsFuelUnit { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2628,19 +2771,132 @@ impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsF serializer.serialize_str(self.as_str()) } } +/// Allows the user to refund an arbitrary amount, also known as a unlinked refund. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateUnlinkedRefundIssuingTransaction<'a> { + inner: CreateUnlinkedRefundIssuingTransactionBuilder<'a>, +} impl<'a> CreateUnlinkedRefundIssuingTransaction<'a> { - /// Allows the user to refund an arbitrary amount, also known as a unlinked refund. - pub fn send( + pub fn new(amount: i64, card: &'a str) -> Self { + Self { inner: CreateUnlinkedRefundIssuingTransactionBuilder::new(amount, card) } + } + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn merchant_data( + mut self, + merchant_data: CreateUnlinkedRefundIssuingTransactionBuilderMerchantData<'a>, + ) -> Self { + self.inner.merchant_data = Some(merchant_data); + self + } + + pub fn purchase_details( + mut self, + purchase_details: CreateUnlinkedRefundIssuingTransactionBuilderPurchaseDetails<'a>, + ) -> Self { + self.inner.purchase_details = Some(purchase_details); + self + } +} +impl CreateUnlinkedRefundIssuingTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form( + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateUnlinkedRefundIssuingTransaction<'_> { + type Output = stripe_shared::IssuingTransaction; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new( + StripeMethod::Post, "/test_helpers/issuing/transactions/create_unlinked_refund", - self, - http_types::Method::Post, ) + .form(&self.inner) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RefundIssuingTransactionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// The total amount to attempt to refund. + /// This amount is in the provided currency, or defaults to the cards currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + #[serde(skip_serializing_if = "Option::is_none")] + pub refund_amount: Option, +} +impl<'a> RefundIssuingTransactionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Refund a test-mode Transaction. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RefundIssuingTransaction<'a> { + inner: RefundIssuingTransactionBuilder<'a>, + transaction: &'a str, +} +impl<'a> RefundIssuingTransaction<'a> { + pub fn new(transaction: &'a str) -> Self { + Self { transaction, inner: RefundIssuingTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn refund_amount(mut self, refund_amount: i64) -> Self { + self.inner.refund_amount = Some(refund_amount); + self + } +} +impl RefundIssuingTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RefundIssuingTransaction<'_> { + type Output = stripe_shared::IssuingTransaction; + + fn build(&self) -> RequestBuilder { + let transaction = self.transaction; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/issuing/transactions/{transaction}/refund"), + ) + .form(&self.inner) + } +} + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct FlightSegmentSpecs<'a> { /// The three-letter IATA airport code of the flight's destination. diff --git a/generated/stripe_misc/Cargo.toml b/generated/stripe_misc/Cargo.toml index 6d58514f3..bf497bd36 100644 --- a/generated/stripe_misc/Cargo.toml +++ b/generated/stripe_misc/Cargo.toml @@ -19,32 +19,17 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - apple_pay_domain = [] -climate_order = [] -climate_product = [] -climate_supplier = [] ephemeral_key = [] exchange_rate = [] financial_connections_account = [] financial_connections_session = [] -financial_connections_transaction = [] identity_verification_report = [] identity_verification_session = [] reporting_report_run = [] @@ -57,14 +42,10 @@ tax_transaction = [] webhook_endpoint = [] full = ["apple_pay_domain", -"climate_order", -"climate_product", -"climate_supplier", "ephemeral_key", "exchange_rate", "financial_connections_account", "financial_connections_session", -"financial_connections_transaction", "identity_verification_report", "identity_verification_session", "reporting_report_run", @@ -78,5 +59,5 @@ full = ["apple_pay_domain", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_misc/src/apple_pay_domain/requests.rs b/generated/stripe_misc/src/apple_pay_domain/requests.rs index 7c2460d5f..9011881a1 100644 --- a/generated/stripe_misc/src/apple_pay_domain/requests.rs +++ b/generated/stripe_misc/src/apple_pay_domain/requests.rs @@ -1,22 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteApplePayDomain {} -impl DeleteApplePayDomain { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteApplePayDomain { - /// Delete an apple pay domain. - pub fn send( - &self, - client: &stripe::Client, - domain: &str, - ) -> stripe::Response { - client.send_form(&format!("/apple_pay/domains/{domain}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListApplePayDomain<'a> { +pub struct ListApplePayDomainBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub domain_name: Option<&'a str>, /// A cursor for use in pagination. @@ -37,61 +24,199 @@ pub struct ListApplePayDomain<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListApplePayDomain<'a> { +impl<'a> ListApplePayDomainBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// List apple pay domains. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListApplePayDomain<'a> { + inner: ListApplePayDomainBuilder<'a>, +} impl<'a> ListApplePayDomain<'a> { - /// List apple pay domains. - pub fn send( + pub fn new() -> Self { + Self { inner: ListApplePayDomainBuilder::new() } + } + pub fn domain_name(mut self, domain_name: &'a str) -> Self { + self.inner.domain_name = Some(domain_name); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListApplePayDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/apple_pay/domains", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListApplePayDomain<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/apple_pay/domains").query(&self.inner) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/apple_pay/domains", self) +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreateApplePayDomainBuilder<'a> { + pub domain_name: &'a str, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CreateApplePayDomainBuilder<'a> { + pub fn new(domain_name: &'a str) -> Self { + Self { domain_name, expand: None } + } +} +/// Create an apple pay domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateApplePayDomain<'a> { + inner: CreateApplePayDomainBuilder<'a>, +} +impl<'a> CreateApplePayDomain<'a> { + pub fn new(domain_name: &'a str) -> Self { + Self { inner: CreateApplePayDomainBuilder::new(domain_name) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreateApplePayDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateApplePayDomain<'_> { + type Output = stripe_misc::ApplePayDomain; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/apple_pay/domains").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveApplePayDomain<'a> { +pub struct RetrieveApplePayDomainBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveApplePayDomain<'a> { +impl<'a> RetrieveApplePayDomainBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieve an apple pay domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveApplePayDomain<'a> { + inner: RetrieveApplePayDomainBuilder<'a>, + domain: &'a str, +} impl<'a> RetrieveApplePayDomain<'a> { - /// Retrieve an apple pay domain. - pub fn send( + pub fn new(domain: &'a str) -> Self { + Self { domain, inner: RetrieveApplePayDomainBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveApplePayDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - domain: &str, - ) -> stripe::Response { - client.get_query(&format!("/apple_pay/domains/{domain}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateApplePayDomain<'a> { - pub domain_name: &'a str, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + +impl StripeRequest for RetrieveApplePayDomain<'_> { + type Output = stripe_misc::ApplePayDomain; + + fn build(&self) -> RequestBuilder { + let domain = self.domain; + RequestBuilder::new(StripeMethod::Get, format!("/apple_pay/domains/{domain}")) + .query(&self.inner) + } } -impl<'a> CreateApplePayDomain<'a> { - pub fn new(domain_name: &'a str) -> Self { - Self { domain_name, expand: None } +/// Delete an apple pay domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteApplePayDomain<'a> { + domain: &'a str, +} +impl<'a> DeleteApplePayDomain<'a> { + pub fn new(domain: &'a str) -> Self { + Self { domain } } } -impl<'a> CreateApplePayDomain<'a> { - /// Create an apple pay domain. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/apple_pay/domains", self, http_types::Method::Post) +impl DeleteApplePayDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteApplePayDomain<'_> { + type Output = stripe_misc::DeletedApplePayDomain; + + fn build(&self) -> RequestBuilder { + let domain = self.domain; + RequestBuilder::new(StripeMethod::Delete, format!("/apple_pay/domains/{domain}")) } } diff --git a/generated/stripe_misc/src/bank_connections_resource_balance_refresh.rs b/generated/stripe_misc/src/bank_connections_resource_balance_refresh.rs index e745207aa..59cc32ea7 100644 --- a/generated/stripe_misc/src/bank_connections_resource_balance_refresh.rs +++ b/generated/stripe_misc/src/bank_connections_resource_balance_refresh.rs @@ -2,10 +2,6 @@ pub struct BankConnectionsResourceBalanceRefresh { /// The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. pub last_attempted_at: stripe_types::Timestamp, - /// Time at which the next balance refresh can be initiated. - /// This value will be `null` when `status` is `pending`. - /// Measured in seconds since the Unix epoch. - pub next_refresh_available_at: Option, /// The status of the last refresh attempt. pub status: BankConnectionsResourceBalanceRefreshStatus, } diff --git a/generated/stripe_misc/src/bank_connections_resource_transaction_refresh.rs b/generated/stripe_misc/src/bank_connections_resource_transaction_refresh.rs deleted file mode 100644 index f42f5591a..000000000 --- a/generated/stripe_misc/src/bank_connections_resource_transaction_refresh.rs +++ /dev/null @@ -1,80 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct BankConnectionsResourceTransactionRefresh { - /// Unique identifier for the object. - pub id: stripe_misc::BankConnectionsResourceTransactionRefreshId, - /// The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. - pub last_attempted_at: stripe_types::Timestamp, - /// Time at which the next transaction refresh can be initiated. - /// This value will be `null` when `status` is `pending`. - /// Measured in seconds since the Unix epoch. - pub next_refresh_available_at: Option, - /// The status of the last refresh attempt. - pub status: BankConnectionsResourceTransactionRefreshStatus, -} -/// The status of the last refresh attempt. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum BankConnectionsResourceTransactionRefreshStatus { - Failed, - Pending, - Succeeded, -} -impl BankConnectionsResourceTransactionRefreshStatus { - pub fn as_str(self) -> &'static str { - use BankConnectionsResourceTransactionRefreshStatus::*; - match self { - Failed => "failed", - Pending => "pending", - Succeeded => "succeeded", - } - } -} - -impl std::str::FromStr for BankConnectionsResourceTransactionRefreshStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use BankConnectionsResourceTransactionRefreshStatus::*; - match s { - "failed" => Ok(Failed), - "pending" => Ok(Pending), - "succeeded" => Ok(Succeeded), - _ => Err(()), - } - } -} -impl std::fmt::Display for BankConnectionsResourceTransactionRefreshStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for BankConnectionsResourceTransactionRefreshStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for BankConnectionsResourceTransactionRefreshStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for BankConnectionsResourceTransactionRefreshStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for BankConnectionsResourceTransactionRefreshStatus", - ) - }) - } -} -impl stripe_types::Object for BankConnectionsResourceTransactionRefresh { - type Id = stripe_misc::BankConnectionsResourceTransactionRefreshId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(BankConnectionsResourceTransactionRefreshId); diff --git a/generated/stripe_misc/src/bank_connections_resource_transaction_resource_status_transitions.rs b/generated/stripe_misc/src/bank_connections_resource_transaction_resource_status_transitions.rs deleted file mode 100644 index cfbe46044..000000000 --- a/generated/stripe_misc/src/bank_connections_resource_transaction_resource_status_transitions.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct BankConnectionsResourceTransactionResourceStatusTransitions { - /// Time at which this transaction posted. Measured in seconds since the Unix epoch. - pub posted_at: Option, - /// Time at which this transaction was voided. Measured in seconds since the Unix epoch. - pub void_at: Option, -} diff --git a/generated/stripe_misc/src/climate_order/mod.rs b/generated/stripe_misc/src/climate_order/mod.rs deleted file mode 100644 index 0c0680d82..000000000 --- a/generated/stripe_misc/src/climate_order/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "climate_order")] -mod requests; -pub(crate) mod types; -#[cfg(feature = "climate_order")] -pub use requests::*; diff --git a/generated/stripe_misc/src/climate_order/requests.rs b/generated/stripe_misc/src/climate_order/requests.rs deleted file mode 100644 index 7487dc31f..000000000 --- a/generated/stripe_misc/src/climate_order/requests.rs +++ /dev/null @@ -1,173 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListClimateOrder<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListClimateOrder<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListClimateOrder<'a> { - /// Lists all Climate order objects. The orders are returned sorted by creation date, with the - /// most recently created orders appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/climate/orders", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/climate/orders", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveClimateOrder<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveClimateOrder<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveClimateOrder<'a> { - /// Retrieves the details of a Climate order object with the given ID. - pub fn send( - &self, - client: &stripe::Client, - order: &stripe_misc::ClimateOrderId, - ) -> stripe::Response { - client.get_query(&format!("/climate/orders/{order}"), self) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateClimateOrder<'a> { - /// Requested amount of carbon removal units. Either this or `metric_tons` must be specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// Publicly sharable reference for the end beneficiary of carbon removal. - /// Assumed to be the Stripe account if not set. - #[serde(skip_serializing_if = "Option::is_none")] - pub beneficiary: Option>, - /// Request currency for the order as a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a supported [settlement currency for your account](https://stripe.com/docs/currencies). - /// If omitted, the account's default currency will be used. - #[serde(skip_serializing_if = "Option::is_none")] - pub currency: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// Requested number of tons for the order. Either this or `amount` must be specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub metric_tons: Option<&'a str>, - /// Unique identifier of the Climate product. - pub product: &'a str, -} -impl<'a> CreateClimateOrder<'a> { - pub fn new(product: &'a str) -> Self { - Self { - amount: None, - beneficiary: None, - currency: None, - expand: None, - metadata: None, - metric_tons: None, - product, - } - } -} -impl<'a> CreateClimateOrder<'a> { - /// Creates a Climate order object for a given Climate product. The order will be processed immediately - /// after creation and payment will be deducted your Stripe balance. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/climate/orders", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateClimateOrder<'a> { - /// Publicly sharable reference for the end beneficiary of carbon removal. - /// Assumed to be the Stripe account if not set. - #[serde(skip_serializing_if = "Option::is_none")] - pub beneficiary: Option>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, -} -impl<'a> UpdateClimateOrder<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> UpdateClimateOrder<'a> { - /// Updates the specified order by setting the values of the parameters passed. - pub fn send( - &self, - client: &stripe::Client, - order: &stripe_misc::ClimateOrderId, - ) -> stripe::Response { - client.send_form(&format!("/climate/orders/{order}"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelClimateOrder<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelClimateOrder<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> CancelClimateOrder<'a> { - /// Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the - /// reservation `amount_subtotal`, but not the `amount_fees` for user-triggered cancellations. Frontier - /// might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe - /// provides 90 days advance notice and refunds the `amount_total`. - pub fn send( - &self, - client: &stripe::Client, - order: &stripe_misc::ClimateOrderId, - ) -> stripe::Response { - client.send_form(&format!("/climate/orders/{order}/cancel"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct BeneficiaryParams<'a> { - /// Publicly displayable name for the end beneficiary of carbon removal. - pub public_name: &'a str, -} -impl<'a> BeneficiaryParams<'a> { - pub fn new(public_name: &'a str) -> Self { - Self { public_name } - } -} diff --git a/generated/stripe_misc/src/climate_order/types.rs b/generated/stripe_misc/src/climate_order/types.rs deleted file mode 100644 index bf65955ee..000000000 --- a/generated/stripe_misc/src/climate_order/types.rs +++ /dev/null @@ -1,179 +0,0 @@ -/// Orders represent your intent to purchase a particular Climate product. -/// When you create an order, the. -/// payment is deducted from your merchant balance. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateOrder { - /// Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit. - pub amount_fees: i64, - /// Total amount of the carbon removal in the currency's smallest unit. - pub amount_subtotal: i64, - /// Total amount of the order including fees in the currency's smallest unit. - pub amount_total: i64, - #[serde(skip_serializing_if = "Option::is_none")] - pub beneficiary: Option, - /// Time at which the order was canceled. Measured in seconds since the Unix epoch. - pub canceled_at: Option, - /// Reason for the cancellation of this order. - pub cancellation_reason: Option, - /// For delivered orders, a URL to a delivery certificate for the order. - pub certificate: Option, - /// Time at which the order was confirmed. Measured in seconds since the Unix epoch. - pub confirmed_at: Option, - /// Time at which the object was created. Measured in seconds since the Unix epoch. - pub created: stripe_types::Timestamp, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order. - pub currency: stripe_types::Currency, - /// Time at which the order's expected_delivery_year was delayed. - /// Measured in seconds since the Unix epoch. - pub delayed_at: Option, - /// Time at which the order was delivered. Measured in seconds since the Unix epoch. - pub delivered_at: Option, - /// Details about the delivery of carbon removal for this order. - pub delivery_details: Vec, - /// The year this order is expected to be delivered. - pub expected_delivery_year: i64, - /// Unique identifier for the object. - pub id: stripe_misc::ClimateOrderId, - /// 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, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - pub metadata: std::collections::HashMap, - /// Quantity of carbon removal that is included in this order. - pub metric_tons: String, - /// Unique ID for the Climate `Product` this order is purchasing. - pub product: stripe_types::Expandable, - /// Time at which the order's product was substituted for a different product. - /// Measured in seconds since the Unix epoch. - pub product_substituted_at: Option, - /// The current status of this order. - pub status: ClimateOrderStatus, -} -/// Reason for the cancellation of this order. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ClimateOrderCancellationReason { - Expired, - ProductUnavailable, - Requested, -} -impl ClimateOrderCancellationReason { - pub fn as_str(self) -> &'static str { - use ClimateOrderCancellationReason::*; - match self { - Expired => "expired", - ProductUnavailable => "product_unavailable", - Requested => "requested", - } - } -} - -impl std::str::FromStr for ClimateOrderCancellationReason { - type Err = (); - fn from_str(s: &str) -> Result { - use ClimateOrderCancellationReason::*; - match s { - "expired" => Ok(Expired), - "product_unavailable" => Ok(ProductUnavailable), - "requested" => Ok(Requested), - _ => Err(()), - } - } -} -impl std::fmt::Display for ClimateOrderCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ClimateOrderCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ClimateOrderCancellationReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ClimateOrderCancellationReason { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for ClimateOrderCancellationReason") - }) - } -} -/// The current status of this order. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ClimateOrderStatus { - AwaitingFunds, - Canceled, - Confirmed, - Delivered, - Open, -} -impl ClimateOrderStatus { - pub fn as_str(self) -> &'static str { - use ClimateOrderStatus::*; - match self { - AwaitingFunds => "awaiting_funds", - Canceled => "canceled", - Confirmed => "confirmed", - Delivered => "delivered", - Open => "open", - } - } -} - -impl std::str::FromStr for ClimateOrderStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ClimateOrderStatus::*; - match s { - "awaiting_funds" => Ok(AwaitingFunds), - "canceled" => Ok(Canceled), - "confirmed" => Ok(Confirmed), - "delivered" => Ok(Delivered), - "open" => Ok(Open), - _ => Err(()), - } - } -} -impl std::fmt::Display for ClimateOrderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ClimateOrderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ClimateOrderStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ClimateOrderStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for ClimateOrderStatus")) - } -} -impl stripe_types::Object for ClimateOrder { - type Id = stripe_misc::ClimateOrderId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(ClimateOrderId); diff --git a/generated/stripe_misc/src/climate_product/mod.rs b/generated/stripe_misc/src/climate_product/mod.rs deleted file mode 100644 index 855638012..000000000 --- a/generated/stripe_misc/src/climate_product/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "climate_product")] -mod requests; -pub(crate) mod types; -#[cfg(feature = "climate_product")] -pub use requests::*; diff --git a/generated/stripe_misc/src/climate_product/requests.rs b/generated/stripe_misc/src/climate_product/requests.rs deleted file mode 100644 index fe787ea90..000000000 --- a/generated/stripe_misc/src/climate_product/requests.rs +++ /dev/null @@ -1,60 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListClimateProduct<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListClimateProduct<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListClimateProduct<'a> { - /// Lists all available Climate product objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/climate/products", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/climate/products", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveClimateProduct<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveClimateProduct<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveClimateProduct<'a> { - /// Retrieves the details of a Climate product with the given ID. - pub fn send( - &self, - client: &stripe::Client, - product: &stripe_misc::ClimateProductId, - ) -> stripe::Response { - client.get_query(&format!("/climate/products/{product}"), self) - } -} diff --git a/generated/stripe_misc/src/climate_product/types.rs b/generated/stripe_misc/src/climate_product/types.rs deleted file mode 100644 index dd2efbada..000000000 --- a/generated/stripe_misc/src/climate_product/types.rs +++ /dev/null @@ -1,32 +0,0 @@ -/// A Climate product represents a type of carbon removal unit available for reservation. -/// You can retrieve it to see the current price and availability. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateProduct { - /// Time at which the object was created. Measured in seconds since the Unix epoch. - pub created: stripe_types::Timestamp, - /// Current prices for a metric ton of carbon removal in a currency's smallest unit. - pub current_prices_per_metric_ton: - std::collections::HashMap, - /// The year in which the carbon removal is expected to be delivered. - pub delivery_year: Option, - /// Unique identifier for the object. For convenience, Climate product IDs are human-readable strings - /// that start with `climsku_`. - /// See [carbon removal inventory](https://stripe.com/docs/climate/orders/carbon-removal-inventory). - /// for a list of available carbon removal products. - pub id: stripe_misc::ClimateProductId, - /// 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 quantity of metric tons available for reservation. - pub metric_tons_available: String, - /// The Climate product's name. - pub name: String, - /// The carbon removal suppliers that fulfill orders for this Climate product. - pub suppliers: Vec, -} -impl stripe_types::Object for ClimateProduct { - type Id = stripe_misc::ClimateProductId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(ClimateProductId); diff --git a/generated/stripe_misc/src/climate_removals_beneficiary.rs b/generated/stripe_misc/src/climate_removals_beneficiary.rs deleted file mode 100644 index f0860a5fc..000000000 --- a/generated/stripe_misc/src/climate_removals_beneficiary.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateRemovalsBeneficiary { - /// Publicly displayable name for the end beneficiary of carbon removal. - pub public_name: String, -} diff --git a/generated/stripe_misc/src/climate_removals_location.rs b/generated/stripe_misc/src/climate_removals_location.rs deleted file mode 100644 index 7fa39bc14..000000000 --- a/generated/stripe_misc/src/climate_removals_location.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateRemovalsLocation { - /// The city where the supplier is located. - pub city: Option, - /// Two-letter ISO code representing the country where the supplier is located. - pub country: String, - /// The geographic latitude where the supplier is located. - pub latitude: Option, - /// The geographic longitude where the supplier is located. - pub longitude: Option, - /// The state/county/province/region where the supplier is located. - pub region: Option, -} diff --git a/generated/stripe_misc/src/climate_removals_order_deliveries.rs b/generated/stripe_misc/src/climate_removals_order_deliveries.rs deleted file mode 100644 index 5dab0ff00..000000000 --- a/generated/stripe_misc/src/climate_removals_order_deliveries.rs +++ /dev/null @@ -1,13 +0,0 @@ -/// The delivery of a specified quantity of carbon for an order. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateRemovalsOrderDeliveries { - /// Time at which the delivery occurred. Measured in seconds since the Unix epoch. - pub delivered_at: stripe_types::Timestamp, - /// Specific location of this delivery. - pub location: Option, - /// Quantity of carbon removal supplied by this delivery. - pub metric_tons: String, - /// Once retired, a URL to the registry entry for the tons from this delivery. - pub registry_url: Option, - pub supplier: stripe_misc::ClimateSupplier, -} diff --git a/generated/stripe_misc/src/climate_removals_products_price.rs b/generated/stripe_misc/src/climate_removals_products_price.rs deleted file mode 100644 index 13fb83ed5..000000000 --- a/generated/stripe_misc/src/climate_removals_products_price.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateRemovalsProductsPrice { - /// Fees for one metric ton of carbon removal in the currency's smallest unit. - pub amount_fees: i64, - /// Subtotal for one metric ton of carbon removal (excluding fees) in the currency's smallest unit. - pub amount_subtotal: i64, - /// Total for one metric ton of carbon removal (including fees) in the currency's smallest unit. - pub amount_total: i64, -} diff --git a/generated/stripe_misc/src/climate_supplier/mod.rs b/generated/stripe_misc/src/climate_supplier/mod.rs deleted file mode 100644 index d334a4cd5..000000000 --- a/generated/stripe_misc/src/climate_supplier/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "climate_supplier")] -mod requests; -pub(crate) mod types; -#[cfg(feature = "climate_supplier")] -pub use requests::*; diff --git a/generated/stripe_misc/src/climate_supplier/requests.rs b/generated/stripe_misc/src/climate_supplier/requests.rs deleted file mode 100644 index 193bb9685..000000000 --- a/generated/stripe_misc/src/climate_supplier/requests.rs +++ /dev/null @@ -1,60 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListClimateSupplier<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListClimateSupplier<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListClimateSupplier<'a> { - /// Lists all available Climate supplier objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/climate/suppliers", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/climate/suppliers", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveClimateSupplier<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveClimateSupplier<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveClimateSupplier<'a> { - /// Retrieves a Climate supplier object. - pub fn send( - &self, - client: &stripe::Client, - supplier: &stripe_misc::ClimateSupplierId, - ) -> stripe::Response { - client.get_query(&format!("/climate/suppliers/{supplier}"), self) - } -} diff --git a/generated/stripe_misc/src/climate_supplier/types.rs b/generated/stripe_misc/src/climate_supplier/types.rs deleted file mode 100644 index 5f4a13f13..000000000 --- a/generated/stripe_misc/src/climate_supplier/types.rs +++ /dev/null @@ -1,81 +0,0 @@ -/// A supplier of carbon removal. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ClimateSupplier { - /// Unique identifier for the object. - pub id: stripe_misc::ClimateSupplierId, - /// Link to a webpage to learn more about the supplier. - pub info_url: String, - /// 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 locations in which this supplier operates. - pub locations: Vec, - /// Name of this carbon removal supplier. - pub name: String, - /// The scientific pathway used for carbon removal. - pub removal_pathway: ClimateSupplierRemovalPathway, -} -/// The scientific pathway used for carbon removal. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ClimateSupplierRemovalPathway { - BiomassCarbonRemovalAndStorage, - DirectAirCapture, - EnhancedWeathering, -} -impl ClimateSupplierRemovalPathway { - pub fn as_str(self) -> &'static str { - use ClimateSupplierRemovalPathway::*; - match self { - BiomassCarbonRemovalAndStorage => "biomass_carbon_removal_and_storage", - DirectAirCapture => "direct_air_capture", - EnhancedWeathering => "enhanced_weathering", - } - } -} - -impl std::str::FromStr for ClimateSupplierRemovalPathway { - type Err = (); - fn from_str(s: &str) -> Result { - use ClimateSupplierRemovalPathway::*; - match s { - "biomass_carbon_removal_and_storage" => Ok(BiomassCarbonRemovalAndStorage), - "direct_air_capture" => Ok(DirectAirCapture), - "enhanced_weathering" => Ok(EnhancedWeathering), - _ => Err(()), - } - } -} -impl std::fmt::Display for ClimateSupplierRemovalPathway { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ClimateSupplierRemovalPathway { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ClimateSupplierRemovalPathway { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ClimateSupplierRemovalPathway { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for ClimateSupplierRemovalPathway") - }) - } -} -impl stripe_types::Object for ClimateSupplier { - type Id = stripe_misc::ClimateSupplierId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(ClimateSupplierId); diff --git a/generated/stripe_misc/src/ephemeral_key/requests.rs b/generated/stripe_misc/src/ephemeral_key/requests.rs index 18f1db15b..6762d55ff 100644 --- a/generated/stripe_misc/src/ephemeral_key/requests.rs +++ b/generated/stripe_misc/src/ephemeral_key/requests.rs @@ -1,26 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteEphemeralKey<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> DeleteEphemeralKey<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> DeleteEphemeralKey<'a> { - /// Invalidates a short-lived API key for a given resource. - pub fn send( - &self, - client: &stripe::Client, - key: &stripe_misc::EphemeralKeyId, - ) -> stripe::Response { - client.send_form(&format!("/ephemeral_keys/{key}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateEphemeralKey<'a> { +pub struct CreateEphemeralKeyBuilder<'a> { /// The ID of the Customer you'd like to modify using the resulting ephemeral key. #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option<&'a str>, @@ -37,14 +20,116 @@ pub struct CreateEphemeralKey<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification_session: Option<&'a str>, } -impl<'a> CreateEphemeralKey<'a> { +impl<'a> CreateEphemeralKeyBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Creates a short-lived API key for a given resource. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateEphemeralKey<'a> { + inner: CreateEphemeralKeyBuilder<'a>, +} impl<'a> CreateEphemeralKey<'a> { - /// Creates a short-lived API key for a given resource. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/ephemeral_keys", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateEphemeralKeyBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn issuing_card(mut self, issuing_card: &'a str) -> Self { + self.inner.issuing_card = Some(issuing_card); + self + } + + pub fn nonce(mut self, nonce: &'a str) -> Self { + self.inner.nonce = Some(nonce); + self + } + + pub fn verification_session(mut self, verification_session: &'a str) -> Self { + self.inner.verification_session = Some(verification_session); + self + } +} +impl CreateEphemeralKey<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateEphemeralKey<'_> { + type Output = stripe_misc::EphemeralKey; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/ephemeral_keys").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DeleteEphemeralKeyBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> DeleteEphemeralKeyBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Invalidates a short-lived API key for a given resource. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteEphemeralKey<'a> { + inner: DeleteEphemeralKeyBuilder<'a>, + key: &'a stripe_misc::EphemeralKeyId, +} +impl<'a> DeleteEphemeralKey<'a> { + pub fn new(key: &'a stripe_misc::EphemeralKeyId) -> Self { + Self { key, inner: DeleteEphemeralKeyBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DeleteEphemeralKey<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteEphemeralKey<'_> { + type Output = stripe_misc::EphemeralKey; + + fn build(&self) -> RequestBuilder { + let key = self.key; + RequestBuilder::new(StripeMethod::Delete, format!("/ephemeral_keys/{key}")) + .form(&self.inner) } } diff --git a/generated/stripe_misc/src/exchange_rate/requests.rs b/generated/stripe_misc/src/exchange_rate/requests.rs index 3b7ddffe3..9410acabb 100644 --- a/generated/stripe_misc/src/exchange_rate/requests.rs +++ b/generated/stripe_misc/src/exchange_rate/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListExchangeRate<'a> { +pub struct ListExchangeRateBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is the currency that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with the exchange rate for currency X your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,42 +22,112 @@ pub struct ListExchangeRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListExchangeRate<'a> { +impl<'a> ListExchangeRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of objects that contain the rates at which foreign currencies are converted to one another. +/// Only shows the currencies for which Stripe supports. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListExchangeRate<'a> { + inner: ListExchangeRateBuilder<'a>, +} impl<'a> ListExchangeRate<'a> { - /// Returns a list of objects that contain the rates at which foreign currencies are converted to one another. - /// Only shows the currencies for which Stripe supports. - pub fn send( + pub fn new() -> Self { + Self { inner: ListExchangeRateBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListExchangeRate<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/exchange_rates", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/exchange_rates", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListExchangeRate<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/exchange_rates").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveExchangeRate<'a> { +pub struct RetrieveExchangeRateBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveExchangeRate<'a> { +impl<'a> RetrieveExchangeRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the exchange rates from the given currency to every supported currency. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveExchangeRate<'a> { + inner: RetrieveExchangeRateBuilder<'a>, + rate_id: &'a stripe_misc::ExchangeRateId, +} impl<'a> RetrieveExchangeRate<'a> { - /// Retrieves the exchange rates from the given currency to every supported currency. - pub fn send( + pub fn new(rate_id: &'a stripe_misc::ExchangeRateId) -> Self { + Self { rate_id, inner: RetrieveExchangeRateBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveExchangeRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - rate_id: &stripe_misc::ExchangeRateId, - ) -> stripe::Response { - client.get_query(&format!("/exchange_rates/{rate_id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveExchangeRate<'_> { + type Output = stripe_misc::ExchangeRate; + + fn build(&self) -> RequestBuilder { + let rate_id = self.rate_id; + RequestBuilder::new(StripeMethod::Get, format!("/exchange_rates/{rate_id}")) + .query(&self.inner) } } diff --git a/generated/stripe_misc/src/financial_connections_account/requests.rs b/generated/stripe_misc/src/financial_connections_account/requests.rs index e17232df1..86e804f8c 100644 --- a/generated/stripe_misc/src/financial_connections_account/requests.rs +++ b/generated/stripe_misc/src/financial_connections_account/requests.rs @@ -1,9 +1,13 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListFinancialConnectionsAccount<'a> { +pub struct ListFinancialConnectionsAccountBuilder<'a> { /// If present, only return accounts that belong to the specified account holder. /// `account_holder[customer]` and `account_holder[account]` are mutually exclusive. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder: Option>, + pub account_holder: Option>, /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -25,7 +29,7 @@ pub struct ListFinancialConnectionsAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListFinancialConnectionsAccount<'a> { +impl<'a> ListFinancialConnectionsAccountBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -33,7 +37,7 @@ impl<'a> ListFinancialConnectionsAccount<'a> { /// If present, only return accounts that belong to the specified account holder. /// `account_holder[customer]` and `account_holder[account]` are mutually exclusive. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListFinancialConnectionsAccountAccountHolder<'a> { +pub struct ListFinancialConnectionsAccountBuilderAccountHolder<'a> { /// The ID of the Stripe account whose accounts will be retrieved. #[serde(skip_serializing_if = "Option::is_none")] pub account: Option<&'a str>, @@ -41,48 +45,129 @@ pub struct ListFinancialConnectionsAccountAccountHolder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option<&'a str>, } -impl<'a> ListFinancialConnectionsAccountAccountHolder<'a> { +impl<'a> ListFinancialConnectionsAccountBuilderAccountHolder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of Financial Connections `Account` objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListFinancialConnectionsAccount<'a> { + inner: ListFinancialConnectionsAccountBuilder<'a>, +} impl<'a> ListFinancialConnectionsAccount<'a> { - /// Returns a list of Financial Connections `Account` objects. - pub fn send( + pub fn new() -> Self { + Self { inner: ListFinancialConnectionsAccountBuilder::new() } + } + pub fn account_holder( + mut self, + account_holder: ListFinancialConnectionsAccountBuilderAccountHolder<'a>, + ) -> Self { + self.inner.account_holder = Some(account_holder); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn session(mut self, session: &'a str) -> Self { + self.inner.session = Some(session); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListFinancialConnectionsAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/financial_connections/accounts", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/financial_connections/accounts", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListFinancialConnectionsAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/financial_connections/accounts").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveFinancialConnectionsAccount<'a> { +pub struct RetrieveFinancialConnectionsAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveFinancialConnectionsAccount<'a> { +impl<'a> RetrieveFinancialConnectionsAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an Financial Connections `Account`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveFinancialConnectionsAccount<'a> { + inner: RetrieveFinancialConnectionsAccountBuilder<'a>, + account: &'a stripe_misc::FinancialConnectionsAccountId, +} impl<'a> RetrieveFinancialConnectionsAccount<'a> { - /// Retrieves the details of an Financial Connections `Account`. - pub fn send( + pub fn new(account: &'a stripe_misc::FinancialConnectionsAccountId) -> Self { + Self { account, inner: RetrieveFinancialConnectionsAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveFinancialConnectionsAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response { - client.get_query(&format!("/financial_connections/accounts/{account}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveFinancialConnectionsAccount<'_> { + type Output = stripe_misc::FinancialConnectionsAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new(StripeMethod::Get, format!("/financial_connections/accounts/{account}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListOwnersFinancialConnectionsAccount<'a> { +pub struct ListOwnersFinancialConnectionsAccountBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -103,113 +188,124 @@ pub struct ListOwnersFinancialConnectionsAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListOwnersFinancialConnectionsAccount<'a> { +impl<'a> ListOwnersFinancialConnectionsAccountBuilder<'a> { pub fn new(ownership: &'a str) -> Self { Self { ending_before: None, expand: None, limit: None, ownership, starting_after: None } } } +/// Lists all owners for a given `Account` +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListOwnersFinancialConnectionsAccount<'a> { + inner: ListOwnersFinancialConnectionsAccountBuilder<'a>, + account: &'a stripe_misc::FinancialConnectionsAccountId, +} impl<'a> ListOwnersFinancialConnectionsAccount<'a> { - /// Lists all owners for a given `Account` - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response> { - client.get_query(&format!("/financial_connections/accounts/{account}/owners"), self) - } - pub fn paginate( - self, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::ListPaginator> - { - stripe::ListPaginator::from_list_params( - &format!("/financial_connections/accounts/{account}/owners"), - self, - ) + pub fn new( + account: &'a stripe_misc::FinancialConnectionsAccountId, + ownership: &'a str, + ) -> Self { + Self { account, inner: ListOwnersFinancialConnectionsAccountBuilder::new(ownership) } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DisconnectFinancialConnectionsAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> DisconnectFinancialConnectionsAccount<'a> { - pub fn new() -> Self { - Self::default() + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> DisconnectFinancialConnectionsAccount<'a> { - /// Disables your access to a Financial Connections `Account`. - /// You will no longer be able to access data associated with the account (e.g. - /// balances, transactions). - pub fn send( +impl ListOwnersFinancialConnectionsAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/financial_connections/accounts/{account}/disconnect"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListOwnersFinancialConnectionsAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new( + StripeMethod::Get, + format!("/financial_connections/accounts/{account}/owners"), ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct RefreshFinancialConnectionsAccount<'a> { +pub struct RefreshFinancialConnectionsAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// The list of account features that you would like to refresh. - pub features: &'a [RefreshFinancialConnectionsAccountFeatures], + pub features: &'a [RefreshFinancialConnectionsAccountBuilderFeatures], } -impl<'a> RefreshFinancialConnectionsAccount<'a> { - pub fn new(features: &'a [RefreshFinancialConnectionsAccountFeatures]) -> Self { +impl<'a> RefreshFinancialConnectionsAccountBuilder<'a> { + pub fn new(features: &'a [RefreshFinancialConnectionsAccountBuilderFeatures]) -> Self { Self { expand: None, features } } } /// The list of account features that you would like to refresh. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum RefreshFinancialConnectionsAccountFeatures { +pub enum RefreshFinancialConnectionsAccountBuilderFeatures { Balance, Ownership, - Transactions, } -impl RefreshFinancialConnectionsAccountFeatures { +impl RefreshFinancialConnectionsAccountBuilderFeatures { pub fn as_str(self) -> &'static str { - use RefreshFinancialConnectionsAccountFeatures::*; + use RefreshFinancialConnectionsAccountBuilderFeatures::*; match self { Balance => "balance", Ownership => "ownership", - Transactions => "transactions", } } } -impl std::str::FromStr for RefreshFinancialConnectionsAccountFeatures { +impl std::str::FromStr for RefreshFinancialConnectionsAccountBuilderFeatures { type Err = (); fn from_str(s: &str) -> Result { - use RefreshFinancialConnectionsAccountFeatures::*; + use RefreshFinancialConnectionsAccountBuilderFeatures::*; match s { "balance" => Ok(Balance), "ownership" => Ok(Ownership), - "transactions" => Ok(Transactions), _ => Err(()), } } } -impl std::fmt::Display for RefreshFinancialConnectionsAccountFeatures { +impl std::fmt::Display for RefreshFinancialConnectionsAccountBuilderFeatures { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for RefreshFinancialConnectionsAccountFeatures { +impl std::fmt::Debug for RefreshFinancialConnectionsAccountBuilderFeatures { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for RefreshFinancialConnectionsAccountFeatures { +impl serde::Serialize for RefreshFinancialConnectionsAccountBuilderFeatures { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -217,157 +313,105 @@ impl serde::Serialize for RefreshFinancialConnectionsAccountFeatures { serializer.serialize_str(self.as_str()) } } +/// Refreshes the data associated with a Financial Connections `Account`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RefreshFinancialConnectionsAccount<'a> { + inner: RefreshFinancialConnectionsAccountBuilder<'a>, + account: &'a stripe_misc::FinancialConnectionsAccountId, +} impl<'a> RefreshFinancialConnectionsAccount<'a> { - /// Refreshes the data associated with a Financial Connections `Account`. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/financial_connections/accounts/{account}/refresh"), - self, - http_types::Method::Post, - ) + pub fn new( + account: &'a stripe_misc::FinancialConnectionsAccountId, + features: &'a [RefreshFinancialConnectionsAccountBuilderFeatures], + ) -> Self { + Self { account, inner: RefreshFinancialConnectionsAccountBuilder::new(features) } } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SubscribeFinancialConnectionsAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The list of account features to which you would like to subscribe. - pub features: &'a [SubscribeFinancialConnectionsAccountFeatures], -} -impl<'a> SubscribeFinancialConnectionsAccount<'a> { - pub fn new(features: &'a [SubscribeFinancialConnectionsAccountFeatures]) -> Self { - Self { expand: None, features } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -/// The list of account features to which you would like to subscribe. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum SubscribeFinancialConnectionsAccountFeatures { - Transactions, -} -impl SubscribeFinancialConnectionsAccountFeatures { - pub fn as_str(self) -> &'static str { - use SubscribeFinancialConnectionsAccountFeatures::*; - match self { - Transactions => "transactions", - } +impl RefreshFinancialConnectionsAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::str::FromStr for SubscribeFinancialConnectionsAccountFeatures { - type Err = (); - fn from_str(s: &str) -> Result { - use SubscribeFinancialConnectionsAccountFeatures::*; - match s { - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display for SubscribeFinancialConnectionsAccountFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl std::fmt::Debug for SubscribeFinancialConnectionsAccountFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for SubscribeFinancialConnectionsAccountFeatures { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> SubscribeFinancialConnectionsAccount<'a> { - /// Subscribes to periodic refreshes of data associated with a Financial Connections `Account`. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/financial_connections/accounts/{account}/subscribe"), - self, - http_types::Method::Post, +impl StripeRequest for RefreshFinancialConnectionsAccount<'_> { + type Output = stripe_misc::FinancialConnectionsAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new( + StripeMethod::Post, + format!("/financial_connections/accounts/{account}/refresh"), ) + .form(&self.inner) } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UnsubscribeFinancialConnectionsAccount<'a> { +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DisconnectFinancialConnectionsAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The list of account features from which you would like to unsubscribe. - pub features: &'a [UnsubscribeFinancialConnectionsAccountFeatures], } -impl<'a> UnsubscribeFinancialConnectionsAccount<'a> { - pub fn new(features: &'a [UnsubscribeFinancialConnectionsAccountFeatures]) -> Self { - Self { expand: None, features } +impl<'a> DisconnectFinancialConnectionsAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() } } -/// The list of account features from which you would like to unsubscribe. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UnsubscribeFinancialConnectionsAccountFeatures { - Transactions, +/// Disables your access to a Financial Connections `Account`. +/// You will no longer be able to access data associated with the account (e.g. +/// balances, transactions). +#[derive(Clone, Debug, serde::Serialize)] +pub struct DisconnectFinancialConnectionsAccount<'a> { + inner: DisconnectFinancialConnectionsAccountBuilder<'a>, + account: &'a stripe_misc::FinancialConnectionsAccountId, } -impl UnsubscribeFinancialConnectionsAccountFeatures { - pub fn as_str(self) -> &'static str { - use UnsubscribeFinancialConnectionsAccountFeatures::*; - match self { - Transactions => "transactions", - } +impl<'a> DisconnectFinancialConnectionsAccount<'a> { + pub fn new(account: &'a stripe_misc::FinancialConnectionsAccountId) -> Self { + Self { account, inner: DisconnectFinancialConnectionsAccountBuilder::new() } } -} - -impl std::str::FromStr for UnsubscribeFinancialConnectionsAccountFeatures { - type Err = (); - fn from_str(s: &str) -> Result { - use UnsubscribeFinancialConnectionsAccountFeatures::*; - match s { - "transactions" => Ok(Transactions), - _ => Err(()), - } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl std::fmt::Display for UnsubscribeFinancialConnectionsAccountFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl DisconnectFinancialConnectionsAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::fmt::Debug for UnsubscribeFinancialConnectionsAccountFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UnsubscribeFinancialConnectionsAccountFeatures { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> UnsubscribeFinancialConnectionsAccount<'a> { - /// Unsubscribes from periodic refreshes of data associated with a Financial Connections `Account`. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_misc::FinancialConnectionsAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/financial_connections/accounts/{account}/unsubscribe"), - self, - http_types::Method::Post, + +impl StripeRequest for DisconnectFinancialConnectionsAccount<'_> { + type Output = stripe_misc::FinancialConnectionsAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + RequestBuilder::new( + StripeMethod::Post, + format!("/financial_connections/accounts/{account}/disconnect"), ) + .form(&self.inner) } } diff --git a/generated/stripe_misc/src/financial_connections_account/types.rs b/generated/stripe_misc/src/financial_connections_account/types.rs index c1751e37f..fe5bcdd5c 100644 --- a/generated/stripe_misc/src/financial_connections_account/types.rs +++ b/generated/stripe_misc/src/financial_connections_account/types.rs @@ -47,12 +47,8 @@ pub struct FinancialConnectionsAccount { /// /// If `category` is `investment` or `other`, this will be `other`. pub subcategory: FinancialConnectionsAccountSubcategory, - /// The list of data refresh subscriptions requested on this account. - pub subscriptions: Option>, /// The [PaymentMethod type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type)(s) that can be created from this account. pub supported_payment_method_types: Vec, - /// The state of the most recent attempt to refresh the account transactions. - pub transaction_refresh: Option, } /// The type of the account. Account category is further divided in `subcategory`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -314,58 +310,6 @@ impl<'de> serde::Deserialize<'de> for FinancialConnectionsAccountSubcategory { }) } } -/// The list of data refresh subscriptions requested on this account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum FinancialConnectionsAccountSubscriptions { - Transactions, -} -impl FinancialConnectionsAccountSubscriptions { - pub fn as_str(self) -> &'static str { - use FinancialConnectionsAccountSubscriptions::*; - match self { - Transactions => "transactions", - } - } -} - -impl std::str::FromStr for FinancialConnectionsAccountSubscriptions { - type Err = (); - fn from_str(s: &str) -> Result { - use FinancialConnectionsAccountSubscriptions::*; - match s { - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl std::fmt::Display for FinancialConnectionsAccountSubscriptions { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for FinancialConnectionsAccountSubscriptions { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for FinancialConnectionsAccountSubscriptions { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for FinancialConnectionsAccountSubscriptions { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for FinancialConnectionsAccountSubscriptions") - }) - } -} /// The [PaymentMethod type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type)(s) that can be created from this account. #[derive(Copy, Clone, Eq, PartialEq)] pub enum FinancialConnectionsAccountSupportedPaymentMethodTypes { diff --git a/generated/stripe_misc/src/financial_connections_session/requests.rs b/generated/stripe_misc/src/financial_connections_session/requests.rs index d9cd397b3..02d69a6fe 100644 --- a/generated/stripe_misc/src/financial_connections_session/requests.rs +++ b/generated/stripe_misc/src/financial_connections_session/requests.rs @@ -1,34 +1,17 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveFinancialConnectionsSession<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveFinancialConnectionsSession<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveFinancialConnectionsSession<'a> { - /// Retrieves the details of a Financial Connections `Session` - pub fn send( - &self, - client: &stripe::Client, - session: &stripe_misc::FinancialConnectionsSessionId, - ) -> stripe::Response { - client.get_query(&format!("/financial_connections/sessions/{session}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFinancialConnectionsSession<'a> { +pub struct CreateFinancialConnectionsSessionBuilder<'a> { /// The account holder to link accounts for. - pub account_holder: CreateFinancialConnectionsSessionAccountHolder<'a>, + pub account_holder: CreateFinancialConnectionsSessionBuilderAccountHolder<'a>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Filters to restrict the kinds of accounts to collect. #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option>, + pub filters: Option>, /// List of data features that you would like to request access to. /// /// Possible values are `balances`, `transactions`, `ownership`, and `payment_method`. @@ -41,9 +24,9 @@ pub struct CreateFinancialConnectionsSession<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub return_url: Option<&'a str>, } -impl<'a> CreateFinancialConnectionsSession<'a> { +impl<'a> CreateFinancialConnectionsSessionBuilder<'a> { pub fn new( - account_holder: CreateFinancialConnectionsSessionAccountHolder<'a>, + account_holder: CreateFinancialConnectionsSessionBuilderAccountHolder<'a>, permissions: &'a [stripe_misc::FinancialConnectionsSessionPermissions], ) -> Self { Self { @@ -58,7 +41,7 @@ impl<'a> CreateFinancialConnectionsSession<'a> { } /// The account holder to link accounts for. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFinancialConnectionsSessionAccountHolder<'a> { +pub struct CreateFinancialConnectionsSessionBuilderAccountHolder<'a> { /// The ID of the Stripe account whose accounts will be retrieved. /// Should only be present if `type` is `account`. #[serde(skip_serializing_if = "Option::is_none")] @@ -69,22 +52,22 @@ pub struct CreateFinancialConnectionsSessionAccountHolder<'a> { pub customer: Option<&'a str>, /// Type of account holder to collect accounts for. #[serde(rename = "type")] - pub type_: CreateFinancialConnectionsSessionAccountHolderType, + pub type_: CreateFinancialConnectionsSessionBuilderAccountHolderType, } -impl<'a> CreateFinancialConnectionsSessionAccountHolder<'a> { - pub fn new(type_: CreateFinancialConnectionsSessionAccountHolderType) -> Self { +impl<'a> CreateFinancialConnectionsSessionBuilderAccountHolder<'a> { + pub fn new(type_: CreateFinancialConnectionsSessionBuilderAccountHolderType) -> Self { Self { account: None, customer: None, type_ } } } /// Type of account holder to collect accounts for. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFinancialConnectionsSessionAccountHolderType { +pub enum CreateFinancialConnectionsSessionBuilderAccountHolderType { Account, Customer, } -impl CreateFinancialConnectionsSessionAccountHolderType { +impl CreateFinancialConnectionsSessionBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use CreateFinancialConnectionsSessionAccountHolderType::*; + use CreateFinancialConnectionsSessionBuilderAccountHolderType::*; match self { Account => "account", Customer => "customer", @@ -92,10 +75,10 @@ impl CreateFinancialConnectionsSessionAccountHolderType { } } -impl std::str::FromStr for CreateFinancialConnectionsSessionAccountHolderType { +impl std::str::FromStr for CreateFinancialConnectionsSessionBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateFinancialConnectionsSessionAccountHolderType::*; + use CreateFinancialConnectionsSessionBuilderAccountHolderType::*; match s { "account" => Ok(Account), "customer" => Ok(Customer), @@ -103,18 +86,18 @@ impl std::str::FromStr for CreateFinancialConnectionsSessionAccountHolderType { } } } -impl std::fmt::Display for CreateFinancialConnectionsSessionAccountHolderType { +impl std::fmt::Display for CreateFinancialConnectionsSessionBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateFinancialConnectionsSessionAccountHolderType { +impl std::fmt::Debug for CreateFinancialConnectionsSessionBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateFinancialConnectionsSessionAccountHolderType { +impl serde::Serialize for CreateFinancialConnectionsSessionBuilderAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -124,22 +107,122 @@ impl serde::Serialize for CreateFinancialConnectionsSessionAccountHolderType { } /// Filters to restrict the kinds of accounts to collect. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFinancialConnectionsSessionFilters<'a> { +pub struct CreateFinancialConnectionsSessionBuilderFilters<'a> { /// List of countries from which to collect accounts. pub countries: &'a [&'a str], } -impl<'a> CreateFinancialConnectionsSessionFilters<'a> { +impl<'a> CreateFinancialConnectionsSessionBuilderFilters<'a> { pub fn new(countries: &'a [&'a str]) -> Self { Self { countries } } } +/// To launch the Financial Connections authorization flow, create a `Session`. +/// The session’s `client_secret` can be used to launch the flow using Stripe.js. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateFinancialConnectionsSession<'a> { + inner: CreateFinancialConnectionsSessionBuilder<'a>, +} impl<'a> CreateFinancialConnectionsSession<'a> { - /// To launch the Financial Connections authorization flow, create a `Session`. - /// The session’s `client_secret` can be used to launch the flow using Stripe.js. - pub fn send( + pub fn new( + account_holder: CreateFinancialConnectionsSessionBuilderAccountHolder<'a>, + permissions: &'a [stripe_misc::FinancialConnectionsSessionPermissions], + ) -> Self { + Self { inner: CreateFinancialConnectionsSessionBuilder::new(account_holder, permissions) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn filters(mut self, filters: CreateFinancialConnectionsSessionBuilderFilters<'a>) -> Self { + self.inner.filters = Some(filters); + self + } + + pub fn prefetch( + mut self, + prefetch: &'a [stripe_misc::FinancialConnectionsSessionPrefetch], + ) -> Self { + self.inner.prefetch = Some(prefetch); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } +} +impl CreateFinancialConnectionsSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/financial_connections/sessions", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateFinancialConnectionsSession<'_> { + type Output = stripe_misc::FinancialConnectionsSession; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/financial_connections/sessions").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveFinancialConnectionsSessionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveFinancialConnectionsSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of a Financial Connections `Session` +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveFinancialConnectionsSession<'a> { + inner: RetrieveFinancialConnectionsSessionBuilder<'a>, + session: &'a stripe_misc::FinancialConnectionsSessionId, +} +impl<'a> RetrieveFinancialConnectionsSession<'a> { + pub fn new(session: &'a stripe_misc::FinancialConnectionsSessionId) -> Self { + Self { session, inner: RetrieveFinancialConnectionsSessionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveFinancialConnectionsSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveFinancialConnectionsSession<'_> { + type Output = stripe_misc::FinancialConnectionsSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new(StripeMethod::Get, format!("/financial_connections/sessions/{session}")) + .query(&self.inner) } } diff --git a/generated/stripe_misc/src/financial_connections_session/types.rs b/generated/stripe_misc/src/financial_connections_session/types.rs index 9890e5288..93480e23b 100644 --- a/generated/stripe_misc/src/financial_connections_session/types.rs +++ b/generated/stripe_misc/src/financial_connections_session/types.rs @@ -95,7 +95,6 @@ impl<'de> serde::Deserialize<'de> for FinancialConnectionsSessionPermissions { pub enum FinancialConnectionsSessionPrefetch { Balances, Ownership, - Transactions, } impl FinancialConnectionsSessionPrefetch { pub fn as_str(self) -> &'static str { @@ -103,7 +102,6 @@ impl FinancialConnectionsSessionPrefetch { match self { Balances => "balances", Ownership => "ownership", - Transactions => "transactions", } } } @@ -115,7 +113,6 @@ impl std::str::FromStr for FinancialConnectionsSessionPrefetch { match s { "balances" => Ok(Balances), "ownership" => Ok(Ownership), - "transactions" => Ok(Transactions), _ => Err(()), } } diff --git a/generated/stripe_misc/src/financial_connections_transaction/mod.rs b/generated/stripe_misc/src/financial_connections_transaction/mod.rs deleted file mode 100644 index eb10ac40c..000000000 --- a/generated/stripe_misc/src/financial_connections_transaction/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "financial_connections_transaction")] -mod requests; -pub(crate) mod types; -#[cfg(feature = "financial_connections_transaction")] -pub use requests::*; diff --git a/generated/stripe_misc/src/financial_connections_transaction/requests.rs b/generated/stripe_misc/src/financial_connections_transaction/requests.rs deleted file mode 100644 index ec05ca1d9..000000000 --- a/generated/stripe_misc/src/financial_connections_transaction/requests.rs +++ /dev/null @@ -1,91 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListFinancialConnectionsTransaction<'a> { - /// The ID of the Stripe account whose transactions will be retrieved. - pub account: &'a str, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// A filter on the list based on the object `transacted_at` field. - /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:. - #[serde(skip_serializing_if = "Option::is_none")] - pub transacted_at: Option, - /// A filter on the list based on the object `transaction_refresh` field. - /// The value can be a dictionary with the following options:. - #[serde(skip_serializing_if = "Option::is_none")] - pub transaction_refresh: Option>, -} -impl<'a> ListFinancialConnectionsTransaction<'a> { - pub fn new(account: &'a str) -> Self { - Self { - account, - ending_before: None, - expand: None, - limit: None, - starting_after: None, - transacted_at: None, - transaction_refresh: None, - } - } -} -/// A filter on the list based on the object `transaction_refresh` field. -/// The value can be a dictionary with the following options:. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListFinancialConnectionsTransactionTransactionRefresh<'a> { - /// Return results where the transactions were created or updated by a refresh that took place after this refresh (non-inclusive). - pub after: &'a str, -} -impl<'a> ListFinancialConnectionsTransactionTransactionRefresh<'a> { - pub fn new(after: &'a str) -> Self { - Self { after } - } -} -impl<'a> ListFinancialConnectionsTransaction<'a> { - /// Returns a list of Financial Connections `Transaction` objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/financial_connections/transactions", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> - { - stripe::ListPaginator::from_list_params("/financial_connections/transactions", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveFinancialConnectionsTransaction<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveFinancialConnectionsTransaction<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveFinancialConnectionsTransaction<'a> { - /// Retrieves the details of a Financial Connections `Transaction` - pub fn send( - &self, - client: &stripe::Client, - transaction: &stripe_misc::FinancialConnectionsTransactionId, - ) -> stripe::Response { - client.get_query(&format!("/financial_connections/transactions/{transaction}"), self) - } -} diff --git a/generated/stripe_misc/src/financial_connections_transaction/types.rs b/generated/stripe_misc/src/financial_connections_transaction/types.rs deleted file mode 100644 index 774426515..000000000 --- a/generated/stripe_misc/src/financial_connections_transaction/types.rs +++ /dev/null @@ -1,92 +0,0 @@ -/// A Transaction represents a real transaction that affects a Financial Connections Account balance. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct FinancialConnectionsTransaction { - /// The ID of the Financial Connections Account this transaction belongs to. - pub account: String, - /// The amount of this transaction, in cents (or local equivalent). - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// The description of this transaction. - pub description: String, - /// Unique identifier for the object. - pub id: stripe_misc::FinancialConnectionsTransactionId, - /// 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 status of the transaction. - pub status: FinancialConnectionsTransactionStatus, - pub status_transitions: - stripe_misc::BankConnectionsResourceTransactionResourceStatusTransitions, - /// Time at which the transaction was transacted. Measured in seconds since the Unix epoch. - pub transacted_at: stripe_types::Timestamp, - /// The token of the transaction refresh that last updated or created this transaction. - pub transaction_refresh: String, - /// Time at which the object was last updated. Measured in seconds since the Unix epoch. - pub updated: stripe_types::Timestamp, -} -/// The status of the transaction. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum FinancialConnectionsTransactionStatus { - Pending, - Posted, - Void, -} -impl FinancialConnectionsTransactionStatus { - pub fn as_str(self) -> &'static str { - use FinancialConnectionsTransactionStatus::*; - match self { - Pending => "pending", - Posted => "posted", - Void => "void", - } - } -} - -impl std::str::FromStr for FinancialConnectionsTransactionStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use FinancialConnectionsTransactionStatus::*; - match s { - "pending" => Ok(Pending), - "posted" => Ok(Posted), - "void" => Ok(Void), - _ => Err(()), - } - } -} -impl std::fmt::Display for FinancialConnectionsTransactionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for FinancialConnectionsTransactionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for FinancialConnectionsTransactionStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for FinancialConnectionsTransactionStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for FinancialConnectionsTransactionStatus") - }) - } -} -impl stripe_types::Object for FinancialConnectionsTransaction { - type Id = stripe_misc::FinancialConnectionsTransactionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(FinancialConnectionsTransactionId); diff --git a/generated/stripe_misc/src/gelato_id_number_report.rs b/generated/stripe_misc/src/gelato_id_number_report.rs index 9f0a3bbeb..1d5f965ec 100644 --- a/generated/stripe_misc/src/gelato_id_number_report.rs +++ b/generated/stripe_misc/src/gelato_id_number_report.rs @@ -7,7 +7,7 @@ pub struct GelatoIdNumberReport { pub error: Option, /// First name. pub first_name: Option, - /// ID number. When `id_number_type` is `us_ssn`, only the last 4 digits are present. + /// ID number. pub id_number: Option, /// Type of ID number. pub id_number_type: Option, diff --git a/generated/stripe_misc/src/identity_verification_report/requests.rs b/generated/stripe_misc/src/identity_verification_report/requests.rs index 3e4b46c2b..a9de60d8e 100644 --- a/generated/stripe_misc/src/identity_verification_report/requests.rs +++ b/generated/stripe_misc/src/identity_verification_report/requests.rs @@ -1,5 +1,60 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIdentityVerificationReport<'a> { +pub struct RetrieveIdentityVerificationReportBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveIdentityVerificationReportBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves an existing VerificationReport +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIdentityVerificationReport<'a> { + inner: RetrieveIdentityVerificationReportBuilder<'a>, + report: &'a stripe_misc::IdentityVerificationReportId, +} +impl<'a> RetrieveIdentityVerificationReport<'a> { + pub fn new(report: &'a stripe_misc::IdentityVerificationReportId) -> Self { + Self { report, inner: RetrieveIdentityVerificationReportBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIdentityVerificationReport<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIdentityVerificationReport<'_> { + type Output = stripe_misc::IdentityVerificationReport; + + fn build(&self) -> RequestBuilder { + let report = self.report; + RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_reports/{report}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListIdentityVerificationReportBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A cursor for use in pagination. @@ -28,43 +83,75 @@ pub struct ListIdentityVerificationReport<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub verification_session: Option<&'a str>, } -impl<'a> ListIdentityVerificationReport<'a> { +impl<'a> ListIdentityVerificationReportBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// List all verification reports. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIdentityVerificationReport<'a> { + inner: ListIdentityVerificationReportBuilder<'a>, +} impl<'a> ListIdentityVerificationReport<'a> { - /// List all verification reports. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/identity/verification_reports", self) + pub fn new() -> Self { + Self { inner: ListIdentityVerificationReportBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/identity/verification_reports", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIdentityVerificationReport<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIdentityVerificationReport<'a> { - pub fn new() -> Self { - Self::default() + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: stripe_misc::IdentityVerificationReportType) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn verification_session(mut self, verification_session: &'a str) -> Self { + self.inner.verification_session = Some(verification_session); + self } } -impl<'a> RetrieveIdentityVerificationReport<'a> { - /// Retrieves an existing VerificationReport - pub fn send( +impl ListIdentityVerificationReport<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - report: &stripe_misc::IdentityVerificationReportId, - ) -> stripe::Response { - client.get_query(&format!("/identity/verification_reports/{report}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIdentityVerificationReport<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/identity/verification_reports").query(&self.inner) } } diff --git a/generated/stripe_misc/src/identity_verification_session/requests.rs b/generated/stripe_misc/src/identity_verification_session/requests.rs index efbfed561..0b95a69cf 100644 --- a/generated/stripe_misc/src/identity_verification_session/requests.rs +++ b/generated/stripe_misc/src/identity_verification_session/requests.rs @@ -1,74 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListIdentityVerificationSession<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// Only return VerificationSessions with this status. - /// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, -} -impl<'a> ListIdentityVerificationSession<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListIdentityVerificationSession<'a> { - /// Returns a list of VerificationSessions - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/identity/verification_sessions", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/identity/verification_sessions", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIdentityVerificationSession<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIdentityVerificationSession<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveIdentityVerificationSession<'a> { - /// Retrieves the details of a VerificationSession that was previously created. - /// - /// When the session status is `requires_input`, you can use this method to retrieve a valid - /// `client_secret` or `url` to allow re-submission. - pub fn send( - &self, - client: &stripe::Client, - session: &stripe_misc::IdentityVerificationSessionId, - ) -> stripe::Response { - client.get_query(&format!("/identity/verification_sessions/{session}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIdentityVerificationSession<'a> { +pub struct CreateIdentityVerificationSessionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -80,7 +15,7 @@ pub struct CreateIdentityVerificationSession<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// A set of options for the session’s verification checks. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option>, + pub options: Option>, /// The URL that the user will be redirected to upon completing the verification flow. #[serde(skip_serializing_if = "Option::is_none")] pub return_url: Option<&'a str>, @@ -88,30 +23,31 @@ pub struct CreateIdentityVerificationSession<'a> { #[serde(rename = "type")] pub type_: stripe_misc::IdentityVerificationSessionType, } -impl<'a> CreateIdentityVerificationSession<'a> { +impl<'a> CreateIdentityVerificationSessionBuilder<'a> { pub fn new(type_: stripe_misc::IdentityVerificationSessionType) -> Self { Self { expand: None, metadata: None, options: None, return_url: None, type_ } } } /// A set of options for the session’s verification checks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIdentityVerificationSessionOptions<'a> { +pub struct CreateIdentityVerificationSessionBuilderOptions<'a> { /// Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document). #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, + pub document: Option>, } -impl<'a> CreateIdentityVerificationSessionOptions<'a> { +impl<'a> CreateIdentityVerificationSessionBuilderOptions<'a> { pub fn new() -> Self { Self::default() } } /// Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIdentityVerificationSessionOptionsDocument<'a> { +pub struct CreateIdentityVerificationSessionBuilderOptionsDocument<'a> { /// Array of strings of allowed identity document types. /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_types: Option<&'a [CreateIdentityVerificationSessionOptionsDocumentAllowedTypes]>, + pub allowed_types: + Option<&'a [CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes]>, /// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub require_id_number: Option, @@ -123,7 +59,7 @@ pub struct CreateIdentityVerificationSessionOptionsDocument<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub require_matching_selfie: Option, } -impl<'a> CreateIdentityVerificationSessionOptionsDocument<'a> { +impl<'a> CreateIdentityVerificationSessionBuilderOptionsDocument<'a> { pub fn new() -> Self { Self::default() } @@ -131,14 +67,14 @@ impl<'a> CreateIdentityVerificationSessionOptionsDocument<'a> { /// Array of strings of allowed identity document types. /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +pub enum CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { DrivingLicense, IdCard, Passport, } -impl CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { pub fn as_str(self) -> &'static str { - use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*; + use CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes::*; match self { DrivingLicense => "driving_license", IdCard => "id_card", @@ -147,10 +83,10 @@ impl CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { } } -impl std::str::FromStr for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::str::FromStr for CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { type Err = (); fn from_str(s: &str) -> Result { - use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*; + use CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes::*; match s { "driving_license" => Ok(DrivingLicense), "id_card" => Ok(IdCard), @@ -159,18 +95,18 @@ impl std::str::FromStr for CreateIdentityVerificationSessionOptionsDocumentAllow } } } -impl std::fmt::Display for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::fmt::Display for CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::fmt::Debug for CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl serde::Serialize for CreateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -178,23 +114,344 @@ impl serde::Serialize for CreateIdentityVerificationSessionOptionsDocumentAllowe serializer.serialize_str(self.as_str()) } } +/// Creates a VerificationSession object. +/// +/// After the VerificationSession is created, display a verification modal using the session `client_secret` or send your users to the session’s `url`. +/// +/// If your API key is in test mode, verification checks won’t actually process, though everything else will occur as if in live mode. +/// +/// Related guide: [Verify your users’ identity documents](https://stripe.com/docs/identity/verify-identity-documents). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateIdentityVerificationSession<'a> { + inner: CreateIdentityVerificationSessionBuilder<'a>, +} impl<'a> CreateIdentityVerificationSession<'a> { - /// Creates a VerificationSession object. - /// - /// After the VerificationSession is created, display a verification modal using the session `client_secret` or send your users to the session’s `url`. - /// - /// If your API key is in test mode, verification checks won’t actually process, though everything else will occur as if in live mode. - /// - /// Related guide: [Verify your users’ identity documents](https://stripe.com/docs/identity/verify-identity-documents). - pub fn send( + pub fn new(type_: stripe_misc::IdentityVerificationSessionType) -> Self { + Self { inner: CreateIdentityVerificationSessionBuilder::new(type_) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn options(mut self, options: CreateIdentityVerificationSessionBuilderOptions<'a>) -> Self { + self.inner.options = Some(options); + self + } + + pub fn return_url(mut self, return_url: &'a str) -> Self { + self.inner.return_url = Some(return_url); + self + } +} +impl CreateIdentityVerificationSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/identity/verification_sessions", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateIdentityVerificationSession<'_> { + type Output = stripe_misc::IdentityVerificationSession; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/identity/verification_sessions").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIdentityVerificationSession<'a> { +pub struct RetrieveIdentityVerificationSessionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveIdentityVerificationSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of a VerificationSession that was previously created. +/// +/// When the session status is `requires_input`, you can use this method to retrieve a valid +/// `client_secret` or `url` to allow re-submission. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveIdentityVerificationSession<'a> { + inner: RetrieveIdentityVerificationSessionBuilder<'a>, + session: &'a stripe_misc::IdentityVerificationSessionId, +} +impl<'a> RetrieveIdentityVerificationSession<'a> { + pub fn new(session: &'a stripe_misc::IdentityVerificationSessionId) -> Self { + Self { session, inner: RetrieveIdentityVerificationSessionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveIdentityVerificationSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveIdentityVerificationSession<'_> { + type Output = stripe_misc::IdentityVerificationSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_sessions/{session}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListIdentityVerificationSessionBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// Only return VerificationSessions with this status. + /// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl<'a> ListIdentityVerificationSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of VerificationSessions +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListIdentityVerificationSession<'a> { + inner: ListIdentityVerificationSessionBuilder<'a>, +} +impl<'a> ListIdentityVerificationSession<'a> { + pub fn new() -> Self { + Self { inner: ListIdentityVerificationSessionBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_misc::IdentityVerificationSessionStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListIdentityVerificationSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListIdentityVerificationSession<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/identity/verification_sessions").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelIdentityVerificationSessionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelIdentityVerificationSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// A VerificationSession object can be canceled when it is in `requires_input` [status](https://stripe.com/docs/identity/how-sessions-work). +/// +/// Once canceled, future submission attempts are disabled. +/// This cannot be undone. +/// [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelIdentityVerificationSession<'a> { + inner: CancelIdentityVerificationSessionBuilder<'a>, + session: &'a stripe_misc::IdentityVerificationSessionId, +} +impl<'a> CancelIdentityVerificationSession<'a> { + pub fn new(session: &'a stripe_misc::IdentityVerificationSessionId) -> Self { + Self { session, inner: CancelIdentityVerificationSessionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelIdentityVerificationSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelIdentityVerificationSession<'_> { + type Output = stripe_misc::IdentityVerificationSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new( + StripeMethod::Post, + format!("/identity/verification_sessions/{session}/cancel"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RedactIdentityVerificationSessionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RedactIdentityVerificationSessionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Redact a VerificationSession to remove all collected information from Stripe. This will redact +/// the VerificationSession and all objects related to it, including VerificationReports, Events, +/// request logs, etc. +/// +/// A VerificationSession object can be redacted when it is in `requires_input` or `verified` +/// [status](https://stripe.com/docs/identity/how-sessions-work). +/// Redacting a VerificationSession in `requires_action`. +/// state will automatically cancel it. +/// +/// The redaction process may take up to four days. When the redaction process is in progress, the +/// VerificationSession’s `redaction.status` field will be set to `processing`; when the process is +/// finished, it will change to `redacted` and an `identity.verification_session.redacted` event +/// will be emitted. +/// +/// Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the +/// fields that contain personal data will be replaced by the string `[redacted]` or a similar +/// placeholder. The `metadata` field will also be erased. Redacted objects cannot be updated or +/// used for any purpose. +/// +/// [Learn more](https://stripe.com/docs/identity/verification-sessions#redact). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RedactIdentityVerificationSession<'a> { + inner: RedactIdentityVerificationSessionBuilder<'a>, + session: &'a stripe_misc::IdentityVerificationSessionId, +} +impl<'a> RedactIdentityVerificationSession<'a> { + pub fn new(session: &'a stripe_misc::IdentityVerificationSessionId) -> Self { + Self { session, inner: RedactIdentityVerificationSessionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RedactIdentityVerificationSession<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RedactIdentityVerificationSession<'_> { + type Output = stripe_misc::IdentityVerificationSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new( + StripeMethod::Post, + format!("/identity/verification_sessions/{session}/redact"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateIdentityVerificationSessionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -206,36 +463,37 @@ pub struct UpdateIdentityVerificationSession<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// A set of options for the session’s verification checks. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option>, + pub options: Option>, /// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> UpdateIdentityVerificationSession<'a> { +impl<'a> UpdateIdentityVerificationSessionBuilder<'a> { pub fn new() -> Self { Self::default() } } /// A set of options for the session’s verification checks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIdentityVerificationSessionOptions<'a> { +pub struct UpdateIdentityVerificationSessionBuilderOptions<'a> { /// Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document). #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, + pub document: Option>, } -impl<'a> UpdateIdentityVerificationSessionOptions<'a> { +impl<'a> UpdateIdentityVerificationSessionBuilderOptions<'a> { pub fn new() -> Self { Self::default() } } /// Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIdentityVerificationSessionOptionsDocument<'a> { +pub struct UpdateIdentityVerificationSessionBuilderOptionsDocument<'a> { /// Array of strings of allowed identity document types. /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_types: Option<&'a [UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes]>, + pub allowed_types: + Option<&'a [UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes]>, /// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth. #[serde(skip_serializing_if = "Option::is_none")] pub require_id_number: Option, @@ -247,7 +505,7 @@ pub struct UpdateIdentityVerificationSessionOptionsDocument<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub require_matching_selfie: Option, } -impl<'a> UpdateIdentityVerificationSessionOptionsDocument<'a> { +impl<'a> UpdateIdentityVerificationSessionBuilderOptionsDocument<'a> { pub fn new() -> Self { Self::default() } @@ -255,14 +513,14 @@ impl<'a> UpdateIdentityVerificationSessionOptionsDocument<'a> { /// Array of strings of allowed identity document types. /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +pub enum UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { DrivingLicense, IdCard, Passport, } -impl UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { pub fn as_str(self) -> &'static str { - use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*; + use UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes::*; match self { DrivingLicense => "driving_license", IdCard => "id_card", @@ -271,10 +529,10 @@ impl UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { } } -impl std::str::FromStr for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::str::FromStr for UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { type Err = (); fn from_str(s: &str) -> Result { - use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*; + use UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes::*; match s { "driving_license" => Ok(DrivingLicense), "id_card" => Ok(IdCard), @@ -283,18 +541,18 @@ impl std::str::FromStr for UpdateIdentityVerificationSessionOptionsDocumentAllow } } } -impl std::fmt::Display for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::fmt::Display for UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl std::fmt::Debug for UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes { +impl serde::Serialize for UpdateIdentityVerificationSessionBuilderOptionsDocumentAllowedTypes { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -302,93 +560,64 @@ impl serde::Serialize for UpdateIdentityVerificationSessionOptionsDocumentAllowe serializer.serialize_str(self.as_str()) } } +/// Updates a VerificationSession object. +/// +/// When the session status is `requires_input`, you can use this method to update the +/// verification check and options. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateIdentityVerificationSession<'a> { + inner: UpdateIdentityVerificationSessionBuilder<'a>, + session: &'a stripe_misc::IdentityVerificationSessionId, +} impl<'a> UpdateIdentityVerificationSession<'a> { - /// Updates a VerificationSession object. - /// - /// When the session status is `requires_input`, you can use this method to update the - /// verification check and options. - pub fn send( - &self, - client: &stripe::Client, - session: &stripe_misc::IdentityVerificationSessionId, - ) -> stripe::Response { - client.send_form( - &format!("/identity/verification_sessions/{session}"), - self, - http_types::Method::Post, - ) + pub fn new(session: &'a stripe_misc::IdentityVerificationSessionId) -> Self { + Self { session, inner: UpdateIdentityVerificationSessionBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelIdentityVerificationSession<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelIdentityVerificationSession<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn options(mut self, options: UpdateIdentityVerificationSessionBuilderOptions<'a>) -> Self { + self.inner.options = Some(options); + self + } + + pub fn type_(mut self, type_: stripe_misc::IdentityVerificationSessionType) -> Self { + self.inner.type_ = Some(type_); + self } } -impl<'a> CancelIdentityVerificationSession<'a> { - /// A VerificationSession object can be canceled when it is in `requires_input` [status](https://stripe.com/docs/identity/how-sessions-work). - /// - /// Once canceled, future submission attempts are disabled. - /// This cannot be undone. - /// [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel). - pub fn send( +impl UpdateIdentityVerificationSession<'_> { + pub async fn send( &self, - client: &stripe::Client, - session: &stripe_misc::IdentityVerificationSessionId, - ) -> stripe::Response { - client.send_form( - &format!("/identity/verification_sessions/{session}/cancel"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RedactIdentityVerificationSession<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RedactIdentityVerificationSession<'a> { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> RedactIdentityVerificationSession<'a> { - /// Redact a VerificationSession to remove all collected information from Stripe. This will redact - /// the VerificationSession and all objects related to it, including VerificationReports, Events, - /// request logs, etc. - /// - /// A VerificationSession object can be redacted when it is in `requires_input` or `verified` - /// [status](https://stripe.com/docs/identity/how-sessions-work). - /// Redacting a VerificationSession in `requires_action`. - /// state will automatically cancel it. - /// - /// The redaction process may take up to four days. When the redaction process is in progress, the - /// VerificationSession’s `redaction.status` field will be set to `processing`; when the process is - /// finished, it will change to `redacted` and an `identity.verification_session.redacted` event - /// will be emitted. - /// - /// Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the - /// fields that contain personal data will be replaced by the string `[redacted]` or a similar - /// placeholder. The `metadata` field will also be erased. Redacted objects cannot be updated or - /// used for any purpose. - /// - /// [Learn more](https://stripe.com/docs/identity/verification-sessions#redact). - pub fn send( - &self, - client: &stripe::Client, - session: &stripe_misc::IdentityVerificationSessionId, - ) -> stripe::Response { - client.send_form( - &format!("/identity/verification_sessions/{session}/redact"), - self, - http_types::Method::Post, + +impl StripeRequest for UpdateIdentityVerificationSession<'_> { + type Output = stripe_misc::IdentityVerificationSession; + + fn build(&self) -> RequestBuilder { + let session = self.session; + RequestBuilder::new( + StripeMethod::Post, + format!("/identity/verification_sessions/{session}"), ) + .form(&self.inner) } } diff --git a/generated/stripe_misc/src/mod.rs b/generated/stripe_misc/src/mod.rs index 35e7c18a4..7f42727bd 100644 --- a/generated/stripe_misc/src/mod.rs +++ b/generated/stripe_misc/src/mod.rs @@ -39,36 +39,6 @@ pub mod bank_connections_resource_ownership_refresh; #[doc(inline)] pub use bank_connections_resource_ownership_refresh::*; #[doc(hidden)] -pub mod bank_connections_resource_transaction_refresh; -#[doc(inline)] -pub use bank_connections_resource_transaction_refresh::*; -#[doc(hidden)] -pub mod bank_connections_resource_transaction_resource_status_transitions; -#[doc(inline)] -pub use bank_connections_resource_transaction_resource_status_transitions::*; -pub use climate_order::types::*; -pub mod climate_order; -pub use climate_product::types::*; -pub mod climate_product; -pub use climate_supplier::types::*; -#[doc(hidden)] -pub mod climate_removals_beneficiary; -pub mod climate_supplier; -#[doc(inline)] -pub use climate_removals_beneficiary::*; -#[doc(hidden)] -pub mod climate_removals_location; -#[doc(inline)] -pub use climate_removals_location::*; -#[doc(hidden)] -pub mod climate_removals_order_deliveries; -#[doc(inline)] -pub use climate_removals_order_deliveries::*; -#[doc(hidden)] -pub mod climate_removals_products_price; -#[doc(inline)] -pub use climate_removals_products_price::*; -#[doc(hidden)] pub mod deleted_apple_pay_domain; #[doc(inline)] pub use deleted_apple_pay_domain::*; @@ -92,8 +62,6 @@ pub mod financial_connections_account_ownership; pub use financial_connections_account_ownership::*; pub use financial_connections_session::types::*; pub mod financial_connections_session; -pub use financial_connections_transaction::types::*; -pub mod financial_connections_transaction; #[doc(hidden)] pub mod financial_reporting_finance_report_run_run_parameters; #[doc(inline)] diff --git a/generated/stripe_misc/src/reporting_report_run/requests.rs b/generated/stripe_misc/src/reporting_report_run/requests.rs index 2cdf5e17c..293847938 100644 --- a/generated/stripe_misc/src/reporting_report_run/requests.rs +++ b/generated/stripe_misc/src/reporting_report_run/requests.rs @@ -1,78 +1,71 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListReportingReportRun<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveReportingReportRunBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> ListReportingReportRun<'a> { +impl<'a> RetrieveReportingReportRunBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListReportingReportRun<'a> { - /// Returns a list of Report Runs, with the most recent appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/reporting/report_runs", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/reporting/report_runs", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves the details of an existing Report Run. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrieveReportingReportRun<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: RetrieveReportingReportRunBuilder<'a>, + report_run: &'a stripe_misc::ReportingReportRunId, } impl<'a> RetrieveReportingReportRun<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(report_run: &'a stripe_misc::ReportingReportRunId) -> Self { + Self { report_run, inner: RetrieveReportingReportRunBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrieveReportingReportRun<'a> { - /// Retrieves the details of an existing Report Run. - pub fn send( +impl RetrieveReportingReportRun<'_> { + pub async fn send( &self, - client: &stripe::Client, - report_run: &stripe_misc::ReportingReportRunId, - ) -> stripe::Response { - client.get_query(&format!("/reporting/report_runs/{report_run}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveReportingReportRun<'_> { + type Output = stripe_misc::ReportingReportRun; + + fn build(&self) -> RequestBuilder { + let report_run = self.report_run; + RequestBuilder::new(StripeMethod::Get, format!("/reporting/report_runs/{report_run}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateReportingReportRun<'a> { +pub struct CreateReportingReportRunBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Parameters specifying how the report should be run. /// Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation. #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, + pub parameters: Option>, /// The ID of the [report type](https://stripe.com/docs/reporting/statements/api#report-types) to run, such as `"balance.summary.1"`. pub report_type: &'a str, } -impl<'a> CreateReportingReportRun<'a> { +impl<'a> CreateReportingReportRunBuilder<'a> { pub fn new(report_type: &'a str) -> Self { Self { expand: None, parameters: None, report_type } } @@ -80,7 +73,7 @@ impl<'a> CreateReportingReportRun<'a> { /// Parameters specifying how the report should be run. /// Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateReportingReportRunParameters<'a> { +pub struct CreateReportingReportRunBuilderParameters<'a> { /// The set of report columns to include in the report output. /// If omitted, the Report Type is run with its default column set. #[serde(skip_serializing_if = "Option::is_none")] @@ -102,15 +95,15 @@ pub struct CreateReportingReportRunParameters<'a> { pub payout: Option<&'a str>, /// Category of balance transactions to be included in the report run. #[serde(skip_serializing_if = "Option::is_none")] - pub reporting_category: Option, + pub reporting_category: Option, /// Defaults to `Etc/UTC`. /// The output timezone for all timestamps in the report. /// A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). /// Has no effect on `interval_start` or `interval_end`. #[serde(skip_serializing_if = "Option::is_none")] - pub timezone: Option, + pub timezone: Option, } -impl<'a> CreateReportingReportRunParameters<'a> { +impl<'a> CreateReportingReportRunBuilderParameters<'a> { pub fn new() -> Self { Self::default() } @@ -118,14 +111,12 @@ impl<'a> CreateReportingReportRunParameters<'a> { /// Category of balance transactions to be included in the report run. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateReportingReportRunParametersReportingCategory { +pub enum CreateReportingReportRunBuilderParametersReportingCategory { Advance, AdvanceFunding, AnticipationRepayment, Charge, ChargeFailure, - ClimateOrderPurchase, - ClimateOrderRefund, ConnectCollectionTransfer, ConnectReservedFunds, Contribution, @@ -141,6 +132,7 @@ pub enum CreateReportingReportRunParametersReportingCategory { IssuingDispute, IssuingTransaction, NetworkCost, + Obligation, OtherAdjustment, PartialCaptureReversal, Payout, @@ -159,17 +151,15 @@ pub enum CreateReportingReportRunParametersReportingCategory { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateReportingReportRunParametersReportingCategory { +impl CreateReportingReportRunBuilderParametersReportingCategory { pub fn as_str(self) -> &'static str { - use CreateReportingReportRunParametersReportingCategory::*; + use CreateReportingReportRunBuilderParametersReportingCategory::*; match self { Advance => "advance", AdvanceFunding => "advance_funding", AnticipationRepayment => "anticipation_repayment", Charge => "charge", ChargeFailure => "charge_failure", - ClimateOrderPurchase => "climate_order_purchase", - ClimateOrderRefund => "climate_order_refund", ConnectCollectionTransfer => "connect_collection_transfer", ConnectReservedFunds => "connect_reserved_funds", Contribution => "contribution", @@ -185,6 +175,7 @@ impl CreateReportingReportRunParametersReportingCategory { IssuingDispute => "issuing_dispute", IssuingTransaction => "issuing_transaction", NetworkCost => "network_cost", + Obligation => "obligation", OtherAdjustment => "other_adjustment", PartialCaptureReversal => "partial_capture_reversal", Payout => "payout", @@ -205,18 +196,16 @@ impl CreateReportingReportRunParametersReportingCategory { } } -impl std::str::FromStr for CreateReportingReportRunParametersReportingCategory { +impl std::str::FromStr for CreateReportingReportRunBuilderParametersReportingCategory { type Err = (); fn from_str(s: &str) -> Result { - use CreateReportingReportRunParametersReportingCategory::*; + use CreateReportingReportRunBuilderParametersReportingCategory::*; match s { "advance" => Ok(Advance), "advance_funding" => Ok(AdvanceFunding), "anticipation_repayment" => Ok(AnticipationRepayment), "charge" => Ok(Charge), "charge_failure" => Ok(ChargeFailure), - "climate_order_purchase" => Ok(ClimateOrderPurchase), - "climate_order_refund" => Ok(ClimateOrderRefund), "connect_collection_transfer" => Ok(ConnectCollectionTransfer), "connect_reserved_funds" => Ok(ConnectReservedFunds), "contribution" => Ok(Contribution), @@ -232,6 +221,7 @@ impl std::str::FromStr for CreateReportingReportRunParametersReportingCategory { "issuing_dispute" => Ok(IssuingDispute), "issuing_transaction" => Ok(IssuingTransaction), "network_cost" => Ok(NetworkCost), + "obligation" => Ok(Obligation), "other_adjustment" => Ok(OtherAdjustment), "partial_capture_reversal" => Ok(PartialCaptureReversal), "payout" => Ok(Payout), @@ -251,18 +241,18 @@ impl std::str::FromStr for CreateReportingReportRunParametersReportingCategory { } } } -impl std::fmt::Display for CreateReportingReportRunParametersReportingCategory { +impl std::fmt::Display for CreateReportingReportRunBuilderParametersReportingCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateReportingReportRunParametersReportingCategory { +impl std::fmt::Debug for CreateReportingReportRunBuilderParametersReportingCategory { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateReportingReportRunParametersReportingCategory { +impl serde::Serialize for CreateReportingReportRunBuilderParametersReportingCategory { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -276,7 +266,7 @@ impl serde::Serialize for CreateReportingReportRunParametersReportingCategory { /// Has no effect on `interval_start` or `interval_end`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateReportingReportRunParametersTimezone { +pub enum CreateReportingReportRunBuilderParametersTimezone { AfricaAbidjan, AfricaAccra, AfricaAddisAbaba, @@ -878,9 +868,9 @@ pub enum CreateReportingReportRunParametersTimezone { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateReportingReportRunParametersTimezone { +impl CreateReportingReportRunBuilderParametersTimezone { pub fn as_str(self) -> &'static str { - use CreateReportingReportRunParametersTimezone::*; + use CreateReportingReportRunBuilderParametersTimezone::*; match self { AfricaAbidjan => "Africa/Abidjan", AfricaAccra => "Africa/Accra", @@ -1485,10 +1475,10 @@ impl CreateReportingReportRunParametersTimezone { } } -impl std::str::FromStr for CreateReportingReportRunParametersTimezone { +impl std::str::FromStr for CreateReportingReportRunBuilderParametersTimezone { type Err = (); fn from_str(s: &str) -> Result { - use CreateReportingReportRunParametersTimezone::*; + use CreateReportingReportRunBuilderParametersTimezone::*; match s { "Africa/Abidjan" => Ok(AfricaAbidjan), "Africa/Accra" => Ok(AfricaAccra), @@ -2092,18 +2082,18 @@ impl std::str::FromStr for CreateReportingReportRunParametersTimezone { } } } -impl std::fmt::Display for CreateReportingReportRunParametersTimezone { +impl std::fmt::Display for CreateReportingReportRunBuilderParametersTimezone { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateReportingReportRunParametersTimezone { +impl std::fmt::Debug for CreateReportingReportRunBuilderParametersTimezone { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateReportingReportRunParametersTimezone { +impl serde::Serialize for CreateReportingReportRunBuilderParametersTimezone { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2111,13 +2101,130 @@ impl serde::Serialize for CreateReportingReportRunParametersTimezone { serializer.serialize_str(self.as_str()) } } +/// Creates a new object and begin running the report. +/// (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).). +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateReportingReportRun<'a> { + inner: CreateReportingReportRunBuilder<'a>, +} impl<'a> CreateReportingReportRun<'a> { - /// Creates a new object and begin running the report. - /// (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).). - pub fn send( + pub fn new(report_type: &'a str) -> Self { + Self { inner: CreateReportingReportRunBuilder::new(report_type) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn parameters(mut self, parameters: CreateReportingReportRunBuilderParameters<'a>) -> Self { + self.inner.parameters = Some(parameters); + self + } +} +impl CreateReportingReportRun<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateReportingReportRun<'_> { + type Output = stripe_misc::ReportingReportRun; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/reporting/report_runs").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListReportingReportRunBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListReportingReportRunBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of Report Runs, with the most recent appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListReportingReportRun<'a> { + inner: ListReportingReportRunBuilder<'a>, +} +impl<'a> ListReportingReportRun<'a> { + pub fn new() -> Self { + Self { inner: ListReportingReportRunBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListReportingReportRun<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/reporting/report_runs", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListReportingReportRun<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/reporting/report_runs").query(&self.inner) } } diff --git a/generated/stripe_misc/src/reporting_report_type/requests.rs b/generated/stripe_misc/src/reporting_report_type/requests.rs index bb6adf037..71fa8d5f8 100644 --- a/generated/stripe_misc/src/reporting_report_type/requests.rs +++ b/generated/stripe_misc/src/reporting_report_type/requests.rs @@ -1,47 +1,104 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListReportingReportType<'a> { +pub struct RetrieveReportingReportTypeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ListReportingReportType<'a> { +impl<'a> RetrieveReportingReportTypeBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListReportingReportType<'a> { - /// Returns a full list of Report Types. - pub fn send( +/// Retrieves the details of a Report Type. +/// (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveReportingReportType<'a> { + inner: RetrieveReportingReportTypeBuilder<'a>, + report_type: &'a stripe_misc::ReportingReportTypeId, +} +impl<'a> RetrieveReportingReportType<'a> { + pub fn new(report_type: &'a stripe_misc::ReportingReportTypeId) -> Self { + Self { report_type, inner: RetrieveReportingReportTypeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveReportingReportType<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/reporting/report_types", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/reporting/report_types", self) +} + +impl StripeRequest for RetrieveReportingReportType<'_> { + type Output = stripe_misc::ReportingReportType; + + fn build(&self) -> RequestBuilder { + let report_type = self.report_type; + RequestBuilder::new(StripeMethod::Get, format!("/reporting/report_types/{report_type}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveReportingReportType<'a> { +pub struct ListReportingReportTypeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveReportingReportType<'a> { +impl<'a> ListReportingReportTypeBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveReportingReportType<'a> { - /// Retrieves the details of a Report Type. - /// (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).). - pub fn send( +/// Returns a full list of Report Types. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListReportingReportType<'a> { + inner: ListReportingReportTypeBuilder<'a>, +} +impl<'a> ListReportingReportType<'a> { + pub fn new() -> Self { + Self { inner: ListReportingReportTypeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ListReportingReportType<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - report_type: &stripe_misc::ReportingReportTypeId, - ) -> stripe::Response { - client.get_query(&format!("/reporting/report_types/{report_type}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListReportingReportType<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/reporting/report_types").query(&self.inner) } } diff --git a/generated/stripe_misc/src/scheduled_query_run/requests.rs b/generated/stripe_misc/src/scheduled_query_run/requests.rs index bebced59e..e9da47e69 100644 --- a/generated/stripe_misc/src/scheduled_query_run/requests.rs +++ b/generated/stripe_misc/src/scheduled_query_run/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListScheduledQueryRun<'a> { +pub struct ListScheduledQueryRunBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,43 +22,114 @@ pub struct ListScheduledQueryRun<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListScheduledQueryRun<'a> { +impl<'a> ListScheduledQueryRunBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of scheduled query runs. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListScheduledQueryRun<'a> { + inner: ListScheduledQueryRunBuilder<'a>, +} impl<'a> ListScheduledQueryRun<'a> { - /// Returns a list of scheduled query runs. - pub fn send( + pub fn new() -> Self { + Self { inner: ListScheduledQueryRunBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListScheduledQueryRun<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/sigma/scheduled_query_runs", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/sigma/scheduled_query_runs", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListScheduledQueryRun<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/sigma/scheduled_query_runs").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveScheduledQueryRun<'a> { +pub struct RetrieveScheduledQueryRunBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveScheduledQueryRun<'a> { +impl<'a> RetrieveScheduledQueryRunBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an scheduled query run. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveScheduledQueryRun<'a> { + inner: RetrieveScheduledQueryRunBuilder<'a>, + scheduled_query_run: &'a str, +} impl<'a> RetrieveScheduledQueryRun<'a> { - /// Retrieves the details of an scheduled query run. - pub fn send( + pub fn new(scheduled_query_run: &'a str) -> Self { + Self { scheduled_query_run, inner: RetrieveScheduledQueryRunBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveScheduledQueryRun<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - scheduled_query_run: &str, - ) -> stripe::Response { - client.get_query(&format!("/sigma/scheduled_query_runs/{scheduled_query_run}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveScheduledQueryRun<'_> { + type Output = stripe_misc::ScheduledQueryRun; + + fn build(&self) -> RequestBuilder { + let scheduled_query_run = self.scheduled_query_run; + RequestBuilder::new( + StripeMethod::Get, + format!("/sigma/scheduled_query_runs/{scheduled_query_run}"), + ) + .query(&self.inner) } } diff --git a/generated/stripe_misc/src/tax_calculation/requests.rs b/generated/stripe_misc/src/tax_calculation/requests.rs index bb3faf6e4..a87026aab 100644 --- a/generated/stripe_misc/src/tax_calculation/requests.rs +++ b/generated/stripe_misc/src/tax_calculation/requests.rs @@ -1,49 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListLineItemsTaxCalculation<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListLineItemsTaxCalculation<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListLineItemsTaxCalculation<'a> { - /// Retrieves the line items of a persisted tax calculation as a collection. - pub fn send( - &self, - client: &stripe::Client, - calculation: &stripe_misc::TaxCalculationId, - ) -> stripe::Response> { - client.get_query(&format!("/tax/calculations/{calculation}/line_items"), self) - } - pub fn paginate( - self, - calculation: &stripe_misc::TaxCalculationId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/tax/calculations/{calculation}/line_items"), - self, - ) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxCalculation<'a> { +pub struct CreateTaxCalculationBuilder<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -53,25 +13,25 @@ pub struct CreateTaxCalculation<'a> { pub customer: Option<&'a str>, /// Details about the customer, including address and tax IDs. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_details: Option>, + pub customer_details: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// A list of items the customer is purchasing. - pub line_items: &'a [CreateTaxCalculationLineItems<'a>], + pub line_items: &'a [CreateTaxCalculationBuilderLineItems<'a>], /// Shipping cost details to be used for the calculation. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, + pub shipping_cost: Option>, /// Timestamp of date at which the tax rules and rates in effect applies for the calculation. /// Measured in seconds since the Unix epoch. /// Can be up to 48 hours in the past, and up to 48 hours in the future. #[serde(skip_serializing_if = "Option::is_none")] pub tax_date: Option, } -impl<'a> CreateTaxCalculation<'a> { +impl<'a> CreateTaxCalculationBuilder<'a> { pub fn new( currency: stripe_types::Currency, - line_items: &'a [CreateTaxCalculationLineItems<'a>], + line_items: &'a [CreateTaxCalculationBuilderLineItems<'a>], ) -> Self { Self { currency, @@ -86,35 +46,33 @@ impl<'a> CreateTaxCalculation<'a> { } /// Details about the customer, including address and tax IDs. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTaxCalculationCustomerDetails<'a> { +pub struct CreateTaxCalculationBuilderCustomerDetails<'a> { /// The customer's postal address (for example, home or business location). #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The type of customer address provided. #[serde(skip_serializing_if = "Option::is_none")] - pub address_source: Option, + pub address_source: Option, /// The customer's IP address (IPv4 or IPv6). #[serde(skip_serializing_if = "Option::is_none")] pub ip_address: Option<&'a str>, /// The customer's tax IDs. - /// Stripe Tax might consider a transaction with applicable tax IDs to be B2B, which might affect the tax calculation result. - /// Stripe Tax doesn't validate tax IDs for correctness. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_ids: Option<&'a [CreateTaxCalculationCustomerDetailsTaxIds<'a>]>, + pub tax_ids: Option<&'a [CreateTaxCalculationBuilderCustomerDetailsTaxIds<'a>]>, /// Overrides the tax calculation result to allow you to not collect tax from your customer. /// Use this if you've manually checked your customer's tax exemptions. /// Prefer providing the customer's `tax_ids` where possible, which automatically determines whether `reverse_charge` applies. #[serde(skip_serializing_if = "Option::is_none")] - pub taxability_override: Option, + pub taxability_override: Option, } -impl<'a> CreateTaxCalculationCustomerDetails<'a> { +impl<'a> CreateTaxCalculationBuilderCustomerDetails<'a> { pub fn new() -> Self { Self::default() } } /// The customer's postal address (for example, home or business location). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxCalculationCustomerDetailsAddress<'a> { +pub struct CreateTaxCalculationBuilderCustomerDetailsAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -134,20 +92,20 @@ pub struct CreateTaxCalculationCustomerDetailsAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateTaxCalculationCustomerDetailsAddress<'a> { +impl<'a> CreateTaxCalculationBuilderCustomerDetailsAddress<'a> { pub fn new(country: &'a str) -> Self { Self { city: None, country, line1: None, line2: None, postal_code: None, state: None } } } /// The type of customer address provided. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxCalculationCustomerDetailsAddressSource { +pub enum CreateTaxCalculationBuilderCustomerDetailsAddressSource { Billing, Shipping, } -impl CreateTaxCalculationCustomerDetailsAddressSource { +impl CreateTaxCalculationBuilderCustomerDetailsAddressSource { pub fn as_str(self) -> &'static str { - use CreateTaxCalculationCustomerDetailsAddressSource::*; + use CreateTaxCalculationBuilderCustomerDetailsAddressSource::*; match self { Billing => "billing", Shipping => "shipping", @@ -155,10 +113,10 @@ impl CreateTaxCalculationCustomerDetailsAddressSource { } } -impl std::str::FromStr for CreateTaxCalculationCustomerDetailsAddressSource { +impl std::str::FromStr for CreateTaxCalculationBuilderCustomerDetailsAddressSource { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxCalculationCustomerDetailsAddressSource::*; + use CreateTaxCalculationBuilderCustomerDetailsAddressSource::*; match s { "billing" => Ok(Billing), "shipping" => Ok(Shipping), @@ -166,18 +124,18 @@ impl std::str::FromStr for CreateTaxCalculationCustomerDetailsAddressSource { } } } -impl std::fmt::Display for CreateTaxCalculationCustomerDetailsAddressSource { +impl std::fmt::Display for CreateTaxCalculationBuilderCustomerDetailsAddressSource { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsAddressSource { +impl std::fmt::Debug for CreateTaxCalculationBuilderCustomerDetailsAddressSource { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxCalculationCustomerDetailsAddressSource { +impl serde::Serialize for CreateTaxCalculationBuilderCustomerDetailsAddressSource { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -186,25 +144,26 @@ impl serde::Serialize for CreateTaxCalculationCustomerDetailsAddressSource { } } /// The customer's tax IDs. -/// Stripe Tax might consider a transaction with applicable tax IDs to be B2B, which might affect the tax calculation result. -/// Stripe Tax doesn't validate tax IDs for correctness. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxCalculationCustomerDetailsTaxIds<'a> { +pub struct CreateTaxCalculationBuilderCustomerDetailsTaxIds<'a> { /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[serde(rename = "type")] - pub type_: CreateTaxCalculationCustomerDetailsTaxIdsType, + pub type_: CreateTaxCalculationBuilderCustomerDetailsTaxIdsType, /// Value of the tax ID. pub value: &'a str, } -impl<'a> CreateTaxCalculationCustomerDetailsTaxIds<'a> { - pub fn new(type_: CreateTaxCalculationCustomerDetailsTaxIdsType, value: &'a str) -> Self { +impl<'a> CreateTaxCalculationBuilderCustomerDetailsTaxIds<'a> { + pub fn new( + type_: CreateTaxCalculationBuilderCustomerDetailsTaxIdsType, + value: &'a str, + ) -> Self { Self { type_, value } } } /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateTaxCalculationCustomerDetailsTaxIdsType { +pub enum CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { AdNrt, AeTrn, ArCuit, @@ -274,9 +233,9 @@ pub enum CreateTaxCalculationCustomerDetailsTaxIdsType { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateTaxCalculationCustomerDetailsTaxIdsType { +impl CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { pub fn as_str(self) -> &'static str { - use CreateTaxCalculationCustomerDetailsTaxIdsType::*; + use CreateTaxCalculationBuilderCustomerDetailsTaxIdsType::*; match self { AdNrt => "ad_nrt", AeTrn => "ae_trn", @@ -349,10 +308,10 @@ impl CreateTaxCalculationCustomerDetailsTaxIdsType { } } -impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxIdsType { +impl std::str::FromStr for CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxCalculationCustomerDetailsTaxIdsType::*; + use CreateTaxCalculationBuilderCustomerDetailsTaxIdsType::*; match s { "ad_nrt" => Ok(AdNrt), "ae_trn" => Ok(AeTrn), @@ -424,18 +383,18 @@ impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxIdsType { } } } -impl std::fmt::Display for CreateTaxCalculationCustomerDetailsTaxIdsType { +impl std::fmt::Display for CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsTaxIdsType { +impl std::fmt::Debug for CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxIdsType { +impl serde::Serialize for CreateTaxCalculationBuilderCustomerDetailsTaxIdsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -447,14 +406,14 @@ impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxIdsType { /// Use this if you've manually checked your customer's tax exemptions. /// Prefer providing the customer's `tax_ids` where possible, which automatically determines whether `reverse_charge` applies. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxCalculationCustomerDetailsTaxabilityOverride { +pub enum CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { CustomerExempt, None, ReverseCharge, } -impl CreateTaxCalculationCustomerDetailsTaxabilityOverride { +impl CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { pub fn as_str(self) -> &'static str { - use CreateTaxCalculationCustomerDetailsTaxabilityOverride::*; + use CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride::*; match self { CustomerExempt => "customer_exempt", None => "none", @@ -463,10 +422,10 @@ impl CreateTaxCalculationCustomerDetailsTaxabilityOverride { } } -impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxabilityOverride { +impl std::str::FromStr for CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxCalculationCustomerDetailsTaxabilityOverride::*; + use CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride::*; match s { "customer_exempt" => Ok(CustomerExempt), "none" => Ok(None), @@ -475,18 +434,18 @@ impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxabilityOverride } } } -impl std::fmt::Display for CreateTaxCalculationCustomerDetailsTaxabilityOverride { +impl std::fmt::Display for CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsTaxabilityOverride { +impl std::fmt::Debug for CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxabilityOverride { +impl serde::Serialize for CreateTaxCalculationBuilderCustomerDetailsTaxabilityOverride { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -496,8 +455,8 @@ impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxabilityOverride } /// A list of items the customer is purchasing. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxCalculationLineItems<'a> { - /// A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) representing the line item's total price. +pub struct CreateTaxCalculationBuilderLineItems<'a> { + /// A positive integer in cents representing the line item's total price. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes are calculated on top of this amount. pub amount: i64, @@ -515,14 +474,14 @@ pub struct CreateTaxCalculationLineItems<'a> { pub reference: Option<&'a str>, /// Specifies whether the `amount` includes taxes. Defaults to `exclusive`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID to use for this line item. /// If not provided, we will use the tax code from the provided `product` param. /// If neither `tax_code` nor `product` is provided, we will use the default tax code from your Tax Settings. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, } -impl<'a> CreateTaxCalculationLineItems<'a> { +impl<'a> CreateTaxCalculationBuilderLineItems<'a> { pub fn new(amount: i64) -> Self { Self { amount, @@ -536,13 +495,13 @@ impl<'a> CreateTaxCalculationLineItems<'a> { } /// Specifies whether the `amount` includes taxes. Defaults to `exclusive`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxCalculationLineItemsTaxBehavior { +pub enum CreateTaxCalculationBuilderLineItemsTaxBehavior { Exclusive, Inclusive, } -impl CreateTaxCalculationLineItemsTaxBehavior { +impl CreateTaxCalculationBuilderLineItemsTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateTaxCalculationLineItemsTaxBehavior::*; + use CreateTaxCalculationBuilderLineItemsTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -550,10 +509,10 @@ impl CreateTaxCalculationLineItemsTaxBehavior { } } -impl std::str::FromStr for CreateTaxCalculationLineItemsTaxBehavior { +impl std::str::FromStr for CreateTaxCalculationBuilderLineItemsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxCalculationLineItemsTaxBehavior::*; + use CreateTaxCalculationBuilderLineItemsTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -561,18 +520,18 @@ impl std::str::FromStr for CreateTaxCalculationLineItemsTaxBehavior { } } } -impl std::fmt::Display for CreateTaxCalculationLineItemsTaxBehavior { +impl std::fmt::Display for CreateTaxCalculationBuilderLineItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxCalculationLineItemsTaxBehavior { +impl std::fmt::Debug for CreateTaxCalculationBuilderLineItemsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxCalculationLineItemsTaxBehavior { +impl serde::Serialize for CreateTaxCalculationBuilderLineItemsTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -582,8 +541,8 @@ impl serde::Serialize for CreateTaxCalculationLineItemsTaxBehavior { } /// Shipping cost details to be used for the calculation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTaxCalculationShippingCost<'a> { - /// A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) representing the shipping charge. +pub struct CreateTaxCalculationBuilderShippingCost<'a> { + /// A positive integer in cents representing the shipping charge. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes are calculated on top of this amount. #[serde(skip_serializing_if = "Option::is_none")] @@ -596,13 +555,13 @@ pub struct CreateTaxCalculationShippingCost<'a> { /// If `tax_behavior=inclusive`, then the amount includes taxes. /// Defaults to `exclusive`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// The [tax code](https://stripe.com/docs/tax/tax-categories) used to calculate tax on shipping. /// If not provided, the default shipping tax code from your [Tax Settings](/settings/tax) is used. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, } -impl<'a> CreateTaxCalculationShippingCost<'a> { +impl<'a> CreateTaxCalculationBuilderShippingCost<'a> { pub fn new() -> Self { Self::default() } @@ -611,13 +570,13 @@ impl<'a> CreateTaxCalculationShippingCost<'a> { /// If `tax_behavior=inclusive`, then the amount includes taxes. /// Defaults to `exclusive`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxCalculationShippingCostTaxBehavior { +pub enum CreateTaxCalculationBuilderShippingCostTaxBehavior { Exclusive, Inclusive, } -impl CreateTaxCalculationShippingCostTaxBehavior { +impl CreateTaxCalculationBuilderShippingCostTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateTaxCalculationShippingCostTaxBehavior::*; + use CreateTaxCalculationBuilderShippingCostTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -625,10 +584,10 @@ impl CreateTaxCalculationShippingCostTaxBehavior { } } -impl std::str::FromStr for CreateTaxCalculationShippingCostTaxBehavior { +impl std::str::FromStr for CreateTaxCalculationBuilderShippingCostTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxCalculationShippingCostTaxBehavior::*; + use CreateTaxCalculationBuilderShippingCostTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -636,18 +595,18 @@ impl std::str::FromStr for CreateTaxCalculationShippingCostTaxBehavior { } } } -impl std::fmt::Display for CreateTaxCalculationShippingCostTaxBehavior { +impl std::fmt::Display for CreateTaxCalculationBuilderShippingCostTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxCalculationShippingCostTaxBehavior { +impl std::fmt::Debug for CreateTaxCalculationBuilderShippingCostTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxCalculationShippingCostTaxBehavior { +impl serde::Serialize for CreateTaxCalculationBuilderShippingCostTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -655,9 +614,152 @@ impl serde::Serialize for CreateTaxCalculationShippingCostTaxBehavior { serializer.serialize_str(self.as_str()) } } +/// Calculates tax based on input and returns a Tax `Calculation` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTaxCalculation<'a> { + inner: CreateTaxCalculationBuilder<'a>, +} impl<'a> CreateTaxCalculation<'a> { - /// Calculates tax based on input and returns a Tax `Calculation` object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax/calculations", self, http_types::Method::Post) + pub fn new( + currency: stripe_types::Currency, + line_items: &'a [CreateTaxCalculationBuilderLineItems<'a>], + ) -> Self { + Self { inner: CreateTaxCalculationBuilder::new(currency, line_items) } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_details( + mut self, + customer_details: CreateTaxCalculationBuilderCustomerDetails<'a>, + ) -> Self { + self.inner.customer_details = Some(customer_details); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn shipping_cost( + mut self, + shipping_cost: CreateTaxCalculationBuilderShippingCost<'a>, + ) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } + + pub fn tax_date(mut self, tax_date: stripe_types::Timestamp) -> Self { + self.inner.tax_date = Some(tax_date); + self + } +} +impl CreateTaxCalculation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTaxCalculation<'_> { + type Output = stripe_misc::TaxCalculation; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax/calculations").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListLineItemsTaxCalculationBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListLineItemsTaxCalculationBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the line items of a persisted tax calculation as a collection. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListLineItemsTaxCalculation<'a> { + inner: ListLineItemsTaxCalculationBuilder<'a>, + calculation: &'a stripe_misc::TaxCalculationId, +} +impl<'a> ListLineItemsTaxCalculation<'a> { + pub fn new(calculation: &'a stripe_misc::TaxCalculationId) -> Self { + Self { calculation, inner: ListLineItemsTaxCalculationBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListLineItemsTaxCalculation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListLineItemsTaxCalculation<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let calculation = self.calculation; + RequestBuilder::new( + StripeMethod::Get, + format!("/tax/calculations/{calculation}/line_items"), + ) + .query(&self.inner) } } diff --git a/generated/stripe_misc/src/tax_calculation_line_item.rs b/generated/stripe_misc/src/tax_calculation_line_item.rs index 6b66c87bf..ac9b3eb53 100644 --- a/generated/stripe_misc/src/tax_calculation_line_item.rs +++ b/generated/stripe_misc/src/tax_calculation_line_item.rs @@ -1,10 +1,10 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxCalculationLineItem { - /// The line item amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The line item amount in integer cents. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes were calculated on top of this amount. pub amount: i64, - /// The amount of tax calculated for this line item, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax calculated for this line item, in integer cents. pub amount_tax: i64, /// Unique identifier for the object. pub id: stripe_misc::TaxCalculationLineItemId, diff --git a/generated/stripe_misc/src/tax_product_resource_line_item_tax_breakdown.rs b/generated/stripe_misc/src/tax_product_resource_line_item_tax_breakdown.rs index b69be54d9..c8bd64cfb 100644 --- a/generated/stripe_misc/src/tax_product_resource_line_item_tax_breakdown.rs +++ b/generated/stripe_misc/src/tax_product_resource_line_item_tax_breakdown.rs @@ -1,6 +1,6 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxProductResourceLineItemTaxBreakdown { - /// The amount of tax, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax, in integer cents. pub amount: i64, pub jurisdiction: stripe_misc::TaxProductResourceJurisdiction, /// Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). @@ -11,7 +11,7 @@ pub struct TaxProductResourceLineItemTaxBreakdown { /// The reasoning behind this tax, for example, if the product is tax exempt. /// The possible values for this field may be extended as new tax rules are supported. pub taxability_reason: TaxProductResourceLineItemTaxBreakdownTaxabilityReason, - /// The amount on which tax is calculated, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount on which tax is calculated, in integer cents. pub taxable_amount: i64, } /// Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). diff --git a/generated/stripe_misc/src/tax_product_resource_tax_breakdown.rs b/generated/stripe_misc/src/tax_product_resource_tax_breakdown.rs index ee5b2c3e5..5746ed01c 100644 --- a/generated/stripe_misc/src/tax_product_resource_tax_breakdown.rs +++ b/generated/stripe_misc/src/tax_product_resource_tax_breakdown.rs @@ -1,6 +1,6 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxProductResourceTaxBreakdown { - /// The amount of tax, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax, in integer cents. pub amount: i64, /// Specifies whether the tax amount is included in the line item amount. pub inclusive: bool, @@ -8,7 +8,7 @@ pub struct TaxProductResourceTaxBreakdown { /// The reasoning behind this tax, for example, if the product is tax exempt. /// We might extend the possible values for this field to support new tax rules. pub taxability_reason: TaxProductResourceTaxBreakdownTaxabilityReason, - /// The amount on which tax is calculated, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount on which tax is calculated, in integer cents. pub taxable_amount: i64, } /// The reasoning behind this tax, for example, if the product is tax exempt. diff --git a/generated/stripe_misc/src/tax_product_resource_tax_calculation_shipping_cost.rs b/generated/stripe_misc/src/tax_product_resource_tax_calculation_shipping_cost.rs index 0ed83962c..fda3c28f7 100644 --- a/generated/stripe_misc/src/tax_product_resource_tax_calculation_shipping_cost.rs +++ b/generated/stripe_misc/src/tax_product_resource_tax_calculation_shipping_cost.rs @@ -1,10 +1,10 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxProductResourceTaxCalculationShippingCost { - /// The shipping amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The shipping amount in integer cents. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes were calculated on top of this amount. pub amount: i64, - /// The amount of tax calculated for shipping, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax calculated for shipping, in integer cents. pub amount_tax: i64, /// The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/stripe_misc/src/tax_product_resource_tax_transaction_shipping_cost.rs b/generated/stripe_misc/src/tax_product_resource_tax_transaction_shipping_cost.rs index c23e6bb91..d2e6cf737 100644 --- a/generated/stripe_misc/src/tax_product_resource_tax_transaction_shipping_cost.rs +++ b/generated/stripe_misc/src/tax_product_resource_tax_transaction_shipping_cost.rs @@ -1,10 +1,10 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxProductResourceTaxTransactionShippingCost { - /// The shipping amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The shipping amount in integer cents. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes were calculated on top of this amount. pub amount: i64, - /// The amount of tax calculated for shipping, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax calculated for shipping, in integer cents. pub amount_tax: i64, /// The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/stripe_misc/src/tax_registration/requests.rs b/generated/stripe_misc/src/tax_registration/requests.rs index a64b8d749..b552f4e26 100644 --- a/generated/stripe_misc/src/tax_registration/requests.rs +++ b/generated/stripe_misc/src/tax_registration/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTaxRegistration<'a> { +pub struct ListTaxRegistrationBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -19,24 +23,24 @@ pub struct ListTaxRegistration<'a> { pub starting_after: Option<&'a str>, /// The status of the Tax Registration. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } -impl<'a> ListTaxRegistration<'a> { +impl<'a> ListTaxRegistrationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The status of the Tax Registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTaxRegistrationStatus { +pub enum ListTaxRegistrationBuilderStatus { Active, All, Expired, Scheduled, } -impl ListTaxRegistrationStatus { +impl ListTaxRegistrationBuilderStatus { pub fn as_str(self) -> &'static str { - use ListTaxRegistrationStatus::*; + use ListTaxRegistrationBuilderStatus::*; match self { Active => "active", All => "all", @@ -46,10 +50,10 @@ impl ListTaxRegistrationStatus { } } -impl std::str::FromStr for ListTaxRegistrationStatus { +impl std::str::FromStr for ListTaxRegistrationBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use ListTaxRegistrationStatus::*; + use ListTaxRegistrationBuilderStatus::*; match s { "active" => Ok(Active), "all" => Ok(All), @@ -59,18 +63,18 @@ impl std::str::FromStr for ListTaxRegistrationStatus { } } } -impl std::fmt::Display for ListTaxRegistrationStatus { +impl std::fmt::Display for ListTaxRegistrationBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTaxRegistrationStatus { +impl std::fmt::Debug for ListTaxRegistrationBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTaxRegistrationStatus { +impl serde::Serialize for ListTaxRegistrationBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -78,50 +82,72 @@ impl serde::Serialize for ListTaxRegistrationStatus { serializer.serialize_str(self.as_str()) } } +/// Returns a list of Tax `Registration` objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTaxRegistration<'a> { + inner: ListTaxRegistrationBuilder<'a>, +} impl<'a> ListTaxRegistration<'a> { - /// Returns a list of Tax `Registration` objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/tax/registrations", self) + pub fn new() -> Self { + Self { inner: ListTaxRegistrationBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/tax/registrations", self) + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTaxRegistration<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTaxRegistration<'a> { - pub fn new() -> Self { - Self::default() + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: ListTaxRegistrationBuilderStatus) -> Self { + self.inner.status = Some(status); + self } } -impl<'a> RetrieveTaxRegistration<'a> { - /// Returns a Tax `Registration` object. - pub fn send( +impl ListTaxRegistration<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_misc::TaxRegistrationId, - ) -> stripe::Response { - client.get_query(&format!("/tax/registrations/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTaxRegistration<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/tax/registrations").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistration<'a> { +pub struct CreateTaxRegistrationBuilder<'a> { /// Time at which the Tax Registration becomes active. /// It can be either `now` to indicate the current time, or a future timestamp measured in seconds since the Unix epoch. - pub active_from: CreateTaxRegistrationActiveFrom, + pub active_from: CreateTaxRegistrationBuilderActiveFrom, /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). pub country: &'a str, /// Specific options for a registration in the specified `country`. - pub country_options: CreateTaxRegistrationCountryOptions<'a>, + pub country_options: CreateTaxRegistrationBuilderCountryOptions<'a>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -131,11 +157,11 @@ pub struct CreateTaxRegistration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expires_at: Option, } -impl<'a> CreateTaxRegistration<'a> { +impl<'a> CreateTaxRegistrationBuilder<'a> { pub fn new( - active_from: CreateTaxRegistrationActiveFrom, + active_from: CreateTaxRegistrationBuilderActiveFrom, country: &'a str, - country_options: CreateTaxRegistrationCountryOptions<'a>, + country_options: CreateTaxRegistrationBuilderCountryOptions<'a>, ) -> Self { Self { active_from, country, country_options, expand: None, expires_at: None } } @@ -144,214 +170,214 @@ impl<'a> CreateTaxRegistration<'a> { /// It can be either `now` to indicate the current time, or a future timestamp measured in seconds since the Unix epoch. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateTaxRegistrationActiveFrom { +pub enum CreateTaxRegistrationBuilderActiveFrom { Now, Timestamp(stripe_types::Timestamp), } /// Specific options for a registration in the specified `country`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptions<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptions<'a> { /// Options for the registration in AE. #[serde(skip_serializing_if = "Option::is_none")] - pub ae: Option, + pub ae: Option, /// Options for the registration in AT. #[serde(skip_serializing_if = "Option::is_none")] - pub at: Option, + pub at: Option, /// Options for the registration in AU. #[serde(skip_serializing_if = "Option::is_none")] - pub au: Option, + pub au: Option, /// Options for the registration in BE. #[serde(skip_serializing_if = "Option::is_none")] - pub be: Option, + pub be: Option, /// Options for the registration in BG. #[serde(skip_serializing_if = "Option::is_none")] - pub bg: Option, + pub bg: Option, /// Options for the registration in CA. #[serde(skip_serializing_if = "Option::is_none")] - pub ca: Option>, + pub ca: Option>, /// Options for the registration in CH. #[serde(skip_serializing_if = "Option::is_none")] - pub ch: Option, + pub ch: Option, /// Options for the registration in CL. #[serde(skip_serializing_if = "Option::is_none")] - pub cl: Option, + pub cl: Option, /// Options for the registration in CO. #[serde(skip_serializing_if = "Option::is_none")] - pub co: Option, + pub co: Option, /// Options for the registration in CY. #[serde(skip_serializing_if = "Option::is_none")] - pub cy: Option, + pub cy: Option, /// Options for the registration in CZ. #[serde(skip_serializing_if = "Option::is_none")] - pub cz: Option, + pub cz: Option, /// Options for the registration in DE. #[serde(skip_serializing_if = "Option::is_none")] - pub de: Option, + pub de: Option, /// Options for the registration in DK. #[serde(skip_serializing_if = "Option::is_none")] - pub dk: Option, + pub dk: Option, /// Options for the registration in EE. #[serde(skip_serializing_if = "Option::is_none")] - pub ee: Option, + pub ee: Option, /// Options for the registration in ES. #[serde(skip_serializing_if = "Option::is_none")] - pub es: Option, + pub es: Option, /// Options for the registration in FI. #[serde(skip_serializing_if = "Option::is_none")] - pub fi: Option, + pub fi: Option, /// Options for the registration in FR. #[serde(skip_serializing_if = "Option::is_none")] - pub fr: Option, + pub fr: Option, /// Options for the registration in GB. #[serde(skip_serializing_if = "Option::is_none")] - pub gb: Option, + pub gb: Option, /// Options for the registration in GR. #[serde(skip_serializing_if = "Option::is_none")] - pub gr: Option, + pub gr: Option, /// Options for the registration in HR. #[serde(skip_serializing_if = "Option::is_none")] - pub hr: Option, + pub hr: Option, /// Options for the registration in HU. #[serde(skip_serializing_if = "Option::is_none")] - pub hu: Option, + pub hu: Option, /// Options for the registration in ID. #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Options for the registration in IE. #[serde(skip_serializing_if = "Option::is_none")] - pub ie: Option, + pub ie: Option, /// Options for the registration in IS. #[serde(skip_serializing_if = "Option::is_none")] - pub is: Option, + pub is: Option, /// Options for the registration in IT. #[serde(skip_serializing_if = "Option::is_none")] - pub it: Option, + pub it: Option, /// Options for the registration in JP. #[serde(skip_serializing_if = "Option::is_none")] - pub jp: Option, + pub jp: Option, /// Options for the registration in KR. #[serde(skip_serializing_if = "Option::is_none")] - pub kr: Option, + pub kr: Option, /// Options for the registration in LT. #[serde(skip_serializing_if = "Option::is_none")] - pub lt: Option, + pub lt: Option, /// Options for the registration in LU. #[serde(skip_serializing_if = "Option::is_none")] - pub lu: Option, + pub lu: Option, /// Options for the registration in LV. #[serde(skip_serializing_if = "Option::is_none")] - pub lv: Option, + pub lv: Option, /// Options for the registration in MT. #[serde(skip_serializing_if = "Option::is_none")] - pub mt: Option, + pub mt: Option, /// Options for the registration in MX. #[serde(skip_serializing_if = "Option::is_none")] - pub mx: Option, + pub mx: Option, /// Options for the registration in MY. #[serde(skip_serializing_if = "Option::is_none")] - pub my: Option, + pub my: Option, /// Options for the registration in NL. #[serde(skip_serializing_if = "Option::is_none")] - pub nl: Option, + pub nl: Option, /// Options for the registration in NO. #[serde(skip_serializing_if = "Option::is_none")] - pub no: Option, + pub no: Option, /// Options for the registration in NZ. #[serde(skip_serializing_if = "Option::is_none")] - pub nz: Option, + pub nz: Option, /// Options for the registration in PL. #[serde(skip_serializing_if = "Option::is_none")] - pub pl: Option, + pub pl: Option, /// Options for the registration in PT. #[serde(skip_serializing_if = "Option::is_none")] - pub pt: Option, + pub pt: Option, /// Options for the registration in RO. #[serde(skip_serializing_if = "Option::is_none")] - pub ro: Option, + pub ro: Option, /// Options for the registration in SA. #[serde(skip_serializing_if = "Option::is_none")] - pub sa: Option, + pub sa: Option, /// Options for the registration in SE. #[serde(skip_serializing_if = "Option::is_none")] - pub se: Option, + pub se: Option, /// Options for the registration in SG. #[serde(skip_serializing_if = "Option::is_none")] - pub sg: Option, + pub sg: Option, /// Options for the registration in SI. #[serde(skip_serializing_if = "Option::is_none")] - pub si: Option, + pub si: Option, /// Options for the registration in SK. #[serde(skip_serializing_if = "Option::is_none")] - pub sk: Option, + pub sk: Option, /// Options for the registration in TH. #[serde(skip_serializing_if = "Option::is_none")] - pub th: Option, + pub th: Option, /// Options for the registration in TR. #[serde(skip_serializing_if = "Option::is_none")] - pub tr: Option, + pub tr: Option, /// Options for the registration in US. #[serde(skip_serializing_if = "Option::is_none")] - pub us: Option>, + pub us: Option>, /// Options for the registration in VN. #[serde(skip_serializing_if = "Option::is_none")] - pub vn: Option, + pub vn: Option, /// Options for the registration in ZA. #[serde(skip_serializing_if = "Option::is_none")] - pub za: Option, + pub za: Option, } -impl<'a> CreateTaxRegistrationCountryOptions<'a> { +impl<'a> CreateTaxRegistrationBuilderCountryOptions<'a> { pub fn new() -> Self { Self::default() } } /// Options for the registration in AE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsAe { +pub struct CreateTaxRegistrationBuilderCountryOptionsAe { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsAeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsAeType, } -impl CreateTaxRegistrationCountryOptionsAe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsAeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsAe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsAeType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsAeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsAeType { Standard, } -impl CreateTaxRegistrationCountryOptionsAeType { +impl CreateTaxRegistrationBuilderCountryOptionsAeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsAeType::*; + use CreateTaxRegistrationBuilderCountryOptionsAeType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsAeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsAeType::*; + use CreateTaxRegistrationBuilderCountryOptionsAeType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsAeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsAeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsAeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsAeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsAeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsAeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -361,41 +387,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsAeType { } /// Options for the registration in AT. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsAt { +pub struct CreateTaxRegistrationBuilderCountryOptionsAt { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsAtType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsAtType, } -impl CreateTaxRegistrationCountryOptionsAt { - pub fn new(type_: CreateTaxRegistrationCountryOptionsAtType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsAt { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsAtType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsAtStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsAtStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsAtStandard { +impl CreateTaxRegistrationBuilderCountryOptionsAtStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -403,10 +430,10 @@ impl CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -414,18 +441,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsAtStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -435,15 +462,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsAtStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsAtType { +pub enum CreateTaxRegistrationBuilderCountryOptionsAtType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsAtType { +impl CreateTaxRegistrationBuilderCountryOptionsAtType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsAtType::*; + use CreateTaxRegistrationBuilderCountryOptionsAtType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -453,10 +480,10 @@ impl CreateTaxRegistrationCountryOptionsAtType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAtType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsAtType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsAtType::*; + use CreateTaxRegistrationBuilderCountryOptionsAtType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -466,18 +493,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAtType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsAtType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsAtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsAtType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsAtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsAtType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsAtType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -487,52 +514,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsAtType { } /// Options for the registration in AU. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsAu { +pub struct CreateTaxRegistrationBuilderCountryOptionsAu { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsAuType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsAuType, } -impl CreateTaxRegistrationCountryOptionsAu { - pub fn new(type_: CreateTaxRegistrationCountryOptionsAuType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsAu { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsAuType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsAuType { +pub enum CreateTaxRegistrationBuilderCountryOptionsAuType { Standard, } -impl CreateTaxRegistrationCountryOptionsAuType { +impl CreateTaxRegistrationBuilderCountryOptionsAuType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsAuType::*; + use CreateTaxRegistrationBuilderCountryOptionsAuType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsAuType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsAuType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsAuType::*; + use CreateTaxRegistrationBuilderCountryOptionsAuType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsAuType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsAuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsAuType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsAuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsAuType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsAuType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -542,41 +569,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsAuType { } /// Options for the registration in BE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsBe { +pub struct CreateTaxRegistrationBuilderCountryOptionsBe { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsBeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsBeType, } -impl CreateTaxRegistrationCountryOptionsBe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsBeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsBe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsBeType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsBeStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsBeStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsBeStandard { +impl CreateTaxRegistrationBuilderCountryOptionsBeStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -584,10 +612,10 @@ impl CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -595,18 +623,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsBeStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -616,15 +644,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsBeStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsBeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsBeType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsBeType { +impl CreateTaxRegistrationBuilderCountryOptionsBeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsBeType::*; + use CreateTaxRegistrationBuilderCountryOptionsBeType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -634,10 +662,10 @@ impl CreateTaxRegistrationCountryOptionsBeType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsBeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsBeType::*; + use CreateTaxRegistrationBuilderCountryOptionsBeType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -647,18 +675,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBeType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsBeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsBeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsBeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsBeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsBeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsBeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -668,41 +696,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsBeType { } /// Options for the registration in BG. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsBg { +pub struct CreateTaxRegistrationBuilderCountryOptionsBg { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsBgType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsBgType, } -impl CreateTaxRegistrationCountryOptionsBg { - pub fn new(type_: CreateTaxRegistrationCountryOptionsBgType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsBg { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsBgType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsBgStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsBgStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsBgStandard { +impl CreateTaxRegistrationBuilderCountryOptionsBgStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -710,10 +739,10 @@ impl CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -721,18 +750,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsBgStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -742,15 +771,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsBgStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsBgType { +pub enum CreateTaxRegistrationBuilderCountryOptionsBgType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsBgType { +impl CreateTaxRegistrationBuilderCountryOptionsBgType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsBgType::*; + use CreateTaxRegistrationBuilderCountryOptionsBgType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -760,10 +789,10 @@ impl CreateTaxRegistrationCountryOptionsBgType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBgType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsBgType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsBgType::*; + use CreateTaxRegistrationBuilderCountryOptionsBgType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -773,18 +802,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsBgType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsBgType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsBgType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsBgType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsBgType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsBgType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsBgType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -794,40 +823,40 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsBgType { } /// Options for the registration in CA. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCa<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptionsCa<'a> { /// Options for the provincial tax registration. #[serde(skip_serializing_if = "Option::is_none")] - pub province_standard: Option>, + pub province_standard: Option>, /// Type of registration to be created in Canada. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsCaType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsCaType, } -impl<'a> CreateTaxRegistrationCountryOptionsCa<'a> { - pub fn new(type_: CreateTaxRegistrationCountryOptionsCaType) -> Self { +impl<'a> CreateTaxRegistrationBuilderCountryOptionsCa<'a> { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsCaType) -> Self { Self { province_standard: None, type_ } } } /// Options for the provincial tax registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCaProvinceStandard<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptionsCaProvinceStandard<'a> { /// Two-letter CA province code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). pub province: &'a str, } -impl<'a> CreateTaxRegistrationCountryOptionsCaProvinceStandard<'a> { +impl<'a> CreateTaxRegistrationBuilderCountryOptionsCaProvinceStandard<'a> { pub fn new(province: &'a str) -> Self { Self { province } } } /// Type of registration to be created in Canada. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCaType { +pub enum CreateTaxRegistrationBuilderCountryOptionsCaType { ProvinceStandard, Simplified, Standard, } -impl CreateTaxRegistrationCountryOptionsCaType { +impl CreateTaxRegistrationBuilderCountryOptionsCaType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCaType::*; + use CreateTaxRegistrationBuilderCountryOptionsCaType::*; match self { ProvinceStandard => "province_standard", Simplified => "simplified", @@ -836,10 +865,10 @@ impl CreateTaxRegistrationCountryOptionsCaType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCaType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCaType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCaType::*; + use CreateTaxRegistrationBuilderCountryOptionsCaType::*; match s { "province_standard" => Ok(ProvinceStandard), "simplified" => Ok(Simplified), @@ -848,18 +877,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCaType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCaType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCaType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCaType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCaType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -869,52 +898,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCaType { } /// Options for the registration in CH. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCh { +pub struct CreateTaxRegistrationBuilderCountryOptionsCh { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsChType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsChType, } -impl CreateTaxRegistrationCountryOptionsCh { - pub fn new(type_: CreateTaxRegistrationCountryOptionsChType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsCh { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsChType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsChType { +pub enum CreateTaxRegistrationBuilderCountryOptionsChType { Standard, } -impl CreateTaxRegistrationCountryOptionsChType { +impl CreateTaxRegistrationBuilderCountryOptionsChType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsChType::*; + use CreateTaxRegistrationBuilderCountryOptionsChType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsChType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsChType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsChType::*; + use CreateTaxRegistrationBuilderCountryOptionsChType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsChType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsChType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsChType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsChType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsChType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsChType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -924,52 +953,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsChType { } /// Options for the registration in CL. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCl { +pub struct CreateTaxRegistrationBuilderCountryOptionsCl { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsClType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsClType, } -impl CreateTaxRegistrationCountryOptionsCl { - pub fn new(type_: CreateTaxRegistrationCountryOptionsClType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsCl { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsClType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsClType { +pub enum CreateTaxRegistrationBuilderCountryOptionsClType { Simplified, } -impl CreateTaxRegistrationCountryOptionsClType { +impl CreateTaxRegistrationBuilderCountryOptionsClType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsClType::*; + use CreateTaxRegistrationBuilderCountryOptionsClType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsClType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsClType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsClType::*; + use CreateTaxRegistrationBuilderCountryOptionsClType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsClType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsClType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsClType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsClType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsClType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsClType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -979,52 +1008,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsClType { } /// Options for the registration in CO. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCo { +pub struct CreateTaxRegistrationBuilderCountryOptionsCo { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsCoType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsCoType, } -impl CreateTaxRegistrationCountryOptionsCo { - pub fn new(type_: CreateTaxRegistrationCountryOptionsCoType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsCo { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsCoType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCoType { +pub enum CreateTaxRegistrationBuilderCountryOptionsCoType { Simplified, } -impl CreateTaxRegistrationCountryOptionsCoType { +impl CreateTaxRegistrationBuilderCountryOptionsCoType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCoType::*; + use CreateTaxRegistrationBuilderCountryOptionsCoType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCoType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCoType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCoType::*; + use CreateTaxRegistrationBuilderCountryOptionsCoType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCoType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCoType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCoType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCoType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1034,41 +1063,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCoType { } /// Options for the registration in CY. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCy { +pub struct CreateTaxRegistrationBuilderCountryOptionsCy { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsCyType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsCyType, } -impl CreateTaxRegistrationCountryOptionsCy { - pub fn new(type_: CreateTaxRegistrationCountryOptionsCyType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsCy { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsCyType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCyStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsCyStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsCyStandard { +impl CreateTaxRegistrationBuilderCountryOptionsCyStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1076,10 +1106,10 @@ impl CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1087,18 +1117,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCyStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1108,15 +1138,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCyStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCyType { +pub enum CreateTaxRegistrationBuilderCountryOptionsCyType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsCyType { +impl CreateTaxRegistrationBuilderCountryOptionsCyType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCyType::*; + use CreateTaxRegistrationBuilderCountryOptionsCyType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1126,10 +1156,10 @@ impl CreateTaxRegistrationCountryOptionsCyType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCyType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCyType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCyType::*; + use CreateTaxRegistrationBuilderCountryOptionsCyType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1139,18 +1169,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCyType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCyType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCyType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCyType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCyType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCyType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCyType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1160,41 +1190,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCyType { } /// Options for the registration in CZ. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCz { +pub struct CreateTaxRegistrationBuilderCountryOptionsCz { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsCzType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsCzType, } -impl CreateTaxRegistrationCountryOptionsCz { - pub fn new(type_: CreateTaxRegistrationCountryOptionsCzType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsCz { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsCzType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsCzStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsCzStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsCzStandard { +impl CreateTaxRegistrationBuilderCountryOptionsCzStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1202,10 +1233,10 @@ impl CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1213,18 +1244,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCzStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1234,15 +1265,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCzStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsCzType { +pub enum CreateTaxRegistrationBuilderCountryOptionsCzType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsCzType { +impl CreateTaxRegistrationBuilderCountryOptionsCzType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsCzType::*; + use CreateTaxRegistrationBuilderCountryOptionsCzType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1252,10 +1283,10 @@ impl CreateTaxRegistrationCountryOptionsCzType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCzType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsCzType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsCzType::*; + use CreateTaxRegistrationBuilderCountryOptionsCzType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1265,18 +1296,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsCzType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsCzType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsCzType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsCzType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsCzType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsCzType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsCzType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1286,41 +1317,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsCzType { } /// Options for the registration in DE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsDe { +pub struct CreateTaxRegistrationBuilderCountryOptionsDe { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsDeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsDeType, } -impl CreateTaxRegistrationCountryOptionsDe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsDeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsDe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsDeType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsDeStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsDeStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsDeStandard { +impl CreateTaxRegistrationBuilderCountryOptionsDeStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1328,10 +1360,10 @@ impl CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1339,18 +1371,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsDeStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1360,15 +1392,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsDeStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsDeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsDeType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsDeType { +impl CreateTaxRegistrationBuilderCountryOptionsDeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsDeType::*; + use CreateTaxRegistrationBuilderCountryOptionsDeType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1378,10 +1410,10 @@ impl CreateTaxRegistrationCountryOptionsDeType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsDeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsDeType::*; + use CreateTaxRegistrationBuilderCountryOptionsDeType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1391,18 +1423,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDeType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsDeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsDeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsDeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsDeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsDeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsDeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1412,41 +1444,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsDeType { } /// Options for the registration in DK. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsDk { +pub struct CreateTaxRegistrationBuilderCountryOptionsDk { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsDkType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsDkType, } -impl CreateTaxRegistrationCountryOptionsDk { - pub fn new(type_: CreateTaxRegistrationCountryOptionsDkType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsDk { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsDkType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsDkStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsDkStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsDkStandard { +impl CreateTaxRegistrationBuilderCountryOptionsDkStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1454,10 +1487,10 @@ impl CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1465,18 +1498,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsDkStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1486,15 +1519,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsDkStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsDkType { +pub enum CreateTaxRegistrationBuilderCountryOptionsDkType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsDkType { +impl CreateTaxRegistrationBuilderCountryOptionsDkType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsDkType::*; + use CreateTaxRegistrationBuilderCountryOptionsDkType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1504,10 +1537,10 @@ impl CreateTaxRegistrationCountryOptionsDkType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDkType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsDkType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsDkType::*; + use CreateTaxRegistrationBuilderCountryOptionsDkType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1517,18 +1550,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsDkType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsDkType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsDkType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsDkType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsDkType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsDkType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsDkType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1538,41 +1571,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsDkType { } /// Options for the registration in EE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsEe { +pub struct CreateTaxRegistrationBuilderCountryOptionsEe { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsEeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsEeType, } -impl CreateTaxRegistrationCountryOptionsEe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsEeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsEe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsEeType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsEeStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsEeStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsEeStandard { +impl CreateTaxRegistrationBuilderCountryOptionsEeStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1580,10 +1614,10 @@ impl CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1591,18 +1625,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsEeStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1612,15 +1646,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsEeStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsEeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsEeType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsEeType { +impl CreateTaxRegistrationBuilderCountryOptionsEeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsEeType::*; + use CreateTaxRegistrationBuilderCountryOptionsEeType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1630,10 +1664,10 @@ impl CreateTaxRegistrationCountryOptionsEeType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsEeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsEeType::*; + use CreateTaxRegistrationBuilderCountryOptionsEeType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1643,18 +1677,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEeType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsEeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsEeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsEeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsEeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsEeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsEeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1664,41 +1698,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsEeType { } /// Options for the registration in ES. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsEs { +pub struct CreateTaxRegistrationBuilderCountryOptionsEs { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsEsType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsEsType, } -impl CreateTaxRegistrationCountryOptionsEs { - pub fn new(type_: CreateTaxRegistrationCountryOptionsEsType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsEs { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsEsType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsEsStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsEsStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsEsStandard { +impl CreateTaxRegistrationBuilderCountryOptionsEsStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1706,10 +1741,10 @@ impl CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1717,18 +1752,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsEsStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1738,15 +1773,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsEsStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsEsType { +pub enum CreateTaxRegistrationBuilderCountryOptionsEsType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsEsType { +impl CreateTaxRegistrationBuilderCountryOptionsEsType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsEsType::*; + use CreateTaxRegistrationBuilderCountryOptionsEsType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1756,10 +1791,10 @@ impl CreateTaxRegistrationCountryOptionsEsType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEsType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsEsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsEsType::*; + use CreateTaxRegistrationBuilderCountryOptionsEsType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1769,18 +1804,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsEsType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsEsType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsEsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsEsType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsEsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsEsType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsEsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1790,41 +1825,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsEsType { } /// Options for the registration in FI. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsFi { +pub struct CreateTaxRegistrationBuilderCountryOptionsFi { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsFiType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsFiType, } -impl CreateTaxRegistrationCountryOptionsFi { - pub fn new(type_: CreateTaxRegistrationCountryOptionsFiType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsFi { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsFiType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsFiStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsFiStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsFiStandard { +impl CreateTaxRegistrationBuilderCountryOptionsFiStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1832,10 +1868,10 @@ impl CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1843,18 +1879,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsFiStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1864,15 +1900,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsFiStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsFiType { +pub enum CreateTaxRegistrationBuilderCountryOptionsFiType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsFiType { +impl CreateTaxRegistrationBuilderCountryOptionsFiType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsFiType::*; + use CreateTaxRegistrationBuilderCountryOptionsFiType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -1882,10 +1918,10 @@ impl CreateTaxRegistrationCountryOptionsFiType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFiType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsFiType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsFiType::*; + use CreateTaxRegistrationBuilderCountryOptionsFiType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -1895,18 +1931,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFiType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsFiType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsFiType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsFiType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsFiType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsFiType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsFiType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1916,41 +1952,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsFiType { } /// Options for the registration in FR. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsFr { +pub struct CreateTaxRegistrationBuilderCountryOptionsFr { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsFrType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsFrType, } -impl CreateTaxRegistrationCountryOptionsFr { - pub fn new(type_: CreateTaxRegistrationCountryOptionsFrType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsFr { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsFrType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsFrStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsFrStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsFrStandard { +impl CreateTaxRegistrationBuilderCountryOptionsFrStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -1958,10 +1995,10 @@ impl CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -1969,18 +2006,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsFrStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1990,15 +2027,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsFrStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsFrType { +pub enum CreateTaxRegistrationBuilderCountryOptionsFrType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsFrType { +impl CreateTaxRegistrationBuilderCountryOptionsFrType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsFrType::*; + use CreateTaxRegistrationBuilderCountryOptionsFrType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2008,10 +2045,10 @@ impl CreateTaxRegistrationCountryOptionsFrType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFrType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsFrType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsFrType::*; + use CreateTaxRegistrationBuilderCountryOptionsFrType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2021,18 +2058,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsFrType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsFrType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsFrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsFrType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsFrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsFrType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsFrType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2042,52 +2079,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsFrType { } /// Options for the registration in GB. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsGb { +pub struct CreateTaxRegistrationBuilderCountryOptionsGb { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsGbType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsGbType, } -impl CreateTaxRegistrationCountryOptionsGb { - pub fn new(type_: CreateTaxRegistrationCountryOptionsGbType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsGb { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsGbType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsGbType { +pub enum CreateTaxRegistrationBuilderCountryOptionsGbType { Standard, } -impl CreateTaxRegistrationCountryOptionsGbType { +impl CreateTaxRegistrationBuilderCountryOptionsGbType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsGbType::*; + use CreateTaxRegistrationBuilderCountryOptionsGbType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsGbType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsGbType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsGbType::*; + use CreateTaxRegistrationBuilderCountryOptionsGbType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsGbType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsGbType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsGbType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsGbType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsGbType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsGbType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2097,41 +2134,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsGbType { } /// Options for the registration in GR. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsGr { +pub struct CreateTaxRegistrationBuilderCountryOptionsGr { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsGrType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsGrType, } -impl CreateTaxRegistrationCountryOptionsGr { - pub fn new(type_: CreateTaxRegistrationCountryOptionsGrType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsGr { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsGrType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsGrStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsGrStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsGrStandard { +impl CreateTaxRegistrationBuilderCountryOptionsGrStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2139,10 +2177,10 @@ impl CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -2150,18 +2188,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsGrStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2171,15 +2209,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsGrStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsGrType { +pub enum CreateTaxRegistrationBuilderCountryOptionsGrType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsGrType { +impl CreateTaxRegistrationBuilderCountryOptionsGrType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsGrType::*; + use CreateTaxRegistrationBuilderCountryOptionsGrType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2189,10 +2227,10 @@ impl CreateTaxRegistrationCountryOptionsGrType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsGrType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsGrType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsGrType::*; + use CreateTaxRegistrationBuilderCountryOptionsGrType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2202,18 +2240,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsGrType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsGrType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsGrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsGrType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsGrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsGrType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsGrType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2223,41 +2261,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsGrType { } /// Options for the registration in HR. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsHr { +pub struct CreateTaxRegistrationBuilderCountryOptionsHr { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsHrType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsHrType, } -impl CreateTaxRegistrationCountryOptionsHr { - pub fn new(type_: CreateTaxRegistrationCountryOptionsHrType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsHr { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsHrType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsHrStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsHrStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsHrStandard { +impl CreateTaxRegistrationBuilderCountryOptionsHrStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2265,10 +2304,10 @@ impl CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -2276,18 +2315,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsHrStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2297,15 +2336,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsHrStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsHrType { +pub enum CreateTaxRegistrationBuilderCountryOptionsHrType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsHrType { +impl CreateTaxRegistrationBuilderCountryOptionsHrType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsHrType::*; + use CreateTaxRegistrationBuilderCountryOptionsHrType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2315,10 +2354,10 @@ impl CreateTaxRegistrationCountryOptionsHrType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHrType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsHrType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsHrType::*; + use CreateTaxRegistrationBuilderCountryOptionsHrType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2328,18 +2367,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHrType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsHrType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsHrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsHrType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsHrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsHrType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsHrType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2349,41 +2388,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsHrType { } /// Options for the registration in HU. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsHu { +pub struct CreateTaxRegistrationBuilderCountryOptionsHu { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsHuType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsHuType, } -impl CreateTaxRegistrationCountryOptionsHu { - pub fn new(type_: CreateTaxRegistrationCountryOptionsHuType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsHu { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsHuType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsHuStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsHuStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsHuStandard { +impl CreateTaxRegistrationBuilderCountryOptionsHuStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2391,10 +2431,10 @@ impl CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -2402,18 +2442,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsHuStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2423,15 +2463,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsHuStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsHuType { +pub enum CreateTaxRegistrationBuilderCountryOptionsHuType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsHuType { +impl CreateTaxRegistrationBuilderCountryOptionsHuType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsHuType::*; + use CreateTaxRegistrationBuilderCountryOptionsHuType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2441,10 +2481,10 @@ impl CreateTaxRegistrationCountryOptionsHuType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHuType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsHuType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsHuType::*; + use CreateTaxRegistrationBuilderCountryOptionsHuType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2454,18 +2494,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsHuType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsHuType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsHuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsHuType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsHuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsHuType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsHuType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2475,52 +2515,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsHuType { } /// Options for the registration in ID. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsId { +pub struct CreateTaxRegistrationBuilderCountryOptionsId { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsIdType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsIdType, } -impl CreateTaxRegistrationCountryOptionsId { - pub fn new(type_: CreateTaxRegistrationCountryOptionsIdType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsId { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsIdType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsIdType { +pub enum CreateTaxRegistrationBuilderCountryOptionsIdType { Simplified, } -impl CreateTaxRegistrationCountryOptionsIdType { +impl CreateTaxRegistrationBuilderCountryOptionsIdType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsIdType::*; + use CreateTaxRegistrationBuilderCountryOptionsIdType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIdType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsIdType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsIdType::*; + use CreateTaxRegistrationBuilderCountryOptionsIdType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsIdType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsIdType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsIdType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsIdType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsIdType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsIdType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2530,41 +2570,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsIdType { } /// Options for the registration in IE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsIe { +pub struct CreateTaxRegistrationBuilderCountryOptionsIe { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsIeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsIeType, } -impl CreateTaxRegistrationCountryOptionsIe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsIeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsIe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsIeType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsIeStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsIeStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsIeStandard { +impl CreateTaxRegistrationBuilderCountryOptionsIeStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2572,10 +2613,10 @@ impl CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -2583,18 +2624,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsIeStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2604,15 +2645,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsIeStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsIeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsIeType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsIeType { +impl CreateTaxRegistrationBuilderCountryOptionsIeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsIeType::*; + use CreateTaxRegistrationBuilderCountryOptionsIeType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2622,10 +2663,10 @@ impl CreateTaxRegistrationCountryOptionsIeType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsIeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsIeType::*; + use CreateTaxRegistrationBuilderCountryOptionsIeType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2635,18 +2676,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIeType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsIeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsIeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsIeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsIeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsIeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsIeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2656,52 +2697,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsIeType { } /// Options for the registration in IS. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsIs { +pub struct CreateTaxRegistrationBuilderCountryOptionsIs { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsIsType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsIsType, } -impl CreateTaxRegistrationCountryOptionsIs { - pub fn new(type_: CreateTaxRegistrationCountryOptionsIsType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsIs { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsIsType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsIsType { +pub enum CreateTaxRegistrationBuilderCountryOptionsIsType { Standard, } -impl CreateTaxRegistrationCountryOptionsIsType { +impl CreateTaxRegistrationBuilderCountryOptionsIsType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsIsType::*; + use CreateTaxRegistrationBuilderCountryOptionsIsType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsIsType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsIsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsIsType::*; + use CreateTaxRegistrationBuilderCountryOptionsIsType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsIsType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsIsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsIsType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsIsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsIsType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsIsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2711,41 +2752,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsIsType { } /// Options for the registration in IT. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsIt { +pub struct CreateTaxRegistrationBuilderCountryOptionsIt { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsItType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsItType, } -impl CreateTaxRegistrationCountryOptionsIt { - pub fn new(type_: CreateTaxRegistrationCountryOptionsItType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsIt { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsItType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsItStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsItStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsItStandard { +impl CreateTaxRegistrationBuilderCountryOptionsItStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2753,10 +2795,10 @@ impl CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -2764,18 +2806,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsItStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsItStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsItStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2785,15 +2827,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsItStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsItType { +pub enum CreateTaxRegistrationBuilderCountryOptionsItType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsItType { +impl CreateTaxRegistrationBuilderCountryOptionsItType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsItType::*; + use CreateTaxRegistrationBuilderCountryOptionsItType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -2803,10 +2845,10 @@ impl CreateTaxRegistrationCountryOptionsItType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsItType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsItType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsItType::*; + use CreateTaxRegistrationBuilderCountryOptionsItType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -2816,18 +2858,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsItType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsItType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsItType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsItType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsItType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsItType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsItType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2837,52 +2879,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsItType { } /// Options for the registration in JP. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsJp { +pub struct CreateTaxRegistrationBuilderCountryOptionsJp { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsJpType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsJpType, } -impl CreateTaxRegistrationCountryOptionsJp { - pub fn new(type_: CreateTaxRegistrationCountryOptionsJpType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsJp { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsJpType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsJpType { +pub enum CreateTaxRegistrationBuilderCountryOptionsJpType { Standard, } -impl CreateTaxRegistrationCountryOptionsJpType { +impl CreateTaxRegistrationBuilderCountryOptionsJpType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsJpType::*; + use CreateTaxRegistrationBuilderCountryOptionsJpType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsJpType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsJpType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsJpType::*; + use CreateTaxRegistrationBuilderCountryOptionsJpType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsJpType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsJpType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsJpType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsJpType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsJpType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsJpType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2892,52 +2934,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsJpType { } /// Options for the registration in KR. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsKr { +pub struct CreateTaxRegistrationBuilderCountryOptionsKr { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsKrType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsKrType, } -impl CreateTaxRegistrationCountryOptionsKr { - pub fn new(type_: CreateTaxRegistrationCountryOptionsKrType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsKr { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsKrType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsKrType { +pub enum CreateTaxRegistrationBuilderCountryOptionsKrType { Simplified, } -impl CreateTaxRegistrationCountryOptionsKrType { +impl CreateTaxRegistrationBuilderCountryOptionsKrType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsKrType::*; + use CreateTaxRegistrationBuilderCountryOptionsKrType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsKrType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsKrType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsKrType::*; + use CreateTaxRegistrationBuilderCountryOptionsKrType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsKrType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsKrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsKrType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsKrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsKrType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsKrType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2947,41 +2989,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsKrType { } /// Options for the registration in LT. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLt { +pub struct CreateTaxRegistrationBuilderCountryOptionsLt { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsLtType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsLtType, } -impl CreateTaxRegistrationCountryOptionsLt { - pub fn new(type_: CreateTaxRegistrationCountryOptionsLtType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsLt { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsLtType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLtStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsLtStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsLtStandard { +impl CreateTaxRegistrationBuilderCountryOptionsLtStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -2989,10 +3032,10 @@ impl CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3000,18 +3043,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLtStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3021,15 +3064,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLtStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLtType { +pub enum CreateTaxRegistrationBuilderCountryOptionsLtType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsLtType { +impl CreateTaxRegistrationBuilderCountryOptionsLtType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLtType::*; + use CreateTaxRegistrationBuilderCountryOptionsLtType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3039,10 +3082,10 @@ impl CreateTaxRegistrationCountryOptionsLtType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLtType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLtType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLtType::*; + use CreateTaxRegistrationBuilderCountryOptionsLtType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3052,18 +3095,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLtType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLtType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLtType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLtType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLtType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3073,41 +3116,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLtType { } /// Options for the registration in LU. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLu { +pub struct CreateTaxRegistrationBuilderCountryOptionsLu { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsLuType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsLuType, } -impl CreateTaxRegistrationCountryOptionsLu { - pub fn new(type_: CreateTaxRegistrationCountryOptionsLuType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsLu { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsLuType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLuStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsLuStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsLuStandard { +impl CreateTaxRegistrationBuilderCountryOptionsLuStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3115,10 +3159,10 @@ impl CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3126,18 +3170,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLuStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3147,15 +3191,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLuStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLuType { +pub enum CreateTaxRegistrationBuilderCountryOptionsLuType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsLuType { +impl CreateTaxRegistrationBuilderCountryOptionsLuType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLuType::*; + use CreateTaxRegistrationBuilderCountryOptionsLuType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3165,10 +3209,10 @@ impl CreateTaxRegistrationCountryOptionsLuType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLuType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLuType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLuType::*; + use CreateTaxRegistrationBuilderCountryOptionsLuType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3178,18 +3222,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLuType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLuType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLuType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLuType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLuType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLuType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3199,41 +3243,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLuType { } /// Options for the registration in LV. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLv { +pub struct CreateTaxRegistrationBuilderCountryOptionsLv { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsLvType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsLvType, } -impl CreateTaxRegistrationCountryOptionsLv { - pub fn new(type_: CreateTaxRegistrationCountryOptionsLvType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsLv { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsLvType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsLvStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsLvStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsLvStandard { +impl CreateTaxRegistrationBuilderCountryOptionsLvStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3241,10 +3286,10 @@ impl CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3252,18 +3297,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLvStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3273,15 +3318,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLvStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsLvType { +pub enum CreateTaxRegistrationBuilderCountryOptionsLvType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsLvType { +impl CreateTaxRegistrationBuilderCountryOptionsLvType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsLvType::*; + use CreateTaxRegistrationBuilderCountryOptionsLvType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3291,10 +3336,10 @@ impl CreateTaxRegistrationCountryOptionsLvType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLvType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsLvType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsLvType::*; + use CreateTaxRegistrationBuilderCountryOptionsLvType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3304,18 +3349,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsLvType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsLvType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsLvType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsLvType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsLvType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsLvType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsLvType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3325,41 +3370,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsLvType { } /// Options for the registration in MT. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsMt { +pub struct CreateTaxRegistrationBuilderCountryOptionsMt { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsMtType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsMtType, } -impl CreateTaxRegistrationCountryOptionsMt { - pub fn new(type_: CreateTaxRegistrationCountryOptionsMtType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsMt { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsMtType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsMtStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsMtStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsMtStandard { +impl CreateTaxRegistrationBuilderCountryOptionsMtStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3367,10 +3413,10 @@ impl CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3378,18 +3424,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsMtStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3399,15 +3445,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsMtStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsMtType { +pub enum CreateTaxRegistrationBuilderCountryOptionsMtType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsMtType { +impl CreateTaxRegistrationBuilderCountryOptionsMtType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsMtType::*; + use CreateTaxRegistrationBuilderCountryOptionsMtType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3417,10 +3463,10 @@ impl CreateTaxRegistrationCountryOptionsMtType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMtType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsMtType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsMtType::*; + use CreateTaxRegistrationBuilderCountryOptionsMtType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3430,18 +3476,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMtType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsMtType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsMtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsMtType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsMtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsMtType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsMtType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3451,52 +3497,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsMtType { } /// Options for the registration in MX. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsMx { +pub struct CreateTaxRegistrationBuilderCountryOptionsMx { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsMxType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsMxType, } -impl CreateTaxRegistrationCountryOptionsMx { - pub fn new(type_: CreateTaxRegistrationCountryOptionsMxType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsMx { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsMxType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsMxType { +pub enum CreateTaxRegistrationBuilderCountryOptionsMxType { Simplified, } -impl CreateTaxRegistrationCountryOptionsMxType { +impl CreateTaxRegistrationBuilderCountryOptionsMxType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsMxType::*; + use CreateTaxRegistrationBuilderCountryOptionsMxType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMxType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsMxType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsMxType::*; + use CreateTaxRegistrationBuilderCountryOptionsMxType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsMxType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsMxType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsMxType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsMxType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsMxType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsMxType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3506,52 +3552,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsMxType { } /// Options for the registration in MY. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsMy { +pub struct CreateTaxRegistrationBuilderCountryOptionsMy { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsMyType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsMyType, } -impl CreateTaxRegistrationCountryOptionsMy { - pub fn new(type_: CreateTaxRegistrationCountryOptionsMyType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsMy { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsMyType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsMyType { +pub enum CreateTaxRegistrationBuilderCountryOptionsMyType { Simplified, } -impl CreateTaxRegistrationCountryOptionsMyType { +impl CreateTaxRegistrationBuilderCountryOptionsMyType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsMyType::*; + use CreateTaxRegistrationBuilderCountryOptionsMyType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsMyType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsMyType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsMyType::*; + use CreateTaxRegistrationBuilderCountryOptionsMyType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsMyType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsMyType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsMyType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsMyType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsMyType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsMyType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3561,41 +3607,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsMyType { } /// Options for the registration in NL. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsNl { +pub struct CreateTaxRegistrationBuilderCountryOptionsNl { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsNlType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsNlType, } -impl CreateTaxRegistrationCountryOptionsNl { - pub fn new(type_: CreateTaxRegistrationCountryOptionsNlType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsNl { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsNlType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsNlStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsNlStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsNlStandard { +impl CreateTaxRegistrationBuilderCountryOptionsNlStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3603,10 +3650,10 @@ impl CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3614,18 +3661,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsNlStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3635,15 +3682,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsNlStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsNlType { +pub enum CreateTaxRegistrationBuilderCountryOptionsNlType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsNlType { +impl CreateTaxRegistrationBuilderCountryOptionsNlType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsNlType::*; + use CreateTaxRegistrationBuilderCountryOptionsNlType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3653,10 +3700,10 @@ impl CreateTaxRegistrationCountryOptionsNlType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNlType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsNlType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsNlType::*; + use CreateTaxRegistrationBuilderCountryOptionsNlType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3666,18 +3713,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNlType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsNlType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsNlType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsNlType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsNlType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsNlType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsNlType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3687,52 +3734,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsNlType { } /// Options for the registration in NO. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsNo { +pub struct CreateTaxRegistrationBuilderCountryOptionsNo { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsNoType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsNoType, } -impl CreateTaxRegistrationCountryOptionsNo { - pub fn new(type_: CreateTaxRegistrationCountryOptionsNoType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsNo { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsNoType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsNoType { +pub enum CreateTaxRegistrationBuilderCountryOptionsNoType { Standard, } -impl CreateTaxRegistrationCountryOptionsNoType { +impl CreateTaxRegistrationBuilderCountryOptionsNoType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsNoType::*; + use CreateTaxRegistrationBuilderCountryOptionsNoType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNoType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsNoType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsNoType::*; + use CreateTaxRegistrationBuilderCountryOptionsNoType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsNoType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsNoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsNoType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsNoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsNoType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsNoType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3742,52 +3789,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsNoType { } /// Options for the registration in NZ. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsNz { +pub struct CreateTaxRegistrationBuilderCountryOptionsNz { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsNzType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsNzType, } -impl CreateTaxRegistrationCountryOptionsNz { - pub fn new(type_: CreateTaxRegistrationCountryOptionsNzType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsNz { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsNzType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsNzType { +pub enum CreateTaxRegistrationBuilderCountryOptionsNzType { Standard, } -impl CreateTaxRegistrationCountryOptionsNzType { +impl CreateTaxRegistrationBuilderCountryOptionsNzType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsNzType::*; + use CreateTaxRegistrationBuilderCountryOptionsNzType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsNzType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsNzType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsNzType::*; + use CreateTaxRegistrationBuilderCountryOptionsNzType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsNzType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsNzType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsNzType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsNzType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsNzType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsNzType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3797,41 +3844,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsNzType { } /// Options for the registration in PL. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsPl { +pub struct CreateTaxRegistrationBuilderCountryOptionsPl { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsPlType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsPlType, } -impl CreateTaxRegistrationCountryOptionsPl { - pub fn new(type_: CreateTaxRegistrationCountryOptionsPlType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsPl { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsPlType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsPlStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsPlStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsPlStandard { +impl CreateTaxRegistrationBuilderCountryOptionsPlStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3839,10 +3887,10 @@ impl CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3850,18 +3898,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsPlStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3871,15 +3919,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsPlStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsPlType { +pub enum CreateTaxRegistrationBuilderCountryOptionsPlType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsPlType { +impl CreateTaxRegistrationBuilderCountryOptionsPlType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsPlType::*; + use CreateTaxRegistrationBuilderCountryOptionsPlType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -3889,10 +3937,10 @@ impl CreateTaxRegistrationCountryOptionsPlType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPlType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsPlType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsPlType::*; + use CreateTaxRegistrationBuilderCountryOptionsPlType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -3902,18 +3950,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPlType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsPlType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsPlType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsPlType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsPlType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsPlType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsPlType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3923,41 +3971,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsPlType { } /// Options for the registration in PT. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsPt { +pub struct CreateTaxRegistrationBuilderCountryOptionsPt { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsPtType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsPtType, } -impl CreateTaxRegistrationCountryOptionsPt { - pub fn new(type_: CreateTaxRegistrationCountryOptionsPtType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsPt { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsPtType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsPtStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsPtStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsPtStandard { +impl CreateTaxRegistrationBuilderCountryOptionsPtStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -3965,10 +4014,10 @@ impl CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -3976,18 +4025,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsPtStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3997,15 +4046,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsPtStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsPtType { +pub enum CreateTaxRegistrationBuilderCountryOptionsPtType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsPtType { +impl CreateTaxRegistrationBuilderCountryOptionsPtType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsPtType::*; + use CreateTaxRegistrationBuilderCountryOptionsPtType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -4015,10 +4064,10 @@ impl CreateTaxRegistrationCountryOptionsPtType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPtType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsPtType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsPtType::*; + use CreateTaxRegistrationBuilderCountryOptionsPtType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -4028,18 +4077,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsPtType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsPtType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsPtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsPtType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsPtType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsPtType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsPtType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4049,41 +4098,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsPtType { } /// Options for the registration in RO. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsRo { +pub struct CreateTaxRegistrationBuilderCountryOptionsRo { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsRoType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsRoType, } -impl CreateTaxRegistrationCountryOptionsRo { - pub fn new(type_: CreateTaxRegistrationCountryOptionsRoType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsRo { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsRoType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsRoStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsRoStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsRoStandard { +impl CreateTaxRegistrationBuilderCountryOptionsRoStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -4091,10 +4141,10 @@ impl CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -4102,18 +4152,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsRoStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4123,15 +4173,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsRoStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsRoType { +pub enum CreateTaxRegistrationBuilderCountryOptionsRoType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsRoType { +impl CreateTaxRegistrationBuilderCountryOptionsRoType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsRoType::*; + use CreateTaxRegistrationBuilderCountryOptionsRoType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -4141,10 +4191,10 @@ impl CreateTaxRegistrationCountryOptionsRoType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsRoType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsRoType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsRoType::*; + use CreateTaxRegistrationBuilderCountryOptionsRoType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -4154,18 +4204,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsRoType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsRoType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsRoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsRoType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsRoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsRoType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsRoType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4175,52 +4225,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsRoType { } /// Options for the registration in SA. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSa { +pub struct CreateTaxRegistrationBuilderCountryOptionsSa { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsSaType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsSaType, } -impl CreateTaxRegistrationCountryOptionsSa { - pub fn new(type_: CreateTaxRegistrationCountryOptionsSaType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsSa { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsSaType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSaType { +pub enum CreateTaxRegistrationBuilderCountryOptionsSaType { Simplified, } -impl CreateTaxRegistrationCountryOptionsSaType { +impl CreateTaxRegistrationBuilderCountryOptionsSaType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSaType::*; + use CreateTaxRegistrationBuilderCountryOptionsSaType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSaType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSaType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSaType::*; + use CreateTaxRegistrationBuilderCountryOptionsSaType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSaType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSaType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSaType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSaType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4230,41 +4280,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSaType { } /// Options for the registration in SE. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSe { +pub struct CreateTaxRegistrationBuilderCountryOptionsSe { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsSeType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsSeType, } -impl CreateTaxRegistrationCountryOptionsSe { - pub fn new(type_: CreateTaxRegistrationCountryOptionsSeType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsSe { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsSeType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSeStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsSeStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsSeStandard { +impl CreateTaxRegistrationBuilderCountryOptionsSeStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -4272,10 +4323,10 @@ impl CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -4283,18 +4334,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSeStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4304,15 +4355,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSeStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSeType { +pub enum CreateTaxRegistrationBuilderCountryOptionsSeType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsSeType { +impl CreateTaxRegistrationBuilderCountryOptionsSeType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSeType::*; + use CreateTaxRegistrationBuilderCountryOptionsSeType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -4322,10 +4373,10 @@ impl CreateTaxRegistrationCountryOptionsSeType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSeType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSeType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSeType::*; + use CreateTaxRegistrationBuilderCountryOptionsSeType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -4335,18 +4386,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSeType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSeType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSeType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSeType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSeType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSeType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4356,52 +4407,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSeType { } /// Options for the registration in SG. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSg { +pub struct CreateTaxRegistrationBuilderCountryOptionsSg { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsSgType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsSgType, } -impl CreateTaxRegistrationCountryOptionsSg { - pub fn new(type_: CreateTaxRegistrationCountryOptionsSgType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsSg { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsSgType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSgType { +pub enum CreateTaxRegistrationBuilderCountryOptionsSgType { Standard, } -impl CreateTaxRegistrationCountryOptionsSgType { +impl CreateTaxRegistrationBuilderCountryOptionsSgType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSgType::*; + use CreateTaxRegistrationBuilderCountryOptionsSgType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSgType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSgType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSgType::*; + use CreateTaxRegistrationBuilderCountryOptionsSgType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSgType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSgType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSgType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSgType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSgType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSgType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4411,41 +4462,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSgType { } /// Options for the registration in SI. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSi { +pub struct CreateTaxRegistrationBuilderCountryOptionsSi { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsSiType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsSiType, } -impl CreateTaxRegistrationCountryOptionsSi { - pub fn new(type_: CreateTaxRegistrationCountryOptionsSiType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsSi { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsSiType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSiStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsSiStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsSiStandard { +impl CreateTaxRegistrationBuilderCountryOptionsSiStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -4453,10 +4505,10 @@ impl CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -4464,18 +4516,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSiStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4485,15 +4537,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSiStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSiType { +pub enum CreateTaxRegistrationBuilderCountryOptionsSiType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsSiType { +impl CreateTaxRegistrationBuilderCountryOptionsSiType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSiType::*; + use CreateTaxRegistrationBuilderCountryOptionsSiType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -4503,10 +4555,10 @@ impl CreateTaxRegistrationCountryOptionsSiType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSiType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSiType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSiType::*; + use CreateTaxRegistrationBuilderCountryOptionsSiType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -4516,18 +4568,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSiType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSiType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSiType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSiType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSiType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSiType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSiType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4537,41 +4589,42 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSiType { } /// Options for the registration in SK. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSk { +pub struct CreateTaxRegistrationBuilderCountryOptionsSk { /// Options for the standard registration. #[serde(skip_serializing_if = "Option::is_none")] - pub standard: Option, + pub standard: Option, /// Type of registration to be created in an EU country. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsSkType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsSkType, } -impl CreateTaxRegistrationCountryOptionsSk { - pub fn new(type_: CreateTaxRegistrationCountryOptionsSkType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsSk { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsSkType) -> Self { Self { standard: None, type_ } } } /// Options for the standard registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsSkStandard { +pub struct CreateTaxRegistrationBuilderCountryOptionsSkStandard { /// Place of supply scheme used in an EU standard registration. - pub place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme, + pub place_of_supply_scheme: + CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme, } -impl CreateTaxRegistrationCountryOptionsSkStandard { +impl CreateTaxRegistrationBuilderCountryOptionsSkStandard { pub fn new( - place_of_supply_scheme: CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme, + place_of_supply_scheme: CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme, ) -> Self { Self { place_of_supply_scheme } } } /// Place of supply scheme used in an EU standard registration. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +pub enum CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { SmallSeller, Standard, } -impl CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +impl CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme::*; match self { SmallSeller => "small_seller", Standard => "standard", @@ -4579,10 +4632,10 @@ impl CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme::*; + use CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme::*; match s { "small_seller" => Ok(SmallSeller), "standard" => Ok(Standard), @@ -4590,18 +4643,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfS } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSupplyScheme { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSkStandardPlaceOfSupplyScheme { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4611,15 +4664,15 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSkStandardPlaceOfSu } /// Type of registration to be created in an EU country. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsSkType { +pub enum CreateTaxRegistrationBuilderCountryOptionsSkType { Ioss, OssNonUnion, OssUnion, Standard, } -impl CreateTaxRegistrationCountryOptionsSkType { +impl CreateTaxRegistrationBuilderCountryOptionsSkType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsSkType::*; + use CreateTaxRegistrationBuilderCountryOptionsSkType::*; match self { Ioss => "ioss", OssNonUnion => "oss_non_union", @@ -4629,10 +4682,10 @@ impl CreateTaxRegistrationCountryOptionsSkType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSkType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsSkType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsSkType::*; + use CreateTaxRegistrationBuilderCountryOptionsSkType::*; match s { "ioss" => Ok(Ioss), "oss_non_union" => Ok(OssNonUnion), @@ -4642,18 +4695,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsSkType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsSkType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsSkType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsSkType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsSkType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsSkType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsSkType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4663,52 +4716,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsSkType { } /// Options for the registration in TH. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsTh { +pub struct CreateTaxRegistrationBuilderCountryOptionsTh { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsThType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsThType, } -impl CreateTaxRegistrationCountryOptionsTh { - pub fn new(type_: CreateTaxRegistrationCountryOptionsThType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsTh { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsThType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsThType { +pub enum CreateTaxRegistrationBuilderCountryOptionsThType { Simplified, } -impl CreateTaxRegistrationCountryOptionsThType { +impl CreateTaxRegistrationBuilderCountryOptionsThType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsThType::*; + use CreateTaxRegistrationBuilderCountryOptionsThType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsThType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsThType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsThType::*; + use CreateTaxRegistrationBuilderCountryOptionsThType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsThType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsThType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsThType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsThType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsThType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsThType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4718,52 +4771,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsThType { } /// Options for the registration in TR. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsTr { +pub struct CreateTaxRegistrationBuilderCountryOptionsTr { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsTrType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsTrType, } -impl CreateTaxRegistrationCountryOptionsTr { - pub fn new(type_: CreateTaxRegistrationCountryOptionsTrType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsTr { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsTrType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsTrType { +pub enum CreateTaxRegistrationBuilderCountryOptionsTrType { Simplified, } -impl CreateTaxRegistrationCountryOptionsTrType { +impl CreateTaxRegistrationBuilderCountryOptionsTrType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsTrType::*; + use CreateTaxRegistrationBuilderCountryOptionsTrType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsTrType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsTrType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsTrType::*; + use CreateTaxRegistrationBuilderCountryOptionsTrType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsTrType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsTrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsTrType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsTrType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsTrType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsTrType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4773,59 +4826,60 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsTrType { } /// Options for the registration in US. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsUs<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptionsUs<'a> { /// Options for the local amusement tax registration. #[serde(skip_serializing_if = "Option::is_none")] - pub local_amusement_tax: Option>, + pub local_amusement_tax: + Option>, /// Options for the local lease tax registration. #[serde(skip_serializing_if = "Option::is_none")] - pub local_lease_tax: Option>, + pub local_lease_tax: Option>, /// Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). pub state: &'a str, /// Type of registration to be created in the US. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsUsType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsUsType, } -impl<'a> CreateTaxRegistrationCountryOptionsUs<'a> { - pub fn new(state: &'a str, type_: CreateTaxRegistrationCountryOptionsUsType) -> Self { +impl<'a> CreateTaxRegistrationBuilderCountryOptionsUs<'a> { + pub fn new(state: &'a str, type_: CreateTaxRegistrationBuilderCountryOptionsUsType) -> Self { Self { local_amusement_tax: None, local_lease_tax: None, state, type_ } } } /// Options for the local amusement tax registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsUsLocalAmusementTax<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptionsUsLocalAmusementTax<'a> { /// A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. /// Supported FIPS codes are: `14000` (Chicago), `06613` (Bloomington), `21696` (East Dundee), `24582` (Evanston), and `68081` (Schiller Park). pub jurisdiction: &'a str, } -impl<'a> CreateTaxRegistrationCountryOptionsUsLocalAmusementTax<'a> { +impl<'a> CreateTaxRegistrationBuilderCountryOptionsUsLocalAmusementTax<'a> { pub fn new(jurisdiction: &'a str) -> Self { Self { jurisdiction } } } /// Options for the local lease tax registration. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsUsLocalLeaseTax<'a> { +pub struct CreateTaxRegistrationBuilderCountryOptionsUsLocalLeaseTax<'a> { /// A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. /// Supported FIPS codes are: `14000` (Chicago). pub jurisdiction: &'a str, } -impl<'a> CreateTaxRegistrationCountryOptionsUsLocalLeaseTax<'a> { +impl<'a> CreateTaxRegistrationBuilderCountryOptionsUsLocalLeaseTax<'a> { pub fn new(jurisdiction: &'a str) -> Self { Self { jurisdiction } } } /// Type of registration to be created in the US. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsUsType { +pub enum CreateTaxRegistrationBuilderCountryOptionsUsType { LocalAmusementTax, LocalLeaseTax, StateCommunicationsTax, StateSalesTax, } -impl CreateTaxRegistrationCountryOptionsUsType { +impl CreateTaxRegistrationBuilderCountryOptionsUsType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsUsType::*; + use CreateTaxRegistrationBuilderCountryOptionsUsType::*; match self { LocalAmusementTax => "local_amusement_tax", LocalLeaseTax => "local_lease_tax", @@ -4835,10 +4889,10 @@ impl CreateTaxRegistrationCountryOptionsUsType { } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsUsType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsUsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsUsType::*; + use CreateTaxRegistrationBuilderCountryOptionsUsType::*; match s { "local_amusement_tax" => Ok(LocalAmusementTax), "local_lease_tax" => Ok(LocalLeaseTax), @@ -4848,18 +4902,18 @@ impl std::str::FromStr for CreateTaxRegistrationCountryOptionsUsType { } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsUsType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsUsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsUsType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsUsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsUsType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsUsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4869,52 +4923,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsUsType { } /// Options for the registration in VN. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsVn { +pub struct CreateTaxRegistrationBuilderCountryOptionsVn { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsVnType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsVnType, } -impl CreateTaxRegistrationCountryOptionsVn { - pub fn new(type_: CreateTaxRegistrationCountryOptionsVnType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsVn { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsVnType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsVnType { +pub enum CreateTaxRegistrationBuilderCountryOptionsVnType { Simplified, } -impl CreateTaxRegistrationCountryOptionsVnType { +impl CreateTaxRegistrationBuilderCountryOptionsVnType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsVnType::*; + use CreateTaxRegistrationBuilderCountryOptionsVnType::*; match self { Simplified => "simplified", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsVnType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsVnType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsVnType::*; + use CreateTaxRegistrationBuilderCountryOptionsVnType::*; match s { "simplified" => Ok(Simplified), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsVnType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsVnType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsVnType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsVnType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsVnType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsVnType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4924,52 +4978,52 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsVnType { } /// Options for the registration in ZA. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRegistrationCountryOptionsZa { +pub struct CreateTaxRegistrationBuilderCountryOptionsZa { /// Type of registration to be created in `country`. #[serde(rename = "type")] - pub type_: CreateTaxRegistrationCountryOptionsZaType, + pub type_: CreateTaxRegistrationBuilderCountryOptionsZaType, } -impl CreateTaxRegistrationCountryOptionsZa { - pub fn new(type_: CreateTaxRegistrationCountryOptionsZaType) -> Self { +impl CreateTaxRegistrationBuilderCountryOptionsZa { + pub fn new(type_: CreateTaxRegistrationBuilderCountryOptionsZaType) -> Self { Self { type_ } } } /// Type of registration to be created in `country`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTaxRegistrationCountryOptionsZaType { +pub enum CreateTaxRegistrationBuilderCountryOptionsZaType { Standard, } -impl CreateTaxRegistrationCountryOptionsZaType { +impl CreateTaxRegistrationBuilderCountryOptionsZaType { pub fn as_str(self) -> &'static str { - use CreateTaxRegistrationCountryOptionsZaType::*; + use CreateTaxRegistrationBuilderCountryOptionsZaType::*; match self { Standard => "standard", } } } -impl std::str::FromStr for CreateTaxRegistrationCountryOptionsZaType { +impl std::str::FromStr for CreateTaxRegistrationBuilderCountryOptionsZaType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTaxRegistrationCountryOptionsZaType::*; + use CreateTaxRegistrationBuilderCountryOptionsZaType::*; match s { "standard" => Ok(Standard), _ => Err(()), } } } -impl std::fmt::Display for CreateTaxRegistrationCountryOptionsZaType { +impl std::fmt::Display for CreateTaxRegistrationBuilderCountryOptionsZaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTaxRegistrationCountryOptionsZaType { +impl std::fmt::Debug for CreateTaxRegistrationBuilderCountryOptionsZaType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTaxRegistrationCountryOptionsZaType { +impl serde::Serialize for CreateTaxRegistrationBuilderCountryOptionsZaType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4977,18 +5031,58 @@ impl serde::Serialize for CreateTaxRegistrationCountryOptionsZaType { serializer.serialize_str(self.as_str()) } } +/// Creates a new Tax `Registration` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTaxRegistration<'a> { + inner: CreateTaxRegistrationBuilder<'a>, +} impl<'a> CreateTaxRegistration<'a> { - /// Creates a new Tax `Registration` object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax/registrations", self, http_types::Method::Post) + pub fn new( + active_from: CreateTaxRegistrationBuilderActiveFrom, + country: &'a str, + country_options: CreateTaxRegistrationBuilderCountryOptions<'a>, + ) -> Self { + Self { inner: CreateTaxRegistrationBuilder::new(active_from, country, country_options) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } +} +impl CreateTaxRegistration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTaxRegistration<'_> { + type Output = stripe_misc::TaxRegistration; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax/registrations").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTaxRegistration<'a> { +pub struct UpdateTaxRegistrationBuilder<'a> { /// Time at which the registration becomes active. /// It can be either `now` to indicate the current time, or a timestamp measured in seconds since the Unix epoch. #[serde(skip_serializing_if = "Option::is_none")] - pub active_from: Option, + pub active_from: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -4996,9 +5090,9 @@ pub struct UpdateTaxRegistration<'a> { /// If not set, the registration will be active indefinitely. /// It can be either `now` to indicate the current time, or a timestamp measured in seconds since the Unix epoch. #[serde(skip_serializing_if = "Option::is_none")] - pub expires_at: Option, + pub expires_at: Option, } -impl<'a> UpdateTaxRegistration<'a> { +impl<'a> UpdateTaxRegistrationBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -5007,7 +5101,7 @@ impl<'a> UpdateTaxRegistration<'a> { /// It can be either `now` to indicate the current time, or a timestamp measured in seconds since the Unix epoch. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateTaxRegistrationActiveFrom { +pub enum UpdateTaxRegistrationBuilderActiveFrom { Now, Timestamp(stripe_types::Timestamp), } @@ -5016,20 +5110,60 @@ pub enum UpdateTaxRegistrationActiveFrom { /// It can be either `now` to indicate the current time, or a timestamp measured in seconds since the Unix epoch. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdateTaxRegistrationExpiresAt { +pub enum UpdateTaxRegistrationBuilderExpiresAt { Now, Timestamp(stripe_types::Timestamp), } +/// Updates an existing Tax `Registration` object. +/// +/// A registration cannot be deleted after it has been created. +/// If you wish to end a registration you may do so by setting `expires_at`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTaxRegistration<'a> { + inner: UpdateTaxRegistrationBuilder<'a>, + id: &'a stripe_misc::TaxRegistrationId, +} impl<'a> UpdateTaxRegistration<'a> { - /// Updates an existing Tax `Registration` object. - /// - /// A registration cannot be deleted after it has been created. - /// If you wish to end a registration you may do so by setting `expires_at`. - pub fn send( + pub fn new(id: &'a stripe_misc::TaxRegistrationId) -> Self { + Self { id, inner: UpdateTaxRegistrationBuilder::new() } + } + pub fn active_from(mut self, active_from: UpdateTaxRegistrationBuilderActiveFrom) -> Self { + self.inner.active_from = Some(active_from); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: UpdateTaxRegistrationBuilderExpiresAt) -> Self { + self.inner.expires_at = Some(expires_at); + self + } +} +impl UpdateTaxRegistration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_misc::TaxRegistrationId, - ) -> stripe::Response { - client.send_form(&format!("/tax/registrations/{id}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTaxRegistration<'_> { + type Output = stripe_misc::TaxRegistration; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/tax/registrations/{id}")) + .form(&self.inner) } } diff --git a/generated/stripe_misc/src/tax_settings/requests.rs b/generated/stripe_misc/src/tax_settings/requests.rs index a92c564ba..3bafdfccf 100644 --- a/generated/stripe_misc/src/tax_settings/requests.rs +++ b/generated/stripe_misc/src/tax_settings/requests.rs @@ -1,50 +1,85 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveForMyAccountTaxSettings<'a> { +pub struct RetrieveForMyAccountTaxSettingsBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveForMyAccountTaxSettings<'a> { +impl<'a> RetrieveForMyAccountTaxSettingsBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves Tax `Settings` for a merchant. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveForMyAccountTaxSettings<'a> { + inner: RetrieveForMyAccountTaxSettingsBuilder<'a>, +} impl<'a> RetrieveForMyAccountTaxSettings<'a> { - /// Retrieves Tax `Settings` for a merchant. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.get_query("/tax/settings", self) + pub fn new() -> Self { + Self { inner: RetrieveForMyAccountTaxSettingsBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveForMyAccountTaxSettings<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveForMyAccountTaxSettings<'_> { + type Output = stripe_misc::TaxSettings; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/tax/settings").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTaxSettings<'a> { +pub struct UpdateTaxSettingsBuilder<'a> { /// Default configuration to be used on Stripe Tax calculations. #[serde(skip_serializing_if = "Option::is_none")] - pub defaults: Option>, + pub defaults: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// The place where your business is located. #[serde(skip_serializing_if = "Option::is_none")] - pub head_office: Option>, + pub head_office: Option>, } -impl<'a> UpdateTaxSettings<'a> { +impl<'a> UpdateTaxSettingsBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Default configuration to be used on Stripe Tax calculations. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTaxSettingsDefaults<'a> { +pub struct UpdateTaxSettingsBuilderDefaults<'a> { /// Specifies the default [tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#tax-behavior) to be used when the item's price has unspecified tax behavior. /// One of inclusive, exclusive, or inferred_by_currency. /// Once specified, it cannot be changed back to null. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. #[serde(skip_serializing_if = "Option::is_none")] pub tax_code: Option<&'a str>, } -impl<'a> UpdateTaxSettingsDefaults<'a> { +impl<'a> UpdateTaxSettingsBuilderDefaults<'a> { pub fn new() -> Self { Self::default() } @@ -53,14 +88,14 @@ impl<'a> UpdateTaxSettingsDefaults<'a> { /// One of inclusive, exclusive, or inferred_by_currency. /// Once specified, it cannot be changed back to null. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateTaxSettingsDefaultsTaxBehavior { +pub enum UpdateTaxSettingsBuilderDefaultsTaxBehavior { Exclusive, Inclusive, InferredByCurrency, } -impl UpdateTaxSettingsDefaultsTaxBehavior { +impl UpdateTaxSettingsBuilderDefaultsTaxBehavior { pub fn as_str(self) -> &'static str { - use UpdateTaxSettingsDefaultsTaxBehavior::*; + use UpdateTaxSettingsBuilderDefaultsTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -69,10 +104,10 @@ impl UpdateTaxSettingsDefaultsTaxBehavior { } } -impl std::str::FromStr for UpdateTaxSettingsDefaultsTaxBehavior { +impl std::str::FromStr for UpdateTaxSettingsBuilderDefaultsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use UpdateTaxSettingsDefaultsTaxBehavior::*; + use UpdateTaxSettingsBuilderDefaultsTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -81,18 +116,18 @@ impl std::str::FromStr for UpdateTaxSettingsDefaultsTaxBehavior { } } } -impl std::fmt::Display for UpdateTaxSettingsDefaultsTaxBehavior { +impl std::fmt::Display for UpdateTaxSettingsBuilderDefaultsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateTaxSettingsDefaultsTaxBehavior { +impl std::fmt::Debug for UpdateTaxSettingsBuilderDefaultsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateTaxSettingsDefaultsTaxBehavior { +impl serde::Serialize for UpdateTaxSettingsBuilderDefaultsTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -102,18 +137,18 @@ impl serde::Serialize for UpdateTaxSettingsDefaultsTaxBehavior { } /// The place where your business is located. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTaxSettingsHeadOffice<'a> { +pub struct UpdateTaxSettingsBuilderHeadOffice<'a> { /// The location of the business for tax purposes. - pub address: UpdateTaxSettingsHeadOfficeAddress<'a>, + pub address: UpdateTaxSettingsBuilderHeadOfficeAddress<'a>, } -impl<'a> UpdateTaxSettingsHeadOffice<'a> { - pub fn new(address: UpdateTaxSettingsHeadOfficeAddress<'a>) -> Self { +impl<'a> UpdateTaxSettingsBuilderHeadOffice<'a> { + pub fn new(address: UpdateTaxSettingsBuilderHeadOfficeAddress<'a>) -> Self { Self { address } } } /// The location of the business for tax purposes. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTaxSettingsHeadOfficeAddress<'a> { +pub struct UpdateTaxSettingsBuilderHeadOfficeAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -134,15 +169,56 @@ pub struct UpdateTaxSettingsHeadOfficeAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> UpdateTaxSettingsHeadOfficeAddress<'a> { +impl<'a> UpdateTaxSettingsBuilderHeadOfficeAddress<'a> { pub fn new() -> Self { Self::default() } } +/// Updates Tax `Settings` parameters used in tax calculations. +/// All parameters are editable but none can be removed once set. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTaxSettings<'a> { + inner: UpdateTaxSettingsBuilder<'a>, +} impl<'a> UpdateTaxSettings<'a> { - /// Updates Tax `Settings` parameters used in tax calculations. - /// All parameters are editable but none can be removed once set. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax/settings", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: UpdateTaxSettingsBuilder::new() } + } + pub fn defaults(mut self, defaults: UpdateTaxSettingsBuilderDefaults<'a>) -> Self { + self.inner.defaults = Some(defaults); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn head_office(mut self, head_office: UpdateTaxSettingsBuilderHeadOffice<'a>) -> Self { + self.inner.head_office = Some(head_office); + self + } +} +impl UpdateTaxSettings<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTaxSettings<'_> { + type Output = stripe_misc::TaxSettings; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax/settings").form(&self.inner) } } diff --git a/generated/stripe_misc/src/tax_transaction/requests.rs b/generated/stripe_misc/src/tax_transaction/requests.rs index f53c5a9c6..b8ec4e84a 100644 --- a/generated/stripe_misc/src/tax_transaction/requests.rs +++ b/generated/stripe_misc/src/tax_transaction/requests.rs @@ -1,112 +1,70 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTaxTransaction<'a> { +pub struct RetrieveTaxTransactionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTaxTransaction<'a> { +impl<'a> RetrieveTaxTransactionBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a Tax `Transaction` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTaxTransaction<'a> { + inner: RetrieveTaxTransactionBuilder<'a>, + transaction: &'a stripe_misc::TaxTransactionId, +} impl<'a> RetrieveTaxTransaction<'a> { - /// Retrieves a Tax `Transaction` object. - pub fn send( - &self, - client: &stripe::Client, - transaction: &stripe_misc::TaxTransactionId, - ) -> stripe::Response { - client.get_query(&format!("/tax/transactions/{transaction}"), self) + pub fn new(transaction: &'a stripe_misc::TaxTransactionId) -> Self { + Self { transaction, inner: RetrieveTaxTransactionBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListLineItemsTaxTransaction<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListLineItemsTaxTransaction<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> ListLineItemsTaxTransaction<'a> { - /// Retrieves the line items of a committed standalone transaction as a collection. - pub fn send( +impl RetrieveTaxTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - transaction: &stripe_misc::TaxTransactionId, - ) -> stripe::Response> { - client.get_query(&format!("/tax/transactions/{transaction}/line_items"), self) - } - pub fn paginate( - self, - transaction: &stripe_misc::TaxTransactionId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/tax/transactions/{transaction}/line_items"), - self, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateFromCalculationTaxTransaction<'a> { - /// Tax Calculation ID to be used as input when creating the transaction. - pub calculation: &'a str, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// A custom order or sale identifier, such as 'myOrder_123'. - /// Must be unique across all transactions, including reversals. - pub reference: &'a str, -} -impl<'a> CreateFromCalculationTaxTransaction<'a> { - pub fn new(calculation: &'a str, reference: &'a str) -> Self { - Self { calculation, expand: None, metadata: None, reference } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateFromCalculationTaxTransaction<'a> { - /// Creates a Tax `Transaction` from a calculation. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form( - "/tax/transactions/create_from_calculation", - self, - http_types::Method::Post, - ) + +impl StripeRequest for RetrieveTaxTransaction<'_> { + type Output = stripe_misc::TaxTransaction; + + fn build(&self) -> RequestBuilder { + let transaction = self.transaction; + RequestBuilder::new(StripeMethod::Get, format!("/tax/transactions/{transaction}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateReversalTaxTransaction<'a> { +pub struct CreateReversalTaxTransactionBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A flat amount to reverse across the entire transaction, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) in negative. + /// A flat amount to reverse across the entire transaction, in negative integer cents. /// This value represents the total amount to refund from the transaction, including taxes. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, /// The line item amounts to reverse. #[serde(skip_serializing_if = "Option::is_none")] - pub line_items: Option<&'a [CreateReversalTaxTransactionLineItems<'a>]>, + pub line_items: Option<&'a [CreateReversalTaxTransactionBuilderLineItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -115,7 +73,7 @@ pub struct CreateReversalTaxTransaction<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// If `partial`, the provided line item or shipping cost amounts are reversed. /// If `full`, the original transaction is fully reversed. - pub mode: CreateReversalTaxTransactionMode, + pub mode: CreateReversalTaxTransactionBuilderMode, /// The ID of the Transaction to partially or fully reverse. pub original_transaction: &'a str, /// A custom identifier for this reversal, such as `myOrder_123-refund_1`, which must be unique across all transactions. @@ -123,11 +81,11 @@ pub struct CreateReversalTaxTransaction<'a> { pub reference: &'a str, /// The shipping cost to reverse. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option, + pub shipping_cost: Option, } -impl<'a> CreateReversalTaxTransaction<'a> { +impl<'a> CreateReversalTaxTransactionBuilder<'a> { pub fn new( - mode: CreateReversalTaxTransactionMode, + mode: CreateReversalTaxTransactionBuilderMode, original_transaction: &'a str, reference: &'a str, ) -> Self { @@ -145,10 +103,10 @@ impl<'a> CreateReversalTaxTransaction<'a> { } /// The line item amounts to reverse. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateReversalTaxTransactionLineItems<'a> { - /// The amount to reverse, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) in negative. +pub struct CreateReversalTaxTransactionBuilderLineItems<'a> { + /// The amount to reverse, in negative integer cents. pub amount: i64, - /// The amount of tax to reverse, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) in negative. + /// The amount of tax to reverse, in negative integer cents. pub amount_tax: i64, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. @@ -163,7 +121,7 @@ pub struct CreateReversalTaxTransactionLineItems<'a> { /// A custom identifier for this line item in the reversal transaction, such as 'L1-refund'. pub reference: &'a str, } -impl<'a> CreateReversalTaxTransactionLineItems<'a> { +impl<'a> CreateReversalTaxTransactionBuilderLineItems<'a> { pub fn new( amount: i64, amount_tax: i64, @@ -176,13 +134,13 @@ impl<'a> CreateReversalTaxTransactionLineItems<'a> { /// If `partial`, the provided line item or shipping cost amounts are reversed. /// If `full`, the original transaction is fully reversed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateReversalTaxTransactionMode { +pub enum CreateReversalTaxTransactionBuilderMode { Full, Partial, } -impl CreateReversalTaxTransactionMode { +impl CreateReversalTaxTransactionBuilderMode { pub fn as_str(self) -> &'static str { - use CreateReversalTaxTransactionMode::*; + use CreateReversalTaxTransactionBuilderMode::*; match self { Full => "full", Partial => "partial", @@ -190,10 +148,10 @@ impl CreateReversalTaxTransactionMode { } } -impl std::str::FromStr for CreateReversalTaxTransactionMode { +impl std::str::FromStr for CreateReversalTaxTransactionBuilderMode { type Err = (); fn from_str(s: &str) -> Result { - use CreateReversalTaxTransactionMode::*; + use CreateReversalTaxTransactionBuilderMode::*; match s { "full" => Ok(Full), "partial" => Ok(Partial), @@ -201,18 +159,18 @@ impl std::str::FromStr for CreateReversalTaxTransactionMode { } } } -impl std::fmt::Display for CreateReversalTaxTransactionMode { +impl std::fmt::Display for CreateReversalTaxTransactionBuilderMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateReversalTaxTransactionMode { +impl std::fmt::Debug for CreateReversalTaxTransactionBuilderMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateReversalTaxTransactionMode { +impl serde::Serialize for CreateReversalTaxTransactionBuilderMode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -222,20 +180,232 @@ impl serde::Serialize for CreateReversalTaxTransactionMode { } /// The shipping cost to reverse. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateReversalTaxTransactionShippingCost { - /// The amount to reverse, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) in negative. +pub struct CreateReversalTaxTransactionBuilderShippingCost { + /// The amount to reverse, in negative integer cents. pub amount: i64, - /// The amount of tax to reverse, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) in negative. + /// The amount of tax to reverse, in negative integer cents. pub amount_tax: i64, } -impl CreateReversalTaxTransactionShippingCost { +impl CreateReversalTaxTransactionBuilderShippingCost { pub fn new(amount: i64, amount_tax: i64) -> Self { Self { amount, amount_tax } } } +/// Partially or fully reverses a previously created `Transaction`. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateReversalTaxTransaction<'a> { + inner: CreateReversalTaxTransactionBuilder<'a>, +} impl<'a> CreateReversalTaxTransaction<'a> { - /// Partially or fully reverses a previously created `Transaction`. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax/transactions/create_reversal", self, http_types::Method::Post) + pub fn new( + mode: CreateReversalTaxTransactionBuilderMode, + original_transaction: &'a str, + reference: &'a str, + ) -> Self { + Self { + inner: CreateReversalTaxTransactionBuilder::new(mode, original_transaction, reference), + } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn flat_amount(mut self, flat_amount: i64) -> Self { + self.inner.flat_amount = Some(flat_amount); + self + } + + pub fn line_items( + mut self, + line_items: &'a [CreateReversalTaxTransactionBuilderLineItems<'a>], + ) -> Self { + self.inner.line_items = Some(line_items); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn shipping_cost( + mut self, + shipping_cost: CreateReversalTaxTransactionBuilderShippingCost, + ) -> Self { + self.inner.shipping_cost = Some(shipping_cost); + self + } +} +impl CreateReversalTaxTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateReversalTaxTransaction<'_> { + type Output = stripe_misc::TaxTransaction; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax/transactions/create_reversal") + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreateFromCalculationTaxTransactionBuilder<'a> { + /// Tax Calculation ID to be used as input when creating the transaction. + pub calculation: &'a str, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// A custom order or sale identifier, such as 'myOrder_123'. + /// Must be unique across all transactions, including reversals. + pub reference: &'a str, +} +impl<'a> CreateFromCalculationTaxTransactionBuilder<'a> { + pub fn new(calculation: &'a str, reference: &'a str) -> Self { + Self { calculation, expand: None, metadata: None, reference } + } +} +/// Creates a Tax `Transaction` from a calculation. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateFromCalculationTaxTransaction<'a> { + inner: CreateFromCalculationTaxTransactionBuilder<'a>, +} +impl<'a> CreateFromCalculationTaxTransaction<'a> { + pub fn new(calculation: &'a str, reference: &'a str) -> Self { + Self { inner: CreateFromCalculationTaxTransactionBuilder::new(calculation, reference) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateFromCalculationTaxTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateFromCalculationTaxTransaction<'_> { + type Output = stripe_misc::TaxTransaction; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax/transactions/create_from_calculation") + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListLineItemsTaxTransactionBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListLineItemsTaxTransactionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the line items of a committed standalone transaction as a collection. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListLineItemsTaxTransaction<'a> { + inner: ListLineItemsTaxTransactionBuilder<'a>, + transaction: &'a stripe_misc::TaxTransactionId, +} +impl<'a> ListLineItemsTaxTransaction<'a> { + pub fn new(transaction: &'a stripe_misc::TaxTransactionId) -> Self { + Self { transaction, inner: ListLineItemsTaxTransactionBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListLineItemsTaxTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListLineItemsTaxTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let transaction = self.transaction; + RequestBuilder::new( + StripeMethod::Get, + format!("/tax/transactions/{transaction}/line_items"), + ) + .query(&self.inner) } } diff --git a/generated/stripe_misc/src/tax_transaction_line_item.rs b/generated/stripe_misc/src/tax_transaction_line_item.rs index 06dd5f86f..3b4eff5d2 100644 --- a/generated/stripe_misc/src/tax_transaction_line_item.rs +++ b/generated/stripe_misc/src/tax_transaction_line_item.rs @@ -1,10 +1,10 @@ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxTransactionLineItem { - /// The line item amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The line item amount in integer cents. /// If `tax_behavior=inclusive`, then this amount includes taxes. /// Otherwise, taxes were calculated on top of this amount. pub amount: i64, - /// The amount of tax calculated for this line item, in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + /// The amount of tax calculated for this line item, in integer cents. pub amount_tax: i64, /// Unique identifier for the object. pub id: stripe_misc::TaxTransactionLineItemId, diff --git a/generated/stripe_misc/src/webhook_endpoint/requests.rs b/generated/stripe_misc/src/webhook_endpoint/requests.rs index f02bee507..8e5085229 100644 --- a/generated/stripe_misc/src/webhook_endpoint/requests.rs +++ b/generated/stripe_misc/src/webhook_endpoint/requests.rs @@ -1,26 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteWebhookEndpoint {} -impl DeleteWebhookEndpoint { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteWebhookEndpoint { - /// You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard. - pub fn send( - &self, - client: &stripe::Client, - webhook_endpoint: &stripe_misc::WebhookEndpointId, - ) -> stripe::Response { - client.send_form( - &format!("/webhook_endpoints/{webhook_endpoint}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListWebhookEndpoint<'a> { +pub struct ListWebhookEndpointBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -39,48 +22,116 @@ pub struct ListWebhookEndpoint<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListWebhookEndpoint<'a> { +impl<'a> ListWebhookEndpointBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your webhook endpoints. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListWebhookEndpoint<'a> { + inner: ListWebhookEndpointBuilder<'a>, +} impl<'a> ListWebhookEndpoint<'a> { - /// Returns a list of your webhook endpoints. - pub fn send( + pub fn new() -> Self { + Self { inner: ListWebhookEndpointBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListWebhookEndpoint<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/webhook_endpoints", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/webhook_endpoints", self) +} + +impl StripeRequest for ListWebhookEndpoint<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/webhook_endpoints").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveWebhookEndpoint<'a> { +pub struct RetrieveWebhookEndpointBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveWebhookEndpoint<'a> { +impl<'a> RetrieveWebhookEndpointBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the webhook endpoint with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveWebhookEndpoint<'a> { + inner: RetrieveWebhookEndpointBuilder<'a>, + webhook_endpoint: &'a stripe_misc::WebhookEndpointId, +} impl<'a> RetrieveWebhookEndpoint<'a> { - /// Retrieves the webhook endpoint with the given ID. - pub fn send( + pub fn new(webhook_endpoint: &'a stripe_misc::WebhookEndpointId) -> Self { + Self { webhook_endpoint, inner: RetrieveWebhookEndpointBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveWebhookEndpoint<'_> { + pub async fn send( &self, - client: &stripe::Client, - webhook_endpoint: &stripe_misc::WebhookEndpointId, - ) -> stripe::Response { - client.get_query(&format!("/webhook_endpoints/{webhook_endpoint}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveWebhookEndpoint<'_> { + type Output = stripe_misc::WebhookEndpoint; + + fn build(&self) -> RequestBuilder { + let webhook_endpoint = self.webhook_endpoint; + RequestBuilder::new(StripeMethod::Get, format!("/webhook_endpoints/{webhook_endpoint}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateWebhookEndpoint<'a> { +pub struct CreateWebhookEndpointBuilder<'a> { /// Events sent to this endpoint will be generated with this Stripe Version instead of your account's default Stripe Version. #[serde(skip_serializing_if = "Option::is_none")] pub api_version: Option, @@ -93,7 +144,7 @@ pub struct CreateWebhookEndpoint<'a> { pub description: Option<&'a str>, /// The list of events to enable for this endpoint. /// You may specify `['*']` to enable all events, except those that require explicit selection. - pub enabled_events: &'a [CreateWebhookEndpointEnabledEvents], + pub enabled_events: &'a [CreateWebhookEndpointBuilderEnabledEvents], /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -106,8 +157,11 @@ pub struct CreateWebhookEndpoint<'a> { /// The URL of the webhook endpoint. pub url: &'a str, } -impl<'a> CreateWebhookEndpoint<'a> { - pub fn new(enabled_events: &'a [CreateWebhookEndpointEnabledEvents], url: &'a str) -> Self { +impl<'a> CreateWebhookEndpointBuilder<'a> { + pub fn new( + enabled_events: &'a [CreateWebhookEndpointBuilderEnabledEvents], + url: &'a str, + ) -> Self { Self { api_version: None, connect: None, @@ -123,7 +177,7 @@ impl<'a> CreateWebhookEndpoint<'a> { /// You may specify `['*']` to enable all events, except those that require explicit selection. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreateWebhookEndpointEnabledEvents { +pub enum CreateWebhookEndpointBuilderEnabledEvents { All, AccountApplicationAuthorized, AccountApplicationDeauthorized, @@ -157,13 +211,6 @@ pub enum CreateWebhookEndpointEnabledEvents { CheckoutSessionAsyncPaymentSucceeded, CheckoutSessionCompleted, CheckoutSessionExpired, - ClimateOrderCanceled, - ClimateOrderCreated, - ClimateOrderDelayed, - ClimateOrderDelivered, - ClimateOrderProductSubstituted, - ClimateProductCreated, - ClimateProductPricingUpdated, CouponCreated, CouponDeleted, CouponUpdated, @@ -198,7 +245,6 @@ pub enum CreateWebhookEndpointEnabledEvents { FinancialConnectionsAccountDisconnected, FinancialConnectionsAccountReactivated, FinancialConnectionsAccountRefreshedBalance, - FinancialConnectionsAccountRefreshedTransactions, IdentityVerificationSessionCanceled, IdentityVerificationSessionCreated, IdentityVerificationSessionProcessing, @@ -353,9 +399,9 @@ pub enum CreateWebhookEndpointEnabledEvents { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreateWebhookEndpointEnabledEvents { +impl CreateWebhookEndpointBuilderEnabledEvents { pub fn as_str(self) -> &'static str { - use CreateWebhookEndpointEnabledEvents::*; + use CreateWebhookEndpointBuilderEnabledEvents::*; match self { All => "*", AccountApplicationAuthorized => "account.application.authorized", @@ -390,13 +436,6 @@ impl CreateWebhookEndpointEnabledEvents { CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded", CheckoutSessionCompleted => "checkout.session.completed", CheckoutSessionExpired => "checkout.session.expired", - ClimateOrderCanceled => "climate.order.canceled", - ClimateOrderCreated => "climate.order.created", - ClimateOrderDelayed => "climate.order.delayed", - ClimateOrderDelivered => "climate.order.delivered", - ClimateOrderProductSubstituted => "climate.order.product_substituted", - ClimateProductCreated => "climate.product.created", - ClimateProductPricingUpdated => "climate.product.pricing_updated", CouponCreated => "coupon.created", CouponDeleted => "coupon.deleted", CouponUpdated => "coupon.updated", @@ -437,9 +476,6 @@ impl CreateWebhookEndpointEnabledEvents { FinancialConnectionsAccountRefreshedBalance => { "financial_connections.account.refreshed_balance" } - FinancialConnectionsAccountRefreshedTransactions => { - "financial_connections.account.refreshed_transactions" - } IdentityVerificationSessionCanceled => "identity.verification_session.canceled", IdentityVerificationSessionCreated => "identity.verification_session.created", IdentityVerificationSessionProcessing => "identity.verification_session.processing", @@ -606,10 +642,10 @@ impl CreateWebhookEndpointEnabledEvents { } } -impl std::str::FromStr for CreateWebhookEndpointEnabledEvents { +impl std::str::FromStr for CreateWebhookEndpointBuilderEnabledEvents { type Err = (); fn from_str(s: &str) -> Result { - use CreateWebhookEndpointEnabledEvents::*; + use CreateWebhookEndpointBuilderEnabledEvents::*; match s { "*" => Ok(All), "account.application.authorized" => Ok(AccountApplicationAuthorized), @@ -644,13 +680,6 @@ impl std::str::FromStr for CreateWebhookEndpointEnabledEvents { "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded), "checkout.session.completed" => Ok(CheckoutSessionCompleted), "checkout.session.expired" => Ok(CheckoutSessionExpired), - "climate.order.canceled" => Ok(ClimateOrderCanceled), - "climate.order.created" => Ok(ClimateOrderCreated), - "climate.order.delayed" => Ok(ClimateOrderDelayed), - "climate.order.delivered" => Ok(ClimateOrderDelivered), - "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted), - "climate.product.created" => Ok(ClimateProductCreated), - "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated), "coupon.created" => Ok(CouponCreated), "coupon.deleted" => Ok(CouponDeleted), "coupon.updated" => Ok(CouponUpdated), @@ -699,9 +728,6 @@ impl std::str::FromStr for CreateWebhookEndpointEnabledEvents { "financial_connections.account.refreshed_balance" => { Ok(FinancialConnectionsAccountRefreshedBalance) } - "financial_connections.account.refreshed_transactions" => { - Ok(FinancialConnectionsAccountRefreshedTransactions) - } "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled), "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated), "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing), @@ -867,18 +893,18 @@ impl std::str::FromStr for CreateWebhookEndpointEnabledEvents { } } } -impl std::fmt::Display for CreateWebhookEndpointEnabledEvents { +impl std::fmt::Display for CreateWebhookEndpointBuilderEnabledEvents { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateWebhookEndpointEnabledEvents { +impl std::fmt::Debug for CreateWebhookEndpointBuilderEnabledEvents { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateWebhookEndpointEnabledEvents { +impl serde::Serialize for CreateWebhookEndpointBuilderEnabledEvents { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -886,17 +912,71 @@ impl serde::Serialize for CreateWebhookEndpointEnabledEvents { serializer.serialize_str(self.as_str()) } } +/// A webhook endpoint must have a `url` and a list of `enabled_events`. +/// You may optionally specify the Boolean `connect` parameter. +/// If set to true, then a Connect webhook endpoint that notifies the specified `url` about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified `url` only about events from your account is created. +/// You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateWebhookEndpoint<'a> { + inner: CreateWebhookEndpointBuilder<'a>, +} impl<'a> CreateWebhookEndpoint<'a> { - /// A webhook endpoint must have a `url` and a list of `enabled_events`. - /// You may optionally specify the Boolean `connect` parameter. - /// If set to true, then a Connect webhook endpoint that notifies the specified `url` about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified `url` only about events from your account is created. - /// You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/webhook_endpoints", self, http_types::Method::Post) + pub fn new( + enabled_events: &'a [CreateWebhookEndpointBuilderEnabledEvents], + url: &'a str, + ) -> Self { + Self { inner: CreateWebhookEndpointBuilder::new(enabled_events, url) } + } + pub fn api_version(mut self, api_version: stripe_shared::ApiVersion) -> Self { + self.inner.api_version = Some(api_version); + self + } + + pub fn connect(mut self, connect: bool) -> Self { + self.inner.connect = Some(connect); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateWebhookEndpoint<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateWebhookEndpoint<'_> { + type Output = stripe_misc::WebhookEndpoint; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/webhook_endpoints").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateWebhookEndpoint<'a> { +pub struct UpdateWebhookEndpointBuilder<'a> { /// An optional description of what the webhook is used for. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -906,7 +986,7 @@ pub struct UpdateWebhookEndpoint<'a> { /// The list of events to enable for this endpoint. /// You may specify `['*']` to enable all events, except those that require explicit selection. #[serde(skip_serializing_if = "Option::is_none")] - pub enabled_events: Option<&'a [UpdateWebhookEndpointEnabledEvents]>, + pub enabled_events: Option<&'a [UpdateWebhookEndpointBuilderEnabledEvents]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -920,7 +1000,7 @@ pub struct UpdateWebhookEndpoint<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> UpdateWebhookEndpoint<'a> { +impl<'a> UpdateWebhookEndpointBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -929,7 +1009,7 @@ impl<'a> UpdateWebhookEndpoint<'a> { /// You may specify `['*']` to enable all events, except those that require explicit selection. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateWebhookEndpointEnabledEvents { +pub enum UpdateWebhookEndpointBuilderEnabledEvents { All, AccountApplicationAuthorized, AccountApplicationDeauthorized, @@ -963,13 +1043,6 @@ pub enum UpdateWebhookEndpointEnabledEvents { CheckoutSessionAsyncPaymentSucceeded, CheckoutSessionCompleted, CheckoutSessionExpired, - ClimateOrderCanceled, - ClimateOrderCreated, - ClimateOrderDelayed, - ClimateOrderDelivered, - ClimateOrderProductSubstituted, - ClimateProductCreated, - ClimateProductPricingUpdated, CouponCreated, CouponDeleted, CouponUpdated, @@ -1004,7 +1077,6 @@ pub enum UpdateWebhookEndpointEnabledEvents { FinancialConnectionsAccountDisconnected, FinancialConnectionsAccountReactivated, FinancialConnectionsAccountRefreshedBalance, - FinancialConnectionsAccountRefreshedTransactions, IdentityVerificationSessionCanceled, IdentityVerificationSessionCreated, IdentityVerificationSessionProcessing, @@ -1159,9 +1231,9 @@ pub enum UpdateWebhookEndpointEnabledEvents { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateWebhookEndpointEnabledEvents { +impl UpdateWebhookEndpointBuilderEnabledEvents { pub fn as_str(self) -> &'static str { - use UpdateWebhookEndpointEnabledEvents::*; + use UpdateWebhookEndpointBuilderEnabledEvents::*; match self { All => "*", AccountApplicationAuthorized => "account.application.authorized", @@ -1196,13 +1268,6 @@ impl UpdateWebhookEndpointEnabledEvents { CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded", CheckoutSessionCompleted => "checkout.session.completed", CheckoutSessionExpired => "checkout.session.expired", - ClimateOrderCanceled => "climate.order.canceled", - ClimateOrderCreated => "climate.order.created", - ClimateOrderDelayed => "climate.order.delayed", - ClimateOrderDelivered => "climate.order.delivered", - ClimateOrderProductSubstituted => "climate.order.product_substituted", - ClimateProductCreated => "climate.product.created", - ClimateProductPricingUpdated => "climate.product.pricing_updated", CouponCreated => "coupon.created", CouponDeleted => "coupon.deleted", CouponUpdated => "coupon.updated", @@ -1243,9 +1308,6 @@ impl UpdateWebhookEndpointEnabledEvents { FinancialConnectionsAccountRefreshedBalance => { "financial_connections.account.refreshed_balance" } - FinancialConnectionsAccountRefreshedTransactions => { - "financial_connections.account.refreshed_transactions" - } IdentityVerificationSessionCanceled => "identity.verification_session.canceled", IdentityVerificationSessionCreated => "identity.verification_session.created", IdentityVerificationSessionProcessing => "identity.verification_session.processing", @@ -1412,10 +1474,10 @@ impl UpdateWebhookEndpointEnabledEvents { } } -impl std::str::FromStr for UpdateWebhookEndpointEnabledEvents { +impl std::str::FromStr for UpdateWebhookEndpointBuilderEnabledEvents { type Err = (); fn from_str(s: &str) -> Result { - use UpdateWebhookEndpointEnabledEvents::*; + use UpdateWebhookEndpointBuilderEnabledEvents::*; match s { "*" => Ok(All), "account.application.authorized" => Ok(AccountApplicationAuthorized), @@ -1450,13 +1512,6 @@ impl std::str::FromStr for UpdateWebhookEndpointEnabledEvents { "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded), "checkout.session.completed" => Ok(CheckoutSessionCompleted), "checkout.session.expired" => Ok(CheckoutSessionExpired), - "climate.order.canceled" => Ok(ClimateOrderCanceled), - "climate.order.created" => Ok(ClimateOrderCreated), - "climate.order.delayed" => Ok(ClimateOrderDelayed), - "climate.order.delivered" => Ok(ClimateOrderDelivered), - "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted), - "climate.product.created" => Ok(ClimateProductCreated), - "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated), "coupon.created" => Ok(CouponCreated), "coupon.deleted" => Ok(CouponDeleted), "coupon.updated" => Ok(CouponUpdated), @@ -1505,9 +1560,6 @@ impl std::str::FromStr for UpdateWebhookEndpointEnabledEvents { "financial_connections.account.refreshed_balance" => { Ok(FinancialConnectionsAccountRefreshedBalance) } - "financial_connections.account.refreshed_transactions" => { - Ok(FinancialConnectionsAccountRefreshedTransactions) - } "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled), "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated), "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing), @@ -1673,18 +1725,18 @@ impl std::str::FromStr for UpdateWebhookEndpointEnabledEvents { } } } -impl std::fmt::Display for UpdateWebhookEndpointEnabledEvents { +impl std::fmt::Display for UpdateWebhookEndpointBuilderEnabledEvents { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateWebhookEndpointEnabledEvents { +impl std::fmt::Debug for UpdateWebhookEndpointBuilderEnabledEvents { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateWebhookEndpointEnabledEvents { +impl serde::Serialize for UpdateWebhookEndpointBuilderEnabledEvents { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1692,18 +1744,106 @@ impl serde::Serialize for UpdateWebhookEndpointEnabledEvents { serializer.serialize_str(self.as_str()) } } +/// Updates the webhook endpoint. +/// You may edit the `url`, the list of `enabled_events`, and the status of your endpoint. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateWebhookEndpoint<'a> { + inner: UpdateWebhookEndpointBuilder<'a>, + webhook_endpoint: &'a stripe_misc::WebhookEndpointId, +} impl<'a> UpdateWebhookEndpoint<'a> { - /// Updates the webhook endpoint. - /// You may edit the `url`, the list of `enabled_events`, and the status of your endpoint. - pub fn send( + pub fn new(webhook_endpoint: &'a stripe_misc::WebhookEndpointId) -> Self { + Self { webhook_endpoint, inner: UpdateWebhookEndpointBuilder::new() } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn disabled(mut self, disabled: bool) -> Self { + self.inner.disabled = Some(disabled); + self + } + + pub fn enabled_events( + mut self, + enabled_events: &'a [UpdateWebhookEndpointBuilderEnabledEvents], + ) -> Self { + self.inner.enabled_events = Some(enabled_events); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn url(mut self, url: &'a str) -> Self { + self.inner.url = Some(url); + self + } +} +impl UpdateWebhookEndpoint<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateWebhookEndpoint<'_> { + type Output = stripe_misc::WebhookEndpoint; + + fn build(&self) -> RequestBuilder { + let webhook_endpoint = self.webhook_endpoint; + RequestBuilder::new(StripeMethod::Post, format!("/webhook_endpoints/{webhook_endpoint}")) + .form(&self.inner) + } +} +/// You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteWebhookEndpoint<'a> { + webhook_endpoint: &'a stripe_misc::WebhookEndpointId, +} +impl<'a> DeleteWebhookEndpoint<'a> { + pub fn new(webhook_endpoint: &'a stripe_misc::WebhookEndpointId) -> Self { + Self { webhook_endpoint } + } +} +impl DeleteWebhookEndpoint<'_> { + pub async fn send( &self, - client: &stripe::Client, - webhook_endpoint: &stripe_misc::WebhookEndpointId, - ) -> stripe::Response { - client.send_form( - &format!("/webhook_endpoints/{webhook_endpoint}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteWebhookEndpoint<'_> { + type Output = stripe_misc::DeletedWebhookEndpoint; + + fn build(&self) -> RequestBuilder { + let webhook_endpoint = self.webhook_endpoint; + RequestBuilder::new(StripeMethod::Delete, format!("/webhook_endpoints/{webhook_endpoint}")) } } diff --git a/generated/stripe_payment/Cargo.toml b/generated/stripe_payment/Cargo.toml index 5776be916..40a728ab9 100644 --- a/generated/stripe_payment/Cargo.toml +++ b/generated/stripe_payment/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - bank_account = [] card = [] payment_link = [] @@ -54,5 +43,5 @@ full = ["bank_account", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_payment/src/bank_account/requests.rs b/generated/stripe_payment/src/bank_account/requests.rs index 908638b89..7d515c030 100644 --- a/generated/stripe_payment/src/bank_account/requests.rs +++ b/generated/stripe_payment/src/bank_account/requests.rs @@ -1,70 +1,15 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteAccountBankAccount {} -impl DeleteAccountBankAccount { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteAccountBankAccount { - /// Delete a specified external account for a given account. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteCustomerBankAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> DeleteCustomerBankAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> DeleteCustomerBankAccount<'a> { - /// Delete a specified source for a given customer. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(untagged)] -pub enum DeleteCustomerBankAccountReturned { - PaymentSource(stripe_shared::PaymentSource), - DeletedPaymentSource(stripe_shared::DeletedPaymentSource), -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountBankAccount<'a> { +pub struct UpdateCustomerBankAccountBuilder<'a> { /// The name of the person or business that owns the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, /// The type of entity that holds the account. This can be either `individual` or `company`. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, - /// 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, + pub account_holder_type: Option, /// City/District/Suburb/Town/Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -83,12 +28,6 @@ pub struct UpdateAccountBankAccount<'a> { /// ZIP or postal code. #[serde(skip_serializing_if = "Option::is_none")] pub address_zip: Option<&'a str>, - /// When set to true, this becomes the default external account for its currency. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_for_currency: Option, - /// Documents that may be submitted to satisfy various informational requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, /// Two digit number representing the card’s expiration month. #[serde(skip_serializing_if = "Option::is_none")] pub exp_month: Option<&'a str>, @@ -107,21 +46,23 @@ pub struct UpdateAccountBankAccount<'a> { /// Cardholder name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub owner: Option>, } -impl<'a> UpdateAccountBankAccount<'a> { +impl<'a> UpdateCustomerBankAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The type of entity that holds the account. This can be either `individual` or `company`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountBankAccountAccountHolderType { +pub enum UpdateCustomerBankAccountBuilderAccountHolderType { Company, Individual, } -impl UpdateAccountBankAccountAccountHolderType { +impl UpdateCustomerBankAccountBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateAccountBankAccountAccountHolderType::*; + use UpdateCustomerBankAccountBuilderAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -129,10 +70,10 @@ impl UpdateAccountBankAccountAccountHolderType { } } -impl std::str::FromStr for UpdateAccountBankAccountAccountHolderType { +impl std::str::FromStr for UpdateCustomerBankAccountBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountBankAccountAccountHolderType::*; + use UpdateCustomerBankAccountBuilderAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -140,18 +81,18 @@ impl std::str::FromStr for UpdateAccountBankAccountAccountHolderType { } } } -impl std::fmt::Display for UpdateAccountBankAccountAccountHolderType { +impl std::fmt::Display for UpdateCustomerBankAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountBankAccountAccountHolderType { +impl std::fmt::Debug for UpdateCustomerBankAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountBankAccountAccountHolderType { +impl serde::Serialize for UpdateCustomerBankAccountBuilderAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -159,113 +100,309 @@ impl serde::Serialize for UpdateAccountBankAccountAccountHolderType { serializer.serialize_str(self.as_str()) } } -/// The bank account type. -/// This can only be `checking` or `savings` in most countries. -/// In Japan, this can only be `futsu` or `toza`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountBankAccountAccountType { - Checking, - Futsu, - Savings, - Toza, +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCustomerBankAccountBuilderOwner<'a> { + /// Owner's address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// Owner's email address. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, + /// Owner's full name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Owner's phone number. + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, } -impl UpdateAccountBankAccountAccountType { - pub fn as_str(self) -> &'static str { - use UpdateAccountBankAccountAccountType::*; - match self { - Checking => "checking", - Futsu => "futsu", - Savings => "savings", - Toza => "toza", - } +impl<'a> UpdateCustomerBankAccountBuilderOwner<'a> { + pub fn new() -> Self { + Self::default() } } - -impl std::str::FromStr for UpdateAccountBankAccountAccountType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateAccountBankAccountAccountType::*; - match s { - "checking" => Ok(Checking), - "futsu" => Ok(Futsu), - "savings" => Ok(Savings), - "toza" => Ok(Toza), - _ => Err(()), - } +/// Owner's address. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCustomerBankAccountBuilderOwnerAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> UpdateCustomerBankAccountBuilderOwnerAddress<'a> { + pub fn new() -> Self { + Self::default() } } -impl std::fmt::Display for UpdateAccountBankAccountAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +/// Update a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCustomerBankAccount<'a> { + inner: UpdateCustomerBankAccountBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} +impl<'a> UpdateCustomerBankAccount<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: UpdateCustomerBankAccountBuilder::new() } + } + pub fn account_holder_name(mut self, account_holder_name: &'a str) -> Self { + self.inner.account_holder_name = Some(account_holder_name); + self + } + + pub fn account_holder_type( + mut self, + account_holder_type: UpdateCustomerBankAccountBuilderAccountHolderType, + ) -> Self { + self.inner.account_holder_type = Some(account_holder_type); + self + } + + pub fn address_city(mut self, address_city: &'a str) -> Self { + self.inner.address_city = Some(address_city); + self + } + + pub fn address_country(mut self, address_country: &'a str) -> Self { + self.inner.address_country = Some(address_country); + self + } + + pub fn address_line1(mut self, address_line1: &'a str) -> Self { + self.inner.address_line1 = Some(address_line1); + self + } + + pub fn address_line2(mut self, address_line2: &'a str) -> Self { + self.inner.address_line2 = Some(address_line2); + self + } + + pub fn address_state(mut self, address_state: &'a str) -> Self { + self.inner.address_state = Some(address_state); + self + } + + pub fn address_zip(mut self, address_zip: &'a str) -> Self { + self.inner.address_zip = Some(address_zip); + self + } + + pub fn exp_month(mut self, exp_month: &'a str) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: &'a str) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn owner(mut self, owner: UpdateCustomerBankAccountBuilderOwner<'a>) -> Self { + self.inner.owner = Some(owner); + self } } +impl UpdateCustomerBankAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } -impl std::fmt::Debug for UpdateAccountBankAccountAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize for UpdateAccountBankAccountAccountType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for UpdateCustomerBankAccount<'_> { + type Output = UpdateCustomerBankAccountReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}/sources/{id}")) + .form(&self.inner) } } -/// Documents that may be submitted to satisfy various informational requests. +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(tag = "object")] +pub enum UpdateCustomerBankAccountReturned { + #[serde(rename = "card")] + Card(stripe_shared::Card), + #[serde(rename = "bank_account")] + BankAccount(stripe_shared::BankAccount), + #[serde(rename = "source")] + Source(stripe_shared::Source), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountBankAccountDocuments<'a> { - /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. - /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. +pub struct DeleteCustomerBankAccountBuilder<'a> { + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub bank_account_ownership_verification: - Option>, + pub expand: Option<&'a [&'a str]>, } -impl<'a> UpdateAccountBankAccountDocuments<'a> { +impl<'a> DeleteCustomerBankAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. -/// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. +/// Delete a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteCustomerBankAccount<'a> { + inner: DeleteCustomerBankAccountBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} +impl<'a> DeleteCustomerBankAccount<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: DeleteCustomerBankAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DeleteCustomerBankAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteCustomerBankAccount<'_> { + type Output = DeleteCustomerBankAccountReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/sources/{id}")) + .form(&self.inner) + } +} +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum DeleteCustomerBankAccountReturned { + PaymentSource(stripe_shared::PaymentSource), + DeletedPaymentSource(stripe_shared::DeletedPaymentSource), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountBankAccountDocumentsBankAccountOwnershipVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. +pub struct VerifyBankAccountBuilder<'a> { + /// Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, + pub amounts: Option<&'a [i64]>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, } -impl<'a> UpdateAccountBankAccountDocumentsBankAccountOwnershipVerification<'a> { +impl<'a> VerifyBankAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdateAccountBankAccount<'a> { - /// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. - /// Other bank account details are not editable by design. - /// - /// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. - pub fn send( +/// Verify a specified bank account for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct VerifyBankAccount<'a> { + inner: VerifyBankAccountBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} +impl<'a> VerifyBankAccount<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: VerifyBankAccountBuilder::new() } + } + pub fn amounts(mut self, amounts: &'a [i64]) -> Self { + self.inner.amounts = Some(amounts); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl VerifyBankAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for VerifyBankAccount<'_> { + type Output = stripe_shared::BankAccount; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/customers/{customer}/sources/{id}/verify"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerBankAccount<'a> { +pub struct UpdateAccountBankAccountBuilder<'a> { /// The name of the person or business that owns the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, /// The type of entity that holds the account. This can be either `individual` or `company`. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, + /// 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, /// City/District/Suburb/Town/Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -284,6 +421,12 @@ pub struct UpdateCustomerBankAccount<'a> { /// ZIP or postal code. #[serde(skip_serializing_if = "Option::is_none")] pub address_zip: Option<&'a str>, + /// When set to true, this becomes the default external account for its currency. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_for_currency: Option, + /// Documents that may be submitted to satisfy various informational requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub documents: Option>, /// Two digit number representing the card’s expiration month. #[serde(skip_serializing_if = "Option::is_none")] pub exp_month: Option<&'a str>, @@ -302,23 +445,21 @@ pub struct UpdateCustomerBankAccount<'a> { /// Cardholder name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, } -impl<'a> UpdateCustomerBankAccount<'a> { +impl<'a> UpdateAccountBankAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The type of entity that holds the account. This can be either `individual` or `company`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerBankAccountAccountHolderType { +pub enum UpdateAccountBankAccountBuilderAccountHolderType { Company, Individual, } -impl UpdateCustomerBankAccountAccountHolderType { +impl UpdateAccountBankAccountBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateCustomerBankAccountAccountHolderType::*; + use UpdateAccountBankAccountBuilderAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -326,10 +467,10 @@ impl UpdateCustomerBankAccountAccountHolderType { } } -impl std::str::FromStr for UpdateCustomerBankAccountAccountHolderType { +impl std::str::FromStr for UpdateAccountBankAccountBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateCustomerBankAccountAccountHolderType::*; + use UpdateAccountBankAccountBuilderAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -337,18 +478,18 @@ impl std::str::FromStr for UpdateCustomerBankAccountAccountHolderType { } } } -impl std::fmt::Display for UpdateCustomerBankAccountAccountHolderType { +impl std::fmt::Display for UpdateAccountBankAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateCustomerBankAccountAccountHolderType { +impl std::fmt::Debug for UpdateAccountBankAccountBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateCustomerBankAccountAccountHolderType { +impl serde::Serialize for UpdateAccountBankAccountBuilderAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -356,104 +497,252 @@ impl serde::Serialize for UpdateCustomerBankAccountAccountHolderType { serializer.serialize_str(self.as_str()) } } +/// The bank account type. +/// This can only be `checking` or `savings` in most countries. +/// In Japan, this can only be `futsu` or `toza`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateAccountBankAccountBuilderAccountType { + Checking, + Futsu, + Savings, + Toza, +} +impl UpdateAccountBankAccountBuilderAccountType { + pub fn as_str(self) -> &'static str { + use UpdateAccountBankAccountBuilderAccountType::*; + match self { + Checking => "checking", + Futsu => "futsu", + Savings => "savings", + Toza => "toza", + } + } +} + +impl std::str::FromStr for UpdateAccountBankAccountBuilderAccountType { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateAccountBankAccountBuilderAccountType::*; + match s { + "checking" => Ok(Checking), + "futsu" => Ok(Futsu), + "savings" => Ok(Savings), + "toza" => Ok(Toza), + _ => Err(()), + } + } +} +impl std::fmt::Display for UpdateAccountBankAccountBuilderAccountType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for UpdateAccountBankAccountBuilderAccountType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for UpdateAccountBankAccountBuilderAccountType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerBankAccountOwner<'a> { - /// Owner's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Owner's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Owner's full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Owner's phone number. +pub struct UpdateAccountBankAccountBuilderDocuments<'a> { + /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. + /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, + pub bank_account_ownership_verification: + Option>, } -impl<'a> UpdateCustomerBankAccountOwner<'a> { +impl<'a> UpdateAccountBankAccountBuilderDocuments<'a> { pub fn new() -> Self { Self::default() } } -/// Owner's address. +/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. +/// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerBankAccountOwnerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. +pub struct UpdateAccountBankAccountBuilderDocumentsBankAccountOwnershipVerification<'a> { + /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, + pub files: Option<&'a [&'a str]>, } -impl<'a> UpdateCustomerBankAccountOwnerAddress<'a> { +impl<'a> UpdateAccountBankAccountBuilderDocumentsBankAccountOwnershipVerification<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdateCustomerBankAccount<'a> { - /// Update a specified source for a given customer. - pub fn send( +/// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. +/// Other bank account details are not editable by design. +/// +/// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateAccountBankAccount<'a> { + inner: UpdateAccountBankAccountBuilder<'a>, + account: &'a stripe_shared::AccountId, + id: &'a str, +} +impl<'a> UpdateAccountBankAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id, inner: UpdateAccountBankAccountBuilder::new() } + } + pub fn account_holder_name(mut self, account_holder_name: &'a str) -> Self { + self.inner.account_holder_name = Some(account_holder_name); + self + } + + pub fn account_holder_type( + mut self, + account_holder_type: UpdateAccountBankAccountBuilderAccountHolderType, + ) -> Self { + self.inner.account_holder_type = Some(account_holder_type); + self + } + + pub fn account_type( + mut self, + account_type: UpdateAccountBankAccountBuilderAccountType, + ) -> Self { + self.inner.account_type = Some(account_type); + self + } + + pub fn address_city(mut self, address_city: &'a str) -> Self { + self.inner.address_city = Some(address_city); + self + } + + pub fn address_country(mut self, address_country: &'a str) -> Self { + self.inner.address_country = Some(address_country); + self + } + + pub fn address_line1(mut self, address_line1: &'a str) -> Self { + self.inner.address_line1 = Some(address_line1); + self + } + + pub fn address_line2(mut self, address_line2: &'a str) -> Self { + self.inner.address_line2 = Some(address_line2); + self + } + + pub fn address_state(mut self, address_state: &'a str) -> Self { + self.inner.address_state = Some(address_state); + self + } + + pub fn address_zip(mut self, address_zip: &'a str) -> Self { + self.inner.address_zip = Some(address_zip); + self + } + + pub fn default_for_currency(mut self, default_for_currency: bool) -> Self { + self.inner.default_for_currency = Some(default_for_currency); + self + } + + pub fn documents(mut self, documents: UpdateAccountBankAccountBuilderDocuments<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn exp_month(mut self, exp_month: &'a str) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: &'a str) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl UpdateAccountBankAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(tag = "object")] -pub enum UpdateCustomerBankAccountReturned { - #[serde(rename = "card")] - Card(stripe_shared::Card), - #[serde(rename = "bank_account")] - BankAccount(stripe_shared::BankAccount), - #[serde(rename = "source")] - Source(stripe_shared::Source), + +impl StripeRequest for UpdateAccountBankAccount<'_> { + type Output = stripe_shared::ExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/accounts/{account}/external_accounts/{id}"), + ) + .form(&self.inner) + } } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct VerifyBankAccount<'a> { - /// Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. - #[serde(skip_serializing_if = "Option::is_none")] - pub amounts: Option<&'a [i64]>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, +/// Delete a specified external account for a given account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteAccountBankAccount<'a> { + account: &'a stripe_shared::AccountId, + id: &'a str, } -impl<'a> VerifyBankAccount<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> DeleteAccountBankAccount<'a> { + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id } } } -impl<'a> VerifyBankAccount<'a> { - /// Verify a specified bank account for a given customer. - pub fn send( +impl DeleteAccountBankAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}/verify"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteAccountBankAccount<'_> { + type Output = stripe_shared::DeletedExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Delete, + format!("/accounts/{account}/external_accounts/{id}"), ) } } diff --git a/generated/stripe_payment/src/card/requests.rs b/generated/stripe_payment/src/card/requests.rs index 37fe3124b..de3d27685 100644 --- a/generated/stripe_payment/src/card/requests.rs +++ b/generated/stripe_payment/src/card/requests.rs @@ -1,70 +1,15 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteAccountCard {} -impl DeleteAccountCard { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteAccountCard { - /// Delete a specified external account for a given account. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteCustomerCard<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> DeleteCustomerCard<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> DeleteCustomerCard<'a> { - /// Delete a specified source for a given customer. - pub fn send( - &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(untagged)] -pub enum DeleteCustomerCardReturned { - PaymentSource(stripe_shared::PaymentSource), - DeletedPaymentSource(stripe_shared::DeletedPaymentSource), -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCard<'a> { +pub struct UpdateCustomerCardBuilder<'a> { /// The name of the person or business that owns the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, /// The type of entity that holds the account. This can be either `individual` or `company`. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, - /// 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, + pub account_holder_type: Option, /// City/District/Suburb/Town/Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -83,12 +28,6 @@ pub struct UpdateAccountCard<'a> { /// ZIP or postal code. #[serde(skip_serializing_if = "Option::is_none")] pub address_zip: Option<&'a str>, - /// When set to true, this becomes the default external account for its currency. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_for_currency: Option, - /// Documents that may be submitted to satisfy various informational requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, /// Two digit number representing the card’s expiration month. #[serde(skip_serializing_if = "Option::is_none")] pub exp_month: Option<&'a str>, @@ -107,21 +46,23 @@ pub struct UpdateAccountCard<'a> { /// Cardholder name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub owner: Option>, } -impl<'a> UpdateAccountCard<'a> { +impl<'a> UpdateCustomerCardBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The type of entity that holds the account. This can be either `individual` or `company`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountCardAccountHolderType { +pub enum UpdateCustomerCardBuilderAccountHolderType { Company, Individual, } -impl UpdateAccountCardAccountHolderType { +impl UpdateCustomerCardBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateAccountCardAccountHolderType::*; + use UpdateCustomerCardBuilderAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -129,10 +70,10 @@ impl UpdateAccountCardAccountHolderType { } } -impl std::str::FromStr for UpdateAccountCardAccountHolderType { +impl std::str::FromStr for UpdateCustomerCardBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountCardAccountHolderType::*; + use UpdateCustomerCardBuilderAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -140,18 +81,18 @@ impl std::str::FromStr for UpdateAccountCardAccountHolderType { } } } -impl std::fmt::Display for UpdateAccountCardAccountHolderType { +impl std::fmt::Display for UpdateCustomerCardBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountCardAccountHolderType { +impl std::fmt::Debug for UpdateCustomerCardBuilderAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountCardAccountHolderType { +impl serde::Serialize for UpdateCustomerCardBuilderAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -159,113 +100,245 @@ impl serde::Serialize for UpdateAccountCardAccountHolderType { serializer.serialize_str(self.as_str()) } } -/// The bank account type. -/// This can only be `checking` or `savings` in most countries. -/// In Japan, this can only be `futsu` or `toza`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountCardAccountType { - Checking, - Futsu, - Savings, - Toza, +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCustomerCardBuilderOwner<'a> { + /// Owner's address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// Owner's email address. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, + /// Owner's full name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Owner's phone number. + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, } -impl UpdateAccountCardAccountType { - pub fn as_str(self) -> &'static str { - use UpdateAccountCardAccountType::*; - match self { - Checking => "checking", - Futsu => "futsu", - Savings => "savings", - Toza => "toza", - } +impl<'a> UpdateCustomerCardBuilderOwner<'a> { + pub fn new() -> Self { + Self::default() } } - -impl std::str::FromStr for UpdateAccountCardAccountType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateAccountCardAccountType::*; - match s { - "checking" => Ok(Checking), - "futsu" => Ok(Futsu), - "savings" => Ok(Savings), - "toza" => Ok(Toza), - _ => Err(()), - } +/// Owner's address. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCustomerCardBuilderOwnerAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> UpdateCustomerCardBuilderOwnerAddress<'a> { + pub fn new() -> Self { + Self::default() } } -impl std::fmt::Display for UpdateAccountCardAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +/// Update a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCustomerCard<'a> { + inner: UpdateCustomerCardBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} +impl<'a> UpdateCustomerCard<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: UpdateCustomerCardBuilder::new() } + } + pub fn account_holder_name(mut self, account_holder_name: &'a str) -> Self { + self.inner.account_holder_name = Some(account_holder_name); + self + } + + pub fn account_holder_type( + mut self, + account_holder_type: UpdateCustomerCardBuilderAccountHolderType, + ) -> Self { + self.inner.account_holder_type = Some(account_holder_type); + self + } + + pub fn address_city(mut self, address_city: &'a str) -> Self { + self.inner.address_city = Some(address_city); + self + } + + pub fn address_country(mut self, address_country: &'a str) -> Self { + self.inner.address_country = Some(address_country); + self + } + + pub fn address_line1(mut self, address_line1: &'a str) -> Self { + self.inner.address_line1 = Some(address_line1); + self + } + + pub fn address_line2(mut self, address_line2: &'a str) -> Self { + self.inner.address_line2 = Some(address_line2); + self + } + + pub fn address_state(mut self, address_state: &'a str) -> Self { + self.inner.address_state = Some(address_state); + self + } + + pub fn address_zip(mut self, address_zip: &'a str) -> Self { + self.inner.address_zip = Some(address_zip); + self + } + + pub fn exp_month(mut self, exp_month: &'a str) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: &'a str) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn owner(mut self, owner: UpdateCustomerCardBuilderOwner<'a>) -> Self { + self.inner.owner = Some(owner); + self } } +impl UpdateCustomerCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } -impl std::fmt::Debug for UpdateAccountCardAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl serde::Serialize for UpdateAccountCardAccountType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + +impl StripeRequest for UpdateCustomerCard<'_> { + type Output = UpdateCustomerCardReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}/sources/{id}")) + .form(&self.inner) } } -/// Documents that may be submitted to satisfy various informational requests. +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(tag = "object")] +pub enum UpdateCustomerCardReturned { + #[serde(rename = "card")] + Card(stripe_shared::Card), + #[serde(rename = "bank_account")] + BankAccount(stripe_shared::BankAccount), + #[serde(rename = "source")] + Source(stripe_shared::Source), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCardDocuments<'a> { - /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. - /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. +pub struct DeleteCustomerCardBuilder<'a> { + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub bank_account_ownership_verification: - Option>, + pub expand: Option<&'a [&'a str]>, } -impl<'a> UpdateAccountCardDocuments<'a> { +impl<'a> DeleteCustomerCardBuilder<'a> { pub fn new() -> Self { Self::default() } } -/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. -/// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCardDocumentsBankAccountOwnershipVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, +/// Delete a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteCustomerCard<'a> { + inner: DeleteCustomerCardBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, } -impl<'a> UpdateAccountCardDocumentsBankAccountOwnershipVerification<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> DeleteCustomerCard<'a> { + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: DeleteCustomerCardBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> UpdateAccountCard<'a> { - /// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. - /// Other bank account details are not editable by design. - /// - /// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. - pub fn send( +impl DeleteCustomerCard<'_> { + pub async fn send( &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/external_accounts/{id}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for DeleteCustomerCard<'_> { + type Output = DeleteCustomerCardReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/sources/{id}")) + .form(&self.inner) + } +} +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum DeleteCustomerCardReturned { + PaymentSource(stripe_shared::PaymentSource), + DeletedPaymentSource(stripe_shared::DeletedPaymentSource), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerCard<'a> { +pub struct UpdateAccountCardBuilder<'a> { /// The name of the person or business that owns the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, /// The type of entity that holds the account. This can be either `individual` or `company`. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, + /// 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, /// City/District/Suburb/Town/Village. #[serde(skip_serializing_if = "Option::is_none")] pub address_city: Option<&'a str>, @@ -284,6 +357,12 @@ pub struct UpdateCustomerCard<'a> { /// ZIP or postal code. #[serde(skip_serializing_if = "Option::is_none")] pub address_zip: Option<&'a str>, + /// When set to true, this becomes the default external account for its currency. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_for_currency: Option, + /// Documents that may be submitted to satisfy various informational requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub documents: Option>, /// Two digit number representing the card’s expiration month. #[serde(skip_serializing_if = "Option::is_none")] pub exp_month: Option<&'a str>, @@ -302,23 +381,21 @@ pub struct UpdateCustomerCard<'a> { /// Cardholder name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, } -impl<'a> UpdateCustomerCard<'a> { +impl<'a> UpdateAccountCardBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The type of entity that holds the account. This can be either `individual` or `company`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerCardAccountHolderType { +pub enum UpdateAccountCardBuilderAccountHolderType { Company, Individual, } -impl UpdateCustomerCardAccountHolderType { +impl UpdateAccountCardBuilderAccountHolderType { pub fn as_str(self) -> &'static str { - use UpdateCustomerCardAccountHolderType::*; + use UpdateAccountCardBuilderAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -326,10 +403,10 @@ impl UpdateCustomerCardAccountHolderType { } } -impl std::str::FromStr for UpdateCustomerCardAccountHolderType { +impl std::str::FromStr for UpdateAccountCardBuilderAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateCustomerCardAccountHolderType::*; + use UpdateAccountCardBuilderAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -337,18 +414,72 @@ impl std::str::FromStr for UpdateCustomerCardAccountHolderType { } } } -impl std::fmt::Display for UpdateCustomerCardAccountHolderType { +impl std::fmt::Display for UpdateAccountCardBuilderAccountHolderType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for UpdateAccountCardBuilderAccountHolderType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for UpdateAccountCardBuilderAccountHolderType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// The bank account type. +/// This can only be `checking` or `savings` in most countries. +/// In Japan, this can only be `futsu` or `toza`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateAccountCardBuilderAccountType { + Checking, + Futsu, + Savings, + Toza, +} +impl UpdateAccountCardBuilderAccountType { + pub fn as_str(self) -> &'static str { + use UpdateAccountCardBuilderAccountType::*; + match self { + Checking => "checking", + Futsu => "futsu", + Savings => "savings", + Toza => "toza", + } + } +} + +impl std::str::FromStr for UpdateAccountCardBuilderAccountType { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateAccountCardBuilderAccountType::*; + match s { + "checking" => Ok(Checking), + "futsu" => Ok(Futsu), + "savings" => Ok(Savings), + "toza" => Ok(Toza), + _ => Err(()), + } + } +} +impl std::fmt::Display for UpdateAccountCardBuilderAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateCustomerCardAccountHolderType { +impl std::fmt::Debug for UpdateAccountCardBuilderAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateCustomerCardAccountHolderType { +impl serde::Serialize for UpdateAccountCardBuilderAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -356,75 +487,195 @@ impl serde::Serialize for UpdateCustomerCardAccountHolderType { serializer.serialize_str(self.as_str()) } } +/// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerCardOwner<'a> { - /// Owner's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Owner's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Owner's full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Owner's phone number. +pub struct UpdateAccountCardBuilderDocuments<'a> { + /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. + /// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, + pub bank_account_ownership_verification: + Option>, } -impl<'a> UpdateCustomerCardOwner<'a> { +impl<'a> UpdateAccountCardBuilderDocuments<'a> { pub fn new() -> Self { Self::default() } } -/// Owner's address. +/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. +/// Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerCardOwnerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. +pub struct UpdateAccountCardBuilderDocumentsBankAccountOwnershipVerification<'a> { + /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, + pub files: Option<&'a [&'a str]>, } -impl<'a> UpdateCustomerCardOwnerAddress<'a> { +impl<'a> UpdateAccountCardBuilderDocumentsBankAccountOwnershipVerification<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdateCustomerCard<'a> { - /// Update a specified source for a given customer. - pub fn send( +/// Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. +/// Other bank account details are not editable by design. +/// +/// You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateAccountCard<'a> { + inner: UpdateAccountCardBuilder<'a>, + account: &'a stripe_shared::AccountId, + id: &'a str, +} +impl<'a> UpdateAccountCard<'a> { + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id, inner: UpdateAccountCardBuilder::new() } + } + pub fn account_holder_name(mut self, account_holder_name: &'a str) -> Self { + self.inner.account_holder_name = Some(account_holder_name); + self + } + + pub fn account_holder_type( + mut self, + account_holder_type: UpdateAccountCardBuilderAccountHolderType, + ) -> Self { + self.inner.account_holder_type = Some(account_holder_type); + self + } + + pub fn account_type(mut self, account_type: UpdateAccountCardBuilderAccountType) -> Self { + self.inner.account_type = Some(account_type); + self + } + + pub fn address_city(mut self, address_city: &'a str) -> Self { + self.inner.address_city = Some(address_city); + self + } + + pub fn address_country(mut self, address_country: &'a str) -> Self { + self.inner.address_country = Some(address_country); + self + } + + pub fn address_line1(mut self, address_line1: &'a str) -> Self { + self.inner.address_line1 = Some(address_line1); + self + } + + pub fn address_line2(mut self, address_line2: &'a str) -> Self { + self.inner.address_line2 = Some(address_line2); + self + } + + pub fn address_state(mut self, address_state: &'a str) -> Self { + self.inner.address_state = Some(address_state); + self + } + + pub fn address_zip(mut self, address_zip: &'a str) -> Self { + self.inner.address_zip = Some(address_zip); + self + } + + pub fn default_for_currency(mut self, default_for_currency: bool) -> Self { + self.inner.default_for_currency = Some(default_for_currency); + self + } + + pub fn documents(mut self, documents: UpdateAccountCardBuilderDocuments<'a>) -> Self { + self.inner.documents = Some(documents); + self + } + + pub fn exp_month(mut self, exp_month: &'a str) -> Self { + self.inner.exp_month = Some(exp_month); + self + } + + pub fn exp_year(mut self, exp_year: &'a str) -> Self { + self.inner.exp_year = Some(exp_year); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl UpdateAccountCard<'_> { + pub async fn send( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateAccountCard<'_> { + type Output = stripe_shared::ExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/accounts/{account}/external_accounts/{id}"), ) + .form(&self.inner) } } -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(tag = "object")] -pub enum UpdateCustomerCardReturned { - #[serde(rename = "card")] - Card(stripe_shared::Card), - #[serde(rename = "bank_account")] - BankAccount(stripe_shared::BankAccount), - #[serde(rename = "source")] - Source(stripe_shared::Source), +/// Delete a specified external account for a given account. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteAccountCard<'a> { + account: &'a stripe_shared::AccountId, + id: &'a str, +} +impl<'a> DeleteAccountCard<'a> { + pub fn new(account: &'a stripe_shared::AccountId, id: &'a str) -> Self { + Self { account, id } + } +} +impl DeleteAccountCard<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteAccountCard<'_> { + type Output = stripe_shared::DeletedExternalAccount; + + fn build(&self) -> RequestBuilder { + let account = self.account; + let id = self.id; + RequestBuilder::new( + StripeMethod::Delete, + format!("/accounts/{account}/external_accounts/{id}"), + ) + } } diff --git a/generated/stripe_payment/src/mod.rs b/generated/stripe_payment/src/mod.rs index 523419582..30d4db627 100644 --- a/generated/stripe_payment/src/mod.rs +++ b/generated/stripe_payment/src/mod.rs @@ -16,7 +16,6 @@ pub mod payment_link; pub use stripe_shared::payment_link::*; pub use stripe_shared::payment_links_resource_after_completion::*; pub use stripe_shared::payment_links_resource_automatic_tax::*; -pub use stripe_shared::payment_links_resource_completed_sessions::*; pub use stripe_shared::payment_links_resource_completion_behavior_confirmation_page::*; pub use stripe_shared::payment_links_resource_completion_behavior_redirect::*; pub use stripe_shared::payment_links_resource_consent_collection::*; @@ -31,13 +30,10 @@ pub use stripe_shared::payment_links_resource_custom_text_position::*; pub use stripe_shared::payment_links_resource_invoice_creation::*; pub use stripe_shared::payment_links_resource_invoice_settings::*; pub use stripe_shared::payment_links_resource_payment_intent_data::*; -pub use stripe_shared::payment_links_resource_payment_method_reuse_agreement::*; pub use stripe_shared::payment_links_resource_phone_number_collection::*; -pub use stripe_shared::payment_links_resource_restrictions::*; pub use stripe_shared::payment_links_resource_shipping_address_collection::*; pub use stripe_shared::payment_links_resource_shipping_option::*; pub use stripe_shared::payment_links_resource_subscription_data::*; -pub use stripe_shared::payment_links_resource_subscription_data_invoice_settings::*; pub use stripe_shared::payment_links_resource_tax_id_collection::*; pub use stripe_shared::payment_links_resource_transfer_data::*; pub mod payment_method; @@ -128,7 +124,6 @@ pub use stripe_shared::payment_method_details_sepa_credit_transfer::*; pub use stripe_shared::payment_method_details_sepa_debit::*; pub use stripe_shared::payment_method_details_sofort::*; pub use stripe_shared::payment_method_details_stripe_account::*; -pub use stripe_shared::payment_method_details_swish::*; pub use stripe_shared::payment_method_details_us_bank_account::*; pub use stripe_shared::payment_method_details_wechat::*; pub use stripe_shared::payment_method_details_wechat_pay::*; @@ -179,7 +174,6 @@ pub use stripe_shared::payment_method_options_pix::*; pub use stripe_shared::payment_method_options_promptpay::*; pub use stripe_shared::payment_method_options_revolut_pay::*; pub use stripe_shared::payment_method_options_sofort::*; -pub use stripe_shared::payment_method_options_us_bank_account_mandate_options::*; pub use stripe_shared::payment_method_options_wechat_pay::*; pub use stripe_shared::payment_method_options_zip::*; pub use stripe_shared::payment_method_oxxo::*; @@ -191,7 +185,6 @@ pub use stripe_shared::payment_method_promptpay::*; pub use stripe_shared::payment_method_revolut_pay::*; pub use stripe_shared::payment_method_sepa_debit::*; pub use stripe_shared::payment_method_sofort::*; -pub use stripe_shared::payment_method_swish::*; pub use stripe_shared::payment_method_us_bank_account::*; pub use stripe_shared::payment_method_us_bank_account_blocked::*; pub use stripe_shared::payment_method_us_bank_account_status_details::*; diff --git a/generated/stripe_payment/src/payment_link/requests.rs b/generated/stripe_payment/src/payment_link/requests.rs index 14fde7ad6..6bbb0fa22 100644 --- a/generated/stripe_payment/src/payment_link/requests.rs +++ b/generated/stripe_payment/src/payment_link/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentLink<'a> { +pub struct ListPaymentLinkBuilder<'a> { /// Only return payment links that are active or inactive (e.g., pass `false` to list all inactive payment links). #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -21,46 +25,121 @@ pub struct ListPaymentLink<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListPaymentLink<'a> { +impl<'a> ListPaymentLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your payment links. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentLink<'a> { + inner: ListPaymentLinkBuilder<'a>, +} impl<'a> ListPaymentLink<'a> { - /// Returns a list of your payment links. - pub fn send( + pub fn new() -> Self { + Self { inner: ListPaymentLinkBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListPaymentLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_links", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payment_links", self) +} + +impl StripeRequest for ListPaymentLink<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_links").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentLink<'a> { +pub struct RetrievePaymentLinkBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrievePaymentLink<'a> { +impl<'a> RetrievePaymentLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieve a payment link. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentLink<'a> { + inner: RetrievePaymentLinkBuilder<'a>, + payment_link: &'a stripe_shared::PaymentLinkId, +} impl<'a> RetrievePaymentLink<'a> { - /// Retrieve a payment link. - pub fn send( + pub fn new(payment_link: &'a stripe_shared::PaymentLinkId) -> Self { + Self { payment_link, inner: RetrievePaymentLinkBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_link: &stripe_shared::PaymentLinkId, - ) -> stripe::Response { - client.get_query(&format!("/payment_links/{payment_link}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentLink<'_> { + type Output = stripe_shared::PaymentLink; + + fn build(&self) -> RequestBuilder { + let payment_link = self.payment_link; + RequestBuilder::new(StripeMethod::Get, format!("/payment_links/{payment_link}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListLineItemsPaymentLink<'a> { +pub struct ListLineItemsPaymentLinkBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -79,36 +158,72 @@ pub struct ListLineItemsPaymentLink<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListLineItemsPaymentLink<'a> { +impl<'a> ListLineItemsPaymentLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// When retrieving a payment link, there is an includable **line_items** property containing the first handful of those items. +/// There is also a URL where you can retrieve the full (paginated) list of line items. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListLineItemsPaymentLink<'a> { + inner: ListLineItemsPaymentLinkBuilder<'a>, + payment_link: &'a stripe_shared::PaymentLinkId, +} impl<'a> ListLineItemsPaymentLink<'a> { - /// When retrieving a payment link, there is an includable **line_items** property containing the first handful of those items. - /// There is also a URL where you can retrieve the full (paginated) list of line items. - pub fn send( + pub fn new(payment_link: &'a stripe_shared::PaymentLinkId) -> Self { + Self { payment_link, inner: ListLineItemsPaymentLinkBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListLineItemsPaymentLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_link: &stripe_shared::PaymentLinkId, - ) -> stripe::Response> { - client.get_query(&format!("/payment_links/{payment_link}/line_items"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - payment_link: &stripe_shared::PaymentLinkId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/payment_links/{payment_link}/line_items"), - self, - ) +} + +impl StripeRequest for ListLineItemsPaymentLink<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let payment_link = self.payment_link; + RequestBuilder::new(StripeMethod::Get, format!("/payment_links/{payment_link}/line_items")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLink<'a> { +pub struct CreatePaymentLinkBuilder<'a> { /// Behavior after the purchase is complete. #[serde(skip_serializing_if = "Option::is_none")] - pub after_completion: Option>, + pub after_completion: Option>, /// Enables user redeemable promotion codes. #[serde(skip_serializing_if = "Option::is_none")] pub allow_promotion_codes: Option, @@ -123,40 +238,37 @@ pub struct CreatePaymentLink<'a> { pub application_fee_percent: Option, /// Configuration for automatic tax collection. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Configuration for collecting the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing_address_collection: Option, /// Configure fields to gather active consent from customers. #[serde(skip_serializing_if = "Option::is_none")] - pub consent_collection: Option, + pub consent_collection: Option, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies) and supported by each line item's price. #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option, /// Collect additional information from your customer using custom fields. - /// Up to 3 fields are supported. + /// Up to 2 fields are supported. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CreatePaymentLinkCustomFields<'a>]>, + pub custom_fields: Option<&'a [CreatePaymentLinkBuilderCustomFields<'a>]>, /// Display additional text for your customers using custom text. #[serde(skip_serializing_if = "Option::is_none")] pub custom_text: Option>, /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[serde(skip_serializing_if = "Option::is_none")] - pub customer_creation: Option, + pub customer_creation: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The custom message to be displayed to a customer when a payment link is no longer active. - #[serde(skip_serializing_if = "Option::is_none")] - pub inactive_message: Option<&'a str>, /// Generate a post-purchase Invoice for one-time payments. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_creation: Option>, + pub invoice_creation: Option>, /// The line items representing what is being sold. /// Each line item represents an item being sold. /// Up to 20 line items are supported. - pub line_items: &'a [CreatePaymentLinkLineItems<'a>], + pub line_items: &'a [CreatePaymentLinkBuilderLineItems<'a>], /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -169,7 +281,7 @@ pub struct CreatePaymentLink<'a> { pub on_behalf_of: Option<&'a str>, /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_intent_data: Option>, + pub payment_intent_data: Option>, /// Specify whether Checkout should collect a payment method. /// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount. /// @@ -177,7 +289,7 @@ pub struct CreatePaymentLink<'a> { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_collection: Option, + pub payment_method_collection: Option, /// The list of payment method types that customers can use. /// If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://stripe.com/docs/payments/payment-methods/integration-options#payment-method-product-support)). #[serde(skip_serializing_if = "Option::is_none")] @@ -186,16 +298,13 @@ pub struct CreatePaymentLink<'a> { /// /// We recommend that you review your privacy policy and check with your legal contacts. #[serde(skip_serializing_if = "Option::is_none")] - pub phone_number_collection: Option, - /// Settings that restrict the usage of a payment link. - #[serde(skip_serializing_if = "Option::is_none")] - pub restrictions: Option, + pub phone_number_collection: Option, /// Configuration for collecting the customer's shipping address. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address_collection: Option>, + pub shipping_address_collection: Option>, /// The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_options: Option<&'a [CreatePaymentLinkShippingOptions<'a>]>, + pub shipping_options: Option<&'a [CreatePaymentLinkBuilderShippingOptions<'a>]>, /// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. /// Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`). #[serde(skip_serializing_if = "Option::is_none")] @@ -203,16 +312,16 @@ pub struct CreatePaymentLink<'a> { /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_data: Option>, + pub subscription_data: Option>, /// Controls tax ID collection during checkout. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id_collection: Option, + pub tax_id_collection: Option, /// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } -impl<'a> CreatePaymentLink<'a> { - pub fn new(line_items: &'a [CreatePaymentLinkLineItems<'a>]) -> Self { +impl<'a> CreatePaymentLinkBuilder<'a> { + pub fn new(line_items: &'a [CreatePaymentLinkBuilderLineItems<'a>]) -> Self { Self { after_completion: None, allow_promotion_codes: None, @@ -226,7 +335,6 @@ impl<'a> CreatePaymentLink<'a> { custom_text: None, customer_creation: None, expand: None, - inactive_message: None, invoice_creation: None, line_items, metadata: None, @@ -235,7 +343,6 @@ impl<'a> CreatePaymentLink<'a> { payment_method_collection: None, payment_method_types: None, phone_number_collection: None, - restrictions: None, shipping_address_collection: None, shipping_options: None, submit_type: None, @@ -247,7 +354,7 @@ impl<'a> CreatePaymentLink<'a> { } /// Behavior after the purchase is complete. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkAfterCompletion<'a> { +pub struct CreatePaymentLinkBuilderAfterCompletion<'a> { /// Configuration when `type=hosted_confirmation`. #[serde(skip_serializing_if = "Option::is_none")] pub hosted_confirmation: Option>, @@ -256,22 +363,22 @@ pub struct CreatePaymentLinkAfterCompletion<'a> { pub redirect: Option>, /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[serde(rename = "type")] - pub type_: CreatePaymentLinkAfterCompletionType, + pub type_: CreatePaymentLinkBuilderAfterCompletionType, } -impl<'a> CreatePaymentLinkAfterCompletion<'a> { - pub fn new(type_: CreatePaymentLinkAfterCompletionType) -> Self { +impl<'a> CreatePaymentLinkBuilderAfterCompletion<'a> { + pub fn new(type_: CreatePaymentLinkBuilderAfterCompletionType) -> Self { Self { hosted_confirmation: None, redirect: None, type_ } } } /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkAfterCompletionType { +pub enum CreatePaymentLinkBuilderAfterCompletionType { HostedConfirmation, Redirect, } -impl CreatePaymentLinkAfterCompletionType { +impl CreatePaymentLinkBuilderAfterCompletionType { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkAfterCompletionType::*; + use CreatePaymentLinkBuilderAfterCompletionType::*; match self { HostedConfirmation => "hosted_confirmation", Redirect => "redirect", @@ -279,10 +386,10 @@ impl CreatePaymentLinkAfterCompletionType { } } -impl std::str::FromStr for CreatePaymentLinkAfterCompletionType { +impl std::str::FromStr for CreatePaymentLinkBuilderAfterCompletionType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkAfterCompletionType::*; + use CreatePaymentLinkBuilderAfterCompletionType::*; match s { "hosted_confirmation" => Ok(HostedConfirmation), "redirect" => Ok(Redirect), @@ -290,97 +397,18 @@ impl std::str::FromStr for CreatePaymentLinkAfterCompletionType { } } } -impl std::fmt::Display for CreatePaymentLinkAfterCompletionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkAfterCompletionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkAfterCompletionType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Configuration for automatic tax collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkAutomaticTax<'a> { - /// If `true`, tax will be calculated automatically using the customer's location. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> CreatePaymentLinkAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreatePaymentLinkAutomaticTaxLiabilityType, -} -impl<'a> CreatePaymentLinkAutomaticTaxLiability<'a> { - pub fn new(type_: CreatePaymentLinkAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkAutomaticTaxLiabilityType { - Account, - Self_, -} -impl CreatePaymentLinkAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentLinkAutomaticTaxLiabilityType { +impl std::fmt::Display for CreatePaymentLinkBuilderAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkAutomaticTaxLiabilityType { +impl std::fmt::Debug for CreatePaymentLinkBuilderAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkAutomaticTaxLiabilityType { +impl serde::Serialize for CreatePaymentLinkBuilderAfterCompletionType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -390,106 +418,35 @@ impl serde::Serialize for CreatePaymentLinkAutomaticTaxLiabilityType { } /// Configure fields to gather active consent from customers. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkConsentCollection { - /// Determines the display of payment method reuse agreement text in the UI. - /// If set to `hidden`, it will hide legal text related to the reuse of a payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_reuse_agreement: - Option, +pub struct CreatePaymentLinkBuilderConsentCollection { /// If set to `auto`, enables the collection of customer consent for promotional communications. /// The Checkout. /// Session will determine whether to display an option to opt into promotional communication /// from the merchant depending on the customer's locale. Only available to US merchants. #[serde(skip_serializing_if = "Option::is_none")] - pub promotions: Option, + pub promotions: Option, /// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay. /// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public). #[serde(skip_serializing_if = "Option::is_none")] - pub terms_of_service: Option, + pub terms_of_service: Option, } -impl CreatePaymentLinkConsentCollection { +impl CreatePaymentLinkBuilderConsentCollection { pub fn new() -> Self { Self::default() } } -/// Determines the display of payment method reuse agreement text in the UI. -/// If set to `hidden`, it will hide legal text related to the reuse of a payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement { - /// Determines the position and visibility of the payment method reuse agreement in the UI. - /// When set to `auto`, Stripe's. - /// defaults will be used. - /// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. - pub position: CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition, -} -impl CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement { - pub fn new( - position: CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition, - ) -> Self { - Self { position } - } -} -/// Determines the position and visibility of the payment method reuse agreement in the UI. -/// When set to `auto`, Stripe's. -/// defaults will be used. -/// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - Auto, - Hidden, -} -impl CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition::*; - match self { - Auto => "auto", - Hidden => "hidden", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition::*; - match s { - "auto" => Ok(Auto), - "hidden" => Ok(Hidden), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// If set to `auto`, enables the collection of customer consent for promotional communications. /// The Checkout. /// Session will determine whether to display an option to opt into promotional communication /// from the merchant depending on the customer's locale. Only available to US merchants. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkConsentCollectionPromotions { +pub enum CreatePaymentLinkBuilderConsentCollectionPromotions { Auto, None, } -impl CreatePaymentLinkConsentCollectionPromotions { +impl CreatePaymentLinkBuilderConsentCollectionPromotions { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkConsentCollectionPromotions::*; + use CreatePaymentLinkBuilderConsentCollectionPromotions::*; match self { Auto => "auto", None => "none", @@ -497,10 +454,10 @@ impl CreatePaymentLinkConsentCollectionPromotions { } } -impl std::str::FromStr for CreatePaymentLinkConsentCollectionPromotions { +impl std::str::FromStr for CreatePaymentLinkBuilderConsentCollectionPromotions { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkConsentCollectionPromotions::*; + use CreatePaymentLinkBuilderConsentCollectionPromotions::*; match s { "auto" => Ok(Auto), "none" => Ok(None), @@ -508,18 +465,18 @@ impl std::str::FromStr for CreatePaymentLinkConsentCollectionPromotions { } } } -impl std::fmt::Display for CreatePaymentLinkConsentCollectionPromotions { +impl std::fmt::Display for CreatePaymentLinkBuilderConsentCollectionPromotions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPromotions { +impl std::fmt::Debug for CreatePaymentLinkBuilderConsentCollectionPromotions { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkConsentCollectionPromotions { +impl serde::Serialize for CreatePaymentLinkBuilderConsentCollectionPromotions { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -530,13 +487,13 @@ impl serde::Serialize for CreatePaymentLinkConsentCollectionPromotions { /// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay. /// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkConsentCollectionTermsOfService { +pub enum CreatePaymentLinkBuilderConsentCollectionTermsOfService { None, Required, } -impl CreatePaymentLinkConsentCollectionTermsOfService { +impl CreatePaymentLinkBuilderConsentCollectionTermsOfService { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkConsentCollectionTermsOfService::*; + use CreatePaymentLinkBuilderConsentCollectionTermsOfService::*; match self { None => "none", Required => "required", @@ -544,10 +501,10 @@ impl CreatePaymentLinkConsentCollectionTermsOfService { } } -impl std::str::FromStr for CreatePaymentLinkConsentCollectionTermsOfService { +impl std::str::FromStr for CreatePaymentLinkBuilderConsentCollectionTermsOfService { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkConsentCollectionTermsOfService::*; + use CreatePaymentLinkBuilderConsentCollectionTermsOfService::*; match s { "none" => Ok(None), "required" => Ok(Required), @@ -555,18 +512,18 @@ impl std::str::FromStr for CreatePaymentLinkConsentCollectionTermsOfService { } } } -impl std::fmt::Display for CreatePaymentLinkConsentCollectionTermsOfService { +impl std::fmt::Display for CreatePaymentLinkBuilderConsentCollectionTermsOfService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkConsentCollectionTermsOfService { +impl std::fmt::Debug for CreatePaymentLinkBuilderConsentCollectionTermsOfService { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkConsentCollectionTermsOfService { +impl serde::Serialize for CreatePaymentLinkBuilderConsentCollectionTermsOfService { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -575,9 +532,9 @@ impl serde::Serialize for CreatePaymentLinkConsentCollectionTermsOfService { } } /// Collect additional information from your customer using custom fields. -/// Up to 3 fields are supported. +/// Up to 2 fields are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomFields<'a> { +pub struct CreatePaymentLinkBuilderCustomFields<'a> { /// Configuration for `type=dropdown` fields. #[serde(skip_serializing_if = "Option::is_none")] pub dropdown: Option>, @@ -585,80 +542,80 @@ pub struct CreatePaymentLinkCustomFields<'a> { /// Must be unique to this field, alphanumeric, and up to 200 characters. pub key: &'a str, /// The label for the field, displayed to the customer. - pub label: CreatePaymentLinkCustomFieldsLabel<'a>, + pub label: CreatePaymentLinkBuilderCustomFieldsLabel<'a>, /// Configuration for `type=numeric` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub numeric: Option, + pub numeric: Option, /// Whether the customer is required to complete the field before completing the Checkout Session. /// Defaults to `false`. #[serde(skip_serializing_if = "Option::is_none")] pub optional: Option, /// Configuration for `type=text` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, + pub text: Option, /// The type of the field. #[serde(rename = "type")] - pub type_: CreatePaymentLinkCustomFieldsType, + pub type_: CreatePaymentLinkBuilderCustomFieldsType, } -impl<'a> CreatePaymentLinkCustomFields<'a> { +impl<'a> CreatePaymentLinkBuilderCustomFields<'a> { pub fn new( key: &'a str, - label: CreatePaymentLinkCustomFieldsLabel<'a>, - type_: CreatePaymentLinkCustomFieldsType, + label: CreatePaymentLinkBuilderCustomFieldsLabel<'a>, + type_: CreatePaymentLinkBuilderCustomFieldsType, ) -> Self { Self { dropdown: None, key, label, numeric: None, optional: None, text: None, type_ } } } /// The label for the field, displayed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomFieldsLabel<'a> { +pub struct CreatePaymentLinkBuilderCustomFieldsLabel<'a> { /// Custom text for the label, displayed to the customer. Up to 50 characters. pub custom: &'a str, /// The type of the label. #[serde(rename = "type")] - pub type_: CreatePaymentLinkCustomFieldsLabelType, + pub type_: CreatePaymentLinkBuilderCustomFieldsLabelType, } -impl<'a> CreatePaymentLinkCustomFieldsLabel<'a> { - pub fn new(custom: &'a str, type_: CreatePaymentLinkCustomFieldsLabelType) -> Self { +impl<'a> CreatePaymentLinkBuilderCustomFieldsLabel<'a> { + pub fn new(custom: &'a str, type_: CreatePaymentLinkBuilderCustomFieldsLabelType) -> Self { Self { custom, type_ } } } /// The type of the label. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkCustomFieldsLabelType { +pub enum CreatePaymentLinkBuilderCustomFieldsLabelType { Custom, } -impl CreatePaymentLinkCustomFieldsLabelType { +impl CreatePaymentLinkBuilderCustomFieldsLabelType { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkCustomFieldsLabelType::*; + use CreatePaymentLinkBuilderCustomFieldsLabelType::*; match self { Custom => "custom", } } } -impl std::str::FromStr for CreatePaymentLinkCustomFieldsLabelType { +impl std::str::FromStr for CreatePaymentLinkBuilderCustomFieldsLabelType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkCustomFieldsLabelType::*; + use CreatePaymentLinkBuilderCustomFieldsLabelType::*; match s { "custom" => Ok(Custom), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentLinkCustomFieldsLabelType { +impl std::fmt::Display for CreatePaymentLinkBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkCustomFieldsLabelType { +impl std::fmt::Debug for CreatePaymentLinkBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkCustomFieldsLabelType { +impl serde::Serialize for CreatePaymentLinkBuilderCustomFieldsLabelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -668,7 +625,7 @@ impl serde::Serialize for CreatePaymentLinkCustomFieldsLabelType { } /// Configuration for `type=numeric` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkCustomFieldsNumeric { +pub struct CreatePaymentLinkBuilderCustomFieldsNumeric { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -676,14 +633,14 @@ pub struct CreatePaymentLinkCustomFieldsNumeric { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl CreatePaymentLinkCustomFieldsNumeric { +impl CreatePaymentLinkBuilderCustomFieldsNumeric { pub fn new() -> Self { Self::default() } } /// Configuration for `type=text` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkCustomFieldsText { +pub struct CreatePaymentLinkBuilderCustomFieldsText { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -691,21 +648,21 @@ pub struct CreatePaymentLinkCustomFieldsText { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl CreatePaymentLinkCustomFieldsText { +impl CreatePaymentLinkBuilderCustomFieldsText { pub fn new() -> Self { Self::default() } } /// The type of the field. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkCustomFieldsType { +pub enum CreatePaymentLinkBuilderCustomFieldsType { Dropdown, Numeric, Text, } -impl CreatePaymentLinkCustomFieldsType { +impl CreatePaymentLinkBuilderCustomFieldsType { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkCustomFieldsType::*; + use CreatePaymentLinkBuilderCustomFieldsType::*; match self { Dropdown => "dropdown", Numeric => "numeric", @@ -714,10 +671,10 @@ impl CreatePaymentLinkCustomFieldsType { } } -impl std::str::FromStr for CreatePaymentLinkCustomFieldsType { +impl std::str::FromStr for CreatePaymentLinkBuilderCustomFieldsType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkCustomFieldsType::*; + use CreatePaymentLinkBuilderCustomFieldsType::*; match s { "dropdown" => Ok(Dropdown), "numeric" => Ok(Numeric), @@ -726,18 +683,18 @@ impl std::str::FromStr for CreatePaymentLinkCustomFieldsType { } } } -impl std::fmt::Display for CreatePaymentLinkCustomFieldsType { +impl std::fmt::Display for CreatePaymentLinkBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkCustomFieldsType { +impl std::fmt::Debug for CreatePaymentLinkBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkCustomFieldsType { +impl serde::Serialize for CreatePaymentLinkBuilderCustomFieldsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -747,13 +704,13 @@ impl serde::Serialize for CreatePaymentLinkCustomFieldsType { } /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkCustomerCreation { +pub enum CreatePaymentLinkBuilderCustomerCreation { Always, IfRequired, } -impl CreatePaymentLinkCustomerCreation { +impl CreatePaymentLinkBuilderCustomerCreation { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkCustomerCreation::*; + use CreatePaymentLinkBuilderCustomerCreation::*; match self { Always => "always", IfRequired => "if_required", @@ -761,10 +718,10 @@ impl CreatePaymentLinkCustomerCreation { } } -impl std::str::FromStr for CreatePaymentLinkCustomerCreation { +impl std::str::FromStr for CreatePaymentLinkBuilderCustomerCreation { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkCustomerCreation::*; + use CreatePaymentLinkBuilderCustomerCreation::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -772,18 +729,18 @@ impl std::str::FromStr for CreatePaymentLinkCustomerCreation { } } } -impl std::fmt::Display for CreatePaymentLinkCustomerCreation { +impl std::fmt::Display for CreatePaymentLinkBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkCustomerCreation { +impl std::fmt::Debug for CreatePaymentLinkBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkCustomerCreation { +impl serde::Serialize for CreatePaymentLinkBuilderCustomerCreation { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -793,21 +750,21 @@ impl serde::Serialize for CreatePaymentLinkCustomerCreation { } /// Generate a post-purchase Invoice for one-time payments. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkInvoiceCreation<'a> { +pub struct CreatePaymentLinkBuilderInvoiceCreation<'a> { /// Whether the feature is enabled pub enabled: bool, /// Invoice PDF configuration. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_data: Option>, + pub invoice_data: Option>, } -impl<'a> CreatePaymentLinkInvoiceCreation<'a> { +impl<'a> CreatePaymentLinkBuilderInvoiceCreation<'a> { pub fn new(enabled: bool) -> Self { Self { enabled, invoice_data: None } } } /// Invoice PDF configuration. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkInvoiceCreationInvoiceData<'a> { +pub struct CreatePaymentLinkBuilderInvoiceCreationInvoiceData<'a> { /// The account tax IDs associated with the invoice. #[serde(skip_serializing_if = "Option::is_none")] pub account_tax_ids: Option<&'a [&'a str]>, @@ -820,10 +777,6 @@ pub struct CreatePaymentLinkInvoiceCreationInvoiceData<'a> { /// Default footer to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<&'a str>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -832,87 +785,26 @@ pub struct CreatePaymentLinkInvoiceCreationInvoiceData<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Default options for invoice PDF rendering for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, + pub rendering_options: + Option, } -impl<'a> CreatePaymentLinkInvoiceCreationInvoiceData<'a> { +impl<'a> CreatePaymentLinkBuilderInvoiceCreationInvoiceData<'a> { pub fn new() -> Self { Self::default() } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkInvoiceCreationInvoiceDataIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType, -} -impl<'a> CreatePaymentLinkInvoiceCreationInvoiceDataIssuer<'a> { - pub fn new(type_: CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - Account, - Self_, -} -impl CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { +pub struct CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptions { /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. /// One of `exclude_tax` or `include_inclusive_tax`. /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] pub amount_tax_display: - Option, + Option, } -impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { +impl CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptions { pub fn new() -> Self { Self::default() } @@ -922,13 +814,13 @@ impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +pub enum CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { ExcludeTax, IncludeInclusiveTax, } -impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +impl CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match self { ExcludeTax => "exclude_tax", IncludeInclusiveTax => "include_inclusive_tax", @@ -937,11 +829,11 @@ impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay } impl std::str::FromStr - for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match s { "exclude_tax" => Ok(ExcludeTax), "include_inclusive_tax" => Ok(IncludeInclusiveTax), @@ -950,7 +842,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -958,14 +850,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for CreatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where @@ -978,7 +870,7 @@ impl serde::Serialize /// Each line item represents an item being sold. /// Up to 20 line items are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkLineItems<'a> { +pub struct CreatePaymentLinkBuilderLineItems<'a> { /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. #[serde(skip_serializing_if = "Option::is_none")] pub adjustable_quantity: Option, @@ -987,17 +879,17 @@ pub struct CreatePaymentLinkLineItems<'a> { /// The quantity of the line item being purchased. pub quantity: u64, } -impl<'a> CreatePaymentLinkLineItems<'a> { +impl<'a> CreatePaymentLinkBuilderLineItems<'a> { pub fn new(price: &'a str, quantity: u64) -> Self { Self { adjustable_quantity: None, price, quantity } } } /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkPaymentIntentData<'a> { +pub struct CreatePaymentLinkBuilderPaymentIntentData<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -1019,7 +911,7 @@ pub struct CreatePaymentLinkPaymentIntentData<'a> { /// /// When processing card payments, Checkout also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: Option, /// Extra information about the payment. /// This will appear on your customer's statement when this payment succeeds in creating a charge. #[serde(skip_serializing_if = "Option::is_none")] @@ -1029,26 +921,22 @@ pub struct CreatePaymentLinkPaymentIntentData<'a> { /// Maximum 22 characters for the concatenated descriptor. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix: Option<&'a str>, - /// A string that identifies the resulting payment as part of a group. - /// See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_group: Option<&'a str>, } -impl<'a> CreatePaymentLinkPaymentIntentData<'a> { +impl<'a> CreatePaymentLinkBuilderPaymentIntentData<'a> { pub fn new() -> Self { Self::default() } } /// Controls when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkPaymentIntentDataCaptureMethod { +pub enum CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { Automatic, AutomaticAsync, Manual, } -impl CreatePaymentLinkPaymentIntentDataCaptureMethod { +impl CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkPaymentIntentDataCaptureMethod::*; + use CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod::*; match self { Automatic => "automatic", AutomaticAsync => "automatic_async", @@ -1057,10 +945,10 @@ impl CreatePaymentLinkPaymentIntentDataCaptureMethod { } } -impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataCaptureMethod { +impl std::str::FromStr for CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkPaymentIntentDataCaptureMethod::*; + use CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod::*; match s { "automatic" => Ok(Automatic), "automatic_async" => Ok(AutomaticAsync), @@ -1069,18 +957,18 @@ impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataCaptureMethod { } } } -impl std::fmt::Display for CreatePaymentLinkPaymentIntentDataCaptureMethod { +impl std::fmt::Display for CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataCaptureMethod { +impl std::fmt::Debug for CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkPaymentIntentDataCaptureMethod { +impl serde::Serialize for CreatePaymentLinkBuilderPaymentIntentDataCaptureMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1101,13 +989,13 @@ impl serde::Serialize for CreatePaymentLinkPaymentIntentDataCaptureMethod { /// /// When processing card payments, Checkout also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +pub enum CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { OffSession, OnSession, } -impl CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +impl CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkPaymentIntentDataSetupFutureUsage::*; + use CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage::*; match self { OffSession => "off_session", OnSession => "on_session", @@ -1115,10 +1003,10 @@ impl CreatePaymentLinkPaymentIntentDataSetupFutureUsage { } } -impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +impl std::str::FromStr for CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkPaymentIntentDataSetupFutureUsage::*; + use CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage::*; match s { "off_session" => Ok(OffSession), "on_session" => Ok(OnSession), @@ -1126,18 +1014,18 @@ impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { } } } -impl std::fmt::Display for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +impl std::fmt::Display for CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +impl std::fmt::Debug for CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { +impl serde::Serialize for CreatePaymentLinkBuilderPaymentIntentDataSetupFutureUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1152,13 +1040,13 @@ impl serde::Serialize for CreatePaymentLinkPaymentIntentDataSetupFutureUsage { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkPaymentMethodCollection { +pub enum CreatePaymentLinkBuilderPaymentMethodCollection { Always, IfRequired, } -impl CreatePaymentLinkPaymentMethodCollection { +impl CreatePaymentLinkBuilderPaymentMethodCollection { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkPaymentMethodCollection::*; + use CreatePaymentLinkBuilderPaymentMethodCollection::*; match self { Always => "always", IfRequired => "if_required", @@ -1166,10 +1054,10 @@ impl CreatePaymentLinkPaymentMethodCollection { } } -impl std::str::FromStr for CreatePaymentLinkPaymentMethodCollection { +impl std::str::FromStr for CreatePaymentLinkBuilderPaymentMethodCollection { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkPaymentMethodCollection::*; + use CreatePaymentLinkBuilderPaymentMethodCollection::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -1177,18 +1065,18 @@ impl std::str::FromStr for CreatePaymentLinkPaymentMethodCollection { } } } -impl std::fmt::Display for CreatePaymentLinkPaymentMethodCollection { +impl std::fmt::Display for CreatePaymentLinkBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkPaymentMethodCollection { +impl std::fmt::Debug for CreatePaymentLinkBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkPaymentMethodCollection { +impl serde::Serialize for CreatePaymentLinkBuilderPaymentMethodCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1200,26 +1088,27 @@ impl serde::Serialize for CreatePaymentLinkPaymentMethodCollection { /// /// We recommend that you review your privacy policy and check with your legal contacts. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkPhoneNumberCollection { +pub struct CreatePaymentLinkBuilderPhoneNumberCollection { /// Set to `true` to enable phone number collection. pub enabled: bool, } -impl CreatePaymentLinkPhoneNumberCollection { +impl CreatePaymentLinkBuilderPhoneNumberCollection { pub fn new(enabled: bool) -> Self { Self { enabled } } } /// Configuration for collecting the customer's shipping address. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkShippingAddressCollection<'a> { +pub struct CreatePaymentLinkBuilderShippingAddressCollection<'a> { /// An array of two-letter ISO country codes representing which countries Checkout should provide as options for. /// shipping locations. /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. - pub allowed_countries: &'a [CreatePaymentLinkShippingAddressCollectionAllowedCountries], + pub allowed_countries: + &'a [CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries], } -impl<'a> CreatePaymentLinkShippingAddressCollection<'a> { +impl<'a> CreatePaymentLinkBuilderShippingAddressCollection<'a> { pub fn new( - allowed_countries: &'a [CreatePaymentLinkShippingAddressCollectionAllowedCountries], + allowed_countries: &'a [CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries], ) -> Self { Self { allowed_countries } } @@ -1229,7 +1118,7 @@ impl<'a> CreatePaymentLinkShippingAddressCollection<'a> { /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentLinkShippingAddressCollectionAllowedCountries { +pub enum CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { Ac, Ad, Ae, @@ -1470,9 +1359,9 @@ pub enum CreatePaymentLinkShippingAddressCollectionAllowedCountries { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentLinkShippingAddressCollectionAllowedCountries { +impl CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { pub fn as_str(self) -> &'static str { - use CreatePaymentLinkShippingAddressCollectionAllowedCountries::*; + use CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries::*; match self { Ac => "AC", Ad => "AD", @@ -1716,10 +1605,10 @@ impl CreatePaymentLinkShippingAddressCollectionAllowedCountries { } } -impl std::str::FromStr for CreatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::str::FromStr for CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentLinkShippingAddressCollectionAllowedCountries::*; + use CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries::*; match s { "AC" => Ok(Ac), "AD" => Ok(Ad), @@ -1962,18 +1851,18 @@ impl std::str::FromStr for CreatePaymentLinkShippingAddressCollectionAllowedCoun } } } -impl std::fmt::Display for CreatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::fmt::Display for CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::fmt::Debug for CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentLinkShippingAddressCollectionAllowedCountries { +impl serde::Serialize for CreatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1983,12 +1872,12 @@ impl serde::Serialize for CreatePaymentLinkShippingAddressCollectionAllowedCount } /// The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkShippingOptions<'a> { +pub struct CreatePaymentLinkBuilderShippingOptions<'a> { /// The ID of the Shipping Rate to use for this shipping option. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_rate: Option<&'a str>, } -impl<'a> CreatePaymentLinkShippingOptions<'a> { +impl<'a> CreatePaymentLinkBuilderShippingOptions<'a> { pub fn new() -> Self { Self::default() } @@ -1996,14 +1885,11 @@ impl<'a> CreatePaymentLinkShippingOptions<'a> { /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkSubscriptionData<'a> { +pub struct CreatePaymentLinkBuilderSubscriptionData<'a> { /// The subscription's description, meant to be displayable to the customer. /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, - /// All invoices will be billed using the specified settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link. /// Unlike object-level metadata, this field is declarative. /// Updates will clear prior values. @@ -2013,248 +1899,281 @@ pub struct CreatePaymentLinkSubscriptionData<'a> { /// Has to be at least 1. #[serde(skip_serializing_if = "Option::is_none")] pub trial_period_days: Option, - /// Settings related to subscription trials. - #[serde(skip_serializing_if = "Option::is_none")] - pub trial_settings: Option, } -impl<'a> CreatePaymentLinkSubscriptionData<'a> { +impl<'a> CreatePaymentLinkBuilderSubscriptionData<'a> { pub fn new() -> Self { Self::default() } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkSubscriptionDataInvoiceSettings<'a> { - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, +/// Controls tax ID collection during checkout. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CreatePaymentLinkBuilderTaxIdCollection { + /// Set to `true` to enable tax ID collection. + pub enabled: bool, } -impl<'a> CreatePaymentLinkSubscriptionDataInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() +impl CreatePaymentLinkBuilderTaxIdCollection { + pub fn new(enabled: bool) -> Self { + Self { enabled } } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. +/// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. +pub struct CreatePaymentLinkBuilderTransferData<'a> { + /// The amount that will be transferred automatically when a charge succeeds. #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType, + pub amount: Option, + /// If specified, successful charges will be attributed to the destination + /// account for tax reporting, and the funds from charges will be transferred + /// to the destination account. The ID of the resulting transfer will be + /// returned on the successful charge's `transfer` field. + pub destination: &'a str, } -impl<'a> CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer<'a> { - pub fn new(type_: CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } +impl<'a> CreatePaymentLinkBuilderTransferData<'a> { + pub fn new(destination: &'a str) -> Self { + Self { amount: None, destination } } } -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - Account, - Self_, +/// Creates a payment link. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePaymentLink<'a> { + inner: CreatePaymentLinkBuilder<'a>, } -impl CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } +impl<'a> CreatePaymentLink<'a> { + pub fn new(line_items: &'a [CreatePaymentLinkBuilderLineItems<'a>]) -> Self { + Self { inner: CreatePaymentLinkBuilder::new(line_items) } + } + pub fn after_completion( + mut self, + after_completion: CreatePaymentLinkBuilderAfterCompletion<'a>, + ) -> Self { + self.inner.after_completion = Some(after_completion); + self } -} -impl std::str::FromStr for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } + pub fn allow_promotion_codes(mut self, allow_promotion_codes: bool) -> Self { + self.inner.allow_promotion_codes = Some(allow_promotion_codes); + self } -} -impl std::fmt::Display for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn application_fee_amount(mut self, application_fee_amount: i64) -> Self { + self.inner.application_fee_amount = Some(application_fee_amount); + self } -} -impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn application_fee_percent(mut self, application_fee_percent: f64) -> Self { + self.inner.application_fee_percent = Some(application_fee_percent); + self } -} -impl serde::Serialize for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParams) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self } -} -/// Settings related to subscription trials. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkSubscriptionDataTrialSettings { - /// Defines how the subscription should behave when the user's free trial ends. - pub end_behavior: CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior, -} -impl CreatePaymentLinkSubscriptionDataTrialSettings { - pub fn new(end_behavior: CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior) -> Self { - Self { end_behavior } + + pub fn billing_address_collection( + mut self, + billing_address_collection: stripe_shared::PaymentLinkBillingAddressCollection, + ) -> Self { + self.inner.billing_address_collection = Some(billing_address_collection); + self } -} -/// Defines how the subscription should behave when the user's free trial ends. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior { - /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. - pub missing_payment_method: - CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, -} -impl CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior { - pub fn new( - missing_payment_method: CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, + + pub fn consent_collection( + mut self, + consent_collection: CreatePaymentLinkBuilderConsentCollection, ) -> Self { - Self { missing_payment_method } + self.inner.consent_collection = Some(consent_collection); + self } -} -/// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { - Cancel, - CreateInvoice, - Pause, -} -impl CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; - match self { - Cancel => "cancel", - CreateInvoice => "create_invoice", - Pause => "pause", - } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self } -} -impl std::str::FromStr - for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; - match s { - "cancel" => Ok(Cancel), - "create_invoice" => Ok(CreateInvoice), - "pause" => Ok(Pause), - _ => Err(()), - } + pub fn custom_fields( + mut self, + custom_fields: &'a [CreatePaymentLinkBuilderCustomFields<'a>], + ) -> Self { + self.inner.custom_fields = Some(custom_fields); + self } -} -impl std::fmt::Display - for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn custom_text(mut self, custom_text: CustomTextParam<'a>) -> Self { + self.inner.custom_text = Some(custom_text); + self } -} -impl std::fmt::Debug - for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn customer_creation( + mut self, + customer_creation: CreatePaymentLinkBuilderCustomerCreation, + ) -> Self { + self.inner.customer_creation = Some(customer_creation); + self } -} -impl serde::Serialize - for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -/// Controls tax ID collection during checkout. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkTaxIdCollection { - /// Set to `true` to enable tax ID collection. - pub enabled: bool, -} -impl CreatePaymentLinkTaxIdCollection { - pub fn new(enabled: bool) -> Self { - Self { enabled } + + pub fn invoice_creation( + mut self, + invoice_creation: CreatePaymentLinkBuilderInvoiceCreation<'a>, + ) -> Self { + self.inner.invoice_creation = Some(invoice_creation); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn on_behalf_of(mut self, on_behalf_of: &'a str) -> Self { + self.inner.on_behalf_of = Some(on_behalf_of); + self + } + + pub fn payment_intent_data( + mut self, + payment_intent_data: CreatePaymentLinkBuilderPaymentIntentData<'a>, + ) -> Self { + self.inner.payment_intent_data = Some(payment_intent_data); + self + } + + pub fn payment_method_collection( + mut self, + payment_method_collection: CreatePaymentLinkBuilderPaymentMethodCollection, + ) -> Self { + self.inner.payment_method_collection = Some(payment_method_collection); + self + } + + pub fn payment_method_types( + mut self, + payment_method_types: &'a [stripe_shared::PaymentLinkPaymentMethodTypes], + ) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn phone_number_collection( + mut self, + phone_number_collection: CreatePaymentLinkBuilderPhoneNumberCollection, + ) -> Self { + self.inner.phone_number_collection = Some(phone_number_collection); + self + } + + pub fn shipping_address_collection( + mut self, + shipping_address_collection: CreatePaymentLinkBuilderShippingAddressCollection<'a>, + ) -> Self { + self.inner.shipping_address_collection = Some(shipping_address_collection); + self + } + + pub fn shipping_options( + mut self, + shipping_options: &'a [CreatePaymentLinkBuilderShippingOptions<'a>], + ) -> Self { + self.inner.shipping_options = Some(shipping_options); + self + } + + pub fn submit_type(mut self, submit_type: stripe_shared::PaymentLinkSubmitType) -> Self { + self.inner.submit_type = Some(submit_type); + self + } + + pub fn subscription_data( + mut self, + subscription_data: CreatePaymentLinkBuilderSubscriptionData<'a>, + ) -> Self { + self.inner.subscription_data = Some(subscription_data); + self + } + + pub fn tax_id_collection( + mut self, + tax_id_collection: CreatePaymentLinkBuilderTaxIdCollection, + ) -> Self { + self.inner.tax_id_collection = Some(tax_id_collection); + self + } + + pub fn transfer_data( + mut self, + transfer_data: CreatePaymentLinkBuilderTransferData<'a>, + ) -> Self { + self.inner.transfer_data = Some(transfer_data); + self } } -/// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkTransferData<'a> { - /// The amount that will be transferred automatically when a charge succeeds. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// If specified, successful charges will be attributed to the destination - /// account for tax reporting, and the funds from charges will be transferred - /// to the destination account. The ID of the resulting transfer will be - /// returned on the successful charge's `transfer` field. - pub destination: &'a str, -} -impl<'a> CreatePaymentLinkTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount: None, destination } +impl CreatePaymentLink<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreatePaymentLink<'a> { - /// Creates a payment link. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/payment_links", self, http_types::Method::Post) + +impl StripeRequest for CreatePaymentLink<'_> { + type Output = stripe_shared::PaymentLink; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payment_links").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLink<'a> { +pub struct UpdatePaymentLinkBuilder<'a> { /// Whether the payment link's `url` is active. /// If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, /// Behavior after the purchase is complete. #[serde(skip_serializing_if = "Option::is_none")] - pub after_completion: Option>, + pub after_completion: Option>, /// Enables user redeemable promotion codes. #[serde(skip_serializing_if = "Option::is_none")] pub allow_promotion_codes: Option, /// Configuration for automatic tax collection. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option>, + pub automatic_tax: Option, /// Configuration for collecting the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing_address_collection: Option, /// Collect additional information from your customer using custom fields. - /// Up to 3 fields are supported. + /// Up to 2 fields are supported. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [UpdatePaymentLinkCustomFields<'a>]>, + pub custom_fields: Option<&'a [UpdatePaymentLinkBuilderCustomFields<'a>]>, /// Display additional text for your customers using custom text. #[serde(skip_serializing_if = "Option::is_none")] pub custom_text: Option>, /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[serde(skip_serializing_if = "Option::is_none")] - pub customer_creation: Option, + pub customer_creation: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The custom message to be displayed to a customer when a payment link is no longer active. - #[serde(skip_serializing_if = "Option::is_none")] - pub inactive_message: Option<&'a str>, /// Generate a post-purchase Invoice for one-time payments. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_creation: Option>, + pub invoice_creation: Option>, /// The line items representing what is being sold. /// Each line item represents an item being sold. /// Up to 20 line items are supported. #[serde(skip_serializing_if = "Option::is_none")] - pub line_items: Option<&'a [UpdatePaymentLinkLineItems<'a>]>, + pub line_items: Option<&'a [UpdatePaymentLinkBuilderLineItems<'a>]>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -2264,7 +2183,7 @@ pub struct UpdatePaymentLink<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_intent_data: Option>, + pub payment_intent_data: Option>, /// Specify whether Checkout should collect a payment method. /// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount. /// @@ -2272,30 +2191,27 @@ pub struct UpdatePaymentLink<'a> { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_collection: Option, + pub payment_method_collection: Option, /// The list of payment method types that customers can use. /// Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). #[serde(skip_serializing_if = "Option::is_none")] pub payment_method_types: Option<&'a [stripe_shared::PaymentLinkPaymentMethodTypes]>, - /// Settings that restrict the usage of a payment link. - #[serde(skip_serializing_if = "Option::is_none")] - pub restrictions: Option, /// Configuration for collecting the customer's shipping address. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address_collection: Option>, + pub shipping_address_collection: Option>, /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_data: Option>, + pub subscription_data: Option>, } -impl<'a> UpdatePaymentLink<'a> { +impl<'a> UpdatePaymentLinkBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Behavior after the purchase is complete. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkAfterCompletion<'a> { +pub struct UpdatePaymentLinkBuilderAfterCompletion<'a> { /// Configuration when `type=hosted_confirmation`. #[serde(skip_serializing_if = "Option::is_none")] pub hosted_confirmation: Option>, @@ -2304,22 +2220,22 @@ pub struct UpdatePaymentLinkAfterCompletion<'a> { pub redirect: Option>, /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[serde(rename = "type")] - pub type_: UpdatePaymentLinkAfterCompletionType, + pub type_: UpdatePaymentLinkBuilderAfterCompletionType, } -impl<'a> UpdatePaymentLinkAfterCompletion<'a> { - pub fn new(type_: UpdatePaymentLinkAfterCompletionType) -> Self { +impl<'a> UpdatePaymentLinkBuilderAfterCompletion<'a> { + pub fn new(type_: UpdatePaymentLinkBuilderAfterCompletionType) -> Self { Self { hosted_confirmation: None, redirect: None, type_ } } } /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkAfterCompletionType { +pub enum UpdatePaymentLinkBuilderAfterCompletionType { HostedConfirmation, Redirect, } -impl UpdatePaymentLinkAfterCompletionType { +impl UpdatePaymentLinkBuilderAfterCompletionType { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkAfterCompletionType::*; + use UpdatePaymentLinkBuilderAfterCompletionType::*; match self { HostedConfirmation => "hosted_confirmation", Redirect => "redirect", @@ -2327,10 +2243,10 @@ impl UpdatePaymentLinkAfterCompletionType { } } -impl std::str::FromStr for UpdatePaymentLinkAfterCompletionType { +impl std::str::FromStr for UpdatePaymentLinkBuilderAfterCompletionType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkAfterCompletionType::*; + use UpdatePaymentLinkBuilderAfterCompletionType::*; match s { "hosted_confirmation" => Ok(HostedConfirmation), "redirect" => Ok(Redirect), @@ -2338,97 +2254,18 @@ impl std::str::FromStr for UpdatePaymentLinkAfterCompletionType { } } } -impl std::fmt::Display for UpdatePaymentLinkAfterCompletionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentLinkAfterCompletionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentLinkAfterCompletionType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Configuration for automatic tax collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkAutomaticTax<'a> { - /// If `true`, tax will be calculated automatically using the customer's location. - pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - #[serde(skip_serializing_if = "Option::is_none")] - pub liability: Option>, -} -impl<'a> UpdatePaymentLinkAutomaticTax<'a> { - pub fn new(enabled: bool) -> Self { - Self { enabled, liability: None } - } -} -/// The account that's liable for tax. -/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. -/// The tax transaction is returned in the report of the connected account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkAutomaticTaxLiability<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdatePaymentLinkAutomaticTaxLiabilityType, -} -impl<'a> UpdatePaymentLinkAutomaticTaxLiability<'a> { - pub fn new(type_: UpdatePaymentLinkAutomaticTaxLiabilityType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkAutomaticTaxLiabilityType { - Account, - Self_, -} -impl UpdatePaymentLinkAutomaticTaxLiabilityType { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkAutomaticTaxLiabilityType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdatePaymentLinkAutomaticTaxLiabilityType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkAutomaticTaxLiabilityType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentLinkAutomaticTaxLiabilityType { +impl std::fmt::Display for UpdatePaymentLinkBuilderAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkAutomaticTaxLiabilityType { +impl std::fmt::Debug for UpdatePaymentLinkBuilderAfterCompletionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkAutomaticTaxLiabilityType { +impl serde::Serialize for UpdatePaymentLinkBuilderAfterCompletionType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2437,9 +2274,9 @@ impl serde::Serialize for UpdatePaymentLinkAutomaticTaxLiabilityType { } } /// Collect additional information from your customer using custom fields. -/// Up to 3 fields are supported. +/// Up to 2 fields are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFields<'a> { +pub struct UpdatePaymentLinkBuilderCustomFields<'a> { /// Configuration for `type=dropdown` fields. #[serde(skip_serializing_if = "Option::is_none")] pub dropdown: Option>, @@ -2447,80 +2284,80 @@ pub struct UpdatePaymentLinkCustomFields<'a> { /// Must be unique to this field, alphanumeric, and up to 200 characters. pub key: &'a str, /// The label for the field, displayed to the customer. - pub label: UpdatePaymentLinkCustomFieldsLabel<'a>, + pub label: UpdatePaymentLinkBuilderCustomFieldsLabel<'a>, /// Configuration for `type=numeric` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub numeric: Option, + pub numeric: Option, /// Whether the customer is required to complete the field before completing the Checkout Session. /// Defaults to `false`. #[serde(skip_serializing_if = "Option::is_none")] pub optional: Option, /// Configuration for `type=text` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, + pub text: Option, /// The type of the field. #[serde(rename = "type")] - pub type_: UpdatePaymentLinkCustomFieldsType, + pub type_: UpdatePaymentLinkBuilderCustomFieldsType, } -impl<'a> UpdatePaymentLinkCustomFields<'a> { +impl<'a> UpdatePaymentLinkBuilderCustomFields<'a> { pub fn new( key: &'a str, - label: UpdatePaymentLinkCustomFieldsLabel<'a>, - type_: UpdatePaymentLinkCustomFieldsType, + label: UpdatePaymentLinkBuilderCustomFieldsLabel<'a>, + type_: UpdatePaymentLinkBuilderCustomFieldsType, ) -> Self { Self { dropdown: None, key, label, numeric: None, optional: None, text: None, type_ } } } /// The label for the field, displayed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFieldsLabel<'a> { +pub struct UpdatePaymentLinkBuilderCustomFieldsLabel<'a> { /// Custom text for the label, displayed to the customer. Up to 50 characters. pub custom: &'a str, /// The type of the label. #[serde(rename = "type")] - pub type_: UpdatePaymentLinkCustomFieldsLabelType, + pub type_: UpdatePaymentLinkBuilderCustomFieldsLabelType, } -impl<'a> UpdatePaymentLinkCustomFieldsLabel<'a> { - pub fn new(custom: &'a str, type_: UpdatePaymentLinkCustomFieldsLabelType) -> Self { +impl<'a> UpdatePaymentLinkBuilderCustomFieldsLabel<'a> { + pub fn new(custom: &'a str, type_: UpdatePaymentLinkBuilderCustomFieldsLabelType) -> Self { Self { custom, type_ } } } /// The type of the label. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkCustomFieldsLabelType { +pub enum UpdatePaymentLinkBuilderCustomFieldsLabelType { Custom, } -impl UpdatePaymentLinkCustomFieldsLabelType { +impl UpdatePaymentLinkBuilderCustomFieldsLabelType { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkCustomFieldsLabelType::*; + use UpdatePaymentLinkBuilderCustomFieldsLabelType::*; match self { Custom => "custom", } } } -impl std::str::FromStr for UpdatePaymentLinkCustomFieldsLabelType { +impl std::str::FromStr for UpdatePaymentLinkBuilderCustomFieldsLabelType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkCustomFieldsLabelType::*; + use UpdatePaymentLinkBuilderCustomFieldsLabelType::*; match s { "custom" => Ok(Custom), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentLinkCustomFieldsLabelType { +impl std::fmt::Display for UpdatePaymentLinkBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsLabelType { +impl std::fmt::Debug for UpdatePaymentLinkBuilderCustomFieldsLabelType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkCustomFieldsLabelType { +impl serde::Serialize for UpdatePaymentLinkBuilderCustomFieldsLabelType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2530,7 +2367,7 @@ impl serde::Serialize for UpdatePaymentLinkCustomFieldsLabelType { } /// Configuration for `type=numeric` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFieldsNumeric { +pub struct UpdatePaymentLinkBuilderCustomFieldsNumeric { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -2538,14 +2375,14 @@ pub struct UpdatePaymentLinkCustomFieldsNumeric { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl UpdatePaymentLinkCustomFieldsNumeric { +impl UpdatePaymentLinkBuilderCustomFieldsNumeric { pub fn new() -> Self { Self::default() } } /// Configuration for `type=text` fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFieldsText { +pub struct UpdatePaymentLinkBuilderCustomFieldsText { /// The maximum character length constraint for the customer's input. #[serde(skip_serializing_if = "Option::is_none")] pub maximum_length: Option, @@ -2553,21 +2390,21 @@ pub struct UpdatePaymentLinkCustomFieldsText { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_length: Option, } -impl UpdatePaymentLinkCustomFieldsText { +impl UpdatePaymentLinkBuilderCustomFieldsText { pub fn new() -> Self { Self::default() } } /// The type of the field. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkCustomFieldsType { +pub enum UpdatePaymentLinkBuilderCustomFieldsType { Dropdown, Numeric, Text, } -impl UpdatePaymentLinkCustomFieldsType { +impl UpdatePaymentLinkBuilderCustomFieldsType { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkCustomFieldsType::*; + use UpdatePaymentLinkBuilderCustomFieldsType::*; match self { Dropdown => "dropdown", Numeric => "numeric", @@ -2576,10 +2413,10 @@ impl UpdatePaymentLinkCustomFieldsType { } } -impl std::str::FromStr for UpdatePaymentLinkCustomFieldsType { +impl std::str::FromStr for UpdatePaymentLinkBuilderCustomFieldsType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkCustomFieldsType::*; + use UpdatePaymentLinkBuilderCustomFieldsType::*; match s { "dropdown" => Ok(Dropdown), "numeric" => Ok(Numeric), @@ -2588,18 +2425,18 @@ impl std::str::FromStr for UpdatePaymentLinkCustomFieldsType { } } } -impl std::fmt::Display for UpdatePaymentLinkCustomFieldsType { +impl std::fmt::Display for UpdatePaymentLinkBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsType { +impl std::fmt::Debug for UpdatePaymentLinkBuilderCustomFieldsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkCustomFieldsType { +impl serde::Serialize for UpdatePaymentLinkBuilderCustomFieldsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2609,13 +2446,13 @@ impl serde::Serialize for UpdatePaymentLinkCustomFieldsType { } /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkCustomerCreation { +pub enum UpdatePaymentLinkBuilderCustomerCreation { Always, IfRequired, } -impl UpdatePaymentLinkCustomerCreation { +impl UpdatePaymentLinkBuilderCustomerCreation { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkCustomerCreation::*; + use UpdatePaymentLinkBuilderCustomerCreation::*; match self { Always => "always", IfRequired => "if_required", @@ -2623,10 +2460,10 @@ impl UpdatePaymentLinkCustomerCreation { } } -impl std::str::FromStr for UpdatePaymentLinkCustomerCreation { +impl std::str::FromStr for UpdatePaymentLinkBuilderCustomerCreation { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkCustomerCreation::*; + use UpdatePaymentLinkBuilderCustomerCreation::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -2634,18 +2471,18 @@ impl std::str::FromStr for UpdatePaymentLinkCustomerCreation { } } } -impl std::fmt::Display for UpdatePaymentLinkCustomerCreation { +impl std::fmt::Display for UpdatePaymentLinkBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkCustomerCreation { +impl std::fmt::Debug for UpdatePaymentLinkBuilderCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkCustomerCreation { +impl serde::Serialize for UpdatePaymentLinkBuilderCustomerCreation { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2655,21 +2492,21 @@ impl serde::Serialize for UpdatePaymentLinkCustomerCreation { } /// Generate a post-purchase Invoice for one-time payments. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkInvoiceCreation<'a> { +pub struct UpdatePaymentLinkBuilderInvoiceCreation<'a> { /// Whether the feature is enabled pub enabled: bool, /// Invoice PDF configuration. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_data: Option>, + pub invoice_data: Option>, } -impl<'a> UpdatePaymentLinkInvoiceCreation<'a> { +impl<'a> UpdatePaymentLinkBuilderInvoiceCreation<'a> { pub fn new(enabled: bool) -> Self { Self { enabled, invoice_data: None } } } /// Invoice PDF configuration. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { +pub struct UpdatePaymentLinkBuilderInvoiceCreationInvoiceData<'a> { /// The account tax IDs associated with the invoice. #[serde(skip_serializing_if = "Option::is_none")] pub account_tax_ids: Option<&'a [&'a str]>, @@ -2682,10 +2519,6 @@ pub struct UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { /// Default footer to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<&'a str>, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -2694,87 +2527,26 @@ pub struct UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Default options for invoice PDF rendering for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub rendering_options: Option, + pub rendering_options: + Option, } -impl<'a> UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { +impl<'a> UpdatePaymentLinkBuilderInvoiceCreationInvoiceData<'a> { pub fn new() -> Self { Self::default() } } -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType, -} -impl<'a> UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer<'a> { - pub fn new(type_: UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType) -> Self { - Self { account: None, type_ } - } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - Account, - Self_, -} -impl UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { +pub struct UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptions { /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. /// One of `exclude_tax` or `include_inclusive_tax`. /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[serde(skip_serializing_if = "Option::is_none")] pub amount_tax_display: - Option, + Option, } -impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { +impl UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptions { pub fn new() -> Self { Self::default() } @@ -2784,13 +2556,13 @@ impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +pub enum UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { ExcludeTax, IncludeInclusiveTax, } -impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { +impl UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match self { ExcludeTax => "exclude_tax", IncludeInclusiveTax => "include_inclusive_tax", @@ -2799,11 +2571,11 @@ impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay } impl std::str::FromStr - for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; + use UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*; match s { "exclude_tax" => Ok(ExcludeTax), "include_inclusive_tax" => Ok(IncludeInclusiveTax), @@ -2812,7 +2584,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -2820,14 +2592,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay + for UpdatePaymentLinkBuilderInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay { fn serialize(&self, serializer: S) -> Result where @@ -2840,7 +2612,7 @@ impl serde::Serialize /// Each line item represents an item being sold. /// Up to 20 line items are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkLineItems<'a> { +pub struct UpdatePaymentLinkBuilderLineItems<'a> { /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. #[serde(skip_serializing_if = "Option::is_none")] pub adjustable_quantity: Option, @@ -2850,14 +2622,14 @@ pub struct UpdatePaymentLinkLineItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, } -impl<'a> UpdatePaymentLinkLineItems<'a> { +impl<'a> UpdatePaymentLinkBuilderLineItems<'a> { pub fn new(id: &'a str) -> Self { Self { adjustable_quantity: None, id, quantity: None } } } /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkPaymentIntentData<'a> { +pub struct UpdatePaymentLinkBuilderPaymentIntentData<'a> { /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -2875,12 +2647,8 @@ pub struct UpdatePaymentLinkPaymentIntentData<'a> { /// Maximum 22 characters for the concatenated descriptor. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_suffix: Option<&'a str>, - /// A string that identifies the resulting payment as part of a group. - /// See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_group: Option<&'a str>, } -impl<'a> UpdatePaymentLinkPaymentIntentData<'a> { +impl<'a> UpdatePaymentLinkBuilderPaymentIntentData<'a> { pub fn new() -> Self { Self::default() } @@ -2892,13 +2660,13 @@ impl<'a> UpdatePaymentLinkPaymentIntentData<'a> { /// /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkPaymentMethodCollection { +pub enum UpdatePaymentLinkBuilderPaymentMethodCollection { Always, IfRequired, } -impl UpdatePaymentLinkPaymentMethodCollection { +impl UpdatePaymentLinkBuilderPaymentMethodCollection { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkPaymentMethodCollection::*; + use UpdatePaymentLinkBuilderPaymentMethodCollection::*; match self { Always => "always", IfRequired => "if_required", @@ -2906,10 +2674,10 @@ impl UpdatePaymentLinkPaymentMethodCollection { } } -impl std::str::FromStr for UpdatePaymentLinkPaymentMethodCollection { +impl std::str::FromStr for UpdatePaymentLinkBuilderPaymentMethodCollection { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkPaymentMethodCollection::*; + use UpdatePaymentLinkBuilderPaymentMethodCollection::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -2917,18 +2685,18 @@ impl std::str::FromStr for UpdatePaymentLinkPaymentMethodCollection { } } } -impl std::fmt::Display for UpdatePaymentLinkPaymentMethodCollection { +impl std::fmt::Display for UpdatePaymentLinkBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkPaymentMethodCollection { +impl std::fmt::Debug for UpdatePaymentLinkBuilderPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkPaymentMethodCollection { +impl serde::Serialize for UpdatePaymentLinkBuilderPaymentMethodCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2938,15 +2706,16 @@ impl serde::Serialize for UpdatePaymentLinkPaymentMethodCollection { } /// Configuration for collecting the customer's shipping address. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkShippingAddressCollection<'a> { +pub struct UpdatePaymentLinkBuilderShippingAddressCollection<'a> { /// An array of two-letter ISO country codes representing which countries Checkout should provide as options for. /// shipping locations. /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. - pub allowed_countries: &'a [UpdatePaymentLinkShippingAddressCollectionAllowedCountries], + pub allowed_countries: + &'a [UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries], } -impl<'a> UpdatePaymentLinkShippingAddressCollection<'a> { +impl<'a> UpdatePaymentLinkBuilderShippingAddressCollection<'a> { pub fn new( - allowed_countries: &'a [UpdatePaymentLinkShippingAddressCollectionAllowedCountries], + allowed_countries: &'a [UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries], ) -> Self { Self { allowed_countries } } @@ -2956,7 +2725,7 @@ impl<'a> UpdatePaymentLinkShippingAddressCollection<'a> { /// Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +pub enum UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { Ac, Ad, Ae, @@ -3197,9 +2966,9 @@ pub enum UpdatePaymentLinkShippingAddressCollectionAllowedCountries { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +impl UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkShippingAddressCollectionAllowedCountries::*; + use UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries::*; match self { Ac => "AC", Ad => "AD", @@ -3443,10 +3212,10 @@ impl UpdatePaymentLinkShippingAddressCollectionAllowedCountries { } } -impl std::str::FromStr for UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::str::FromStr for UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentLinkShippingAddressCollectionAllowedCountries::*; + use UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries::*; match s { "AC" => Ok(Ac), "AD" => Ok(Ad), @@ -3689,18 +3458,18 @@ impl std::str::FromStr for UpdatePaymentLinkShippingAddressCollectionAllowedCoun } } } -impl std::fmt::Display for UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::fmt::Display for UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +impl std::fmt::Debug for UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentLinkShippingAddressCollectionAllowedCountries { +impl serde::Serialize for UpdatePaymentLinkBuilderShippingAddressCollectionAllowedCountries { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3711,191 +3480,169 @@ impl serde::Serialize for UpdatePaymentLinkShippingAddressCollectionAllowedCount /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkSubscriptionData<'a> { - /// All invoices will be billed using the specified settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option>, +pub struct UpdatePaymentLinkBuilderSubscriptionData<'a> { /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link. /// Unlike object-level metadata, this field is declarative. /// Updates will clear prior values. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, - /// Settings related to subscription trials. - #[serde(skip_serializing_if = "Option::is_none")] - pub trial_settings: Option, } -impl<'a> UpdatePaymentLinkSubscriptionData<'a> { +impl<'a> UpdatePaymentLinkBuilderSubscriptionData<'a> { pub fn new() -> Self { Self::default() } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkSubscriptionDataInvoiceSettings<'a> { - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - #[serde(skip_serializing_if = "Option::is_none")] - pub issuer: Option>, +/// Updates a payment link. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePaymentLink<'a> { + inner: UpdatePaymentLinkBuilder<'a>, + payment_link: &'a stripe_shared::PaymentLinkId, } -impl<'a> UpdatePaymentLinkSubscriptionDataInvoiceSettings<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> UpdatePaymentLink<'a> { + pub fn new(payment_link: &'a stripe_shared::PaymentLinkId) -> Self { + Self { payment_link, inner: UpdatePaymentLinkBuilder::new() } } -} -/// The connected account that issues the invoice. -/// The invoice is presented with the branding and support information of the specified account. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer<'a> { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option<&'a str>, - /// Type of the account referenced in the request. - #[serde(rename = "type")] - pub type_: UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType, -} -impl<'a> UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer<'a> { - pub fn new(type_: UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType) -> Self { - Self { account: None, type_ } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self } -} -/// Type of the account referenced in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - Account, - Self_, -} -impl UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*; - match self { - Account => "account", - Self_ => "self", - } + + pub fn after_completion( + mut self, + after_completion: UpdatePaymentLinkBuilderAfterCompletion<'a>, + ) -> Self { + self.inner.after_completion = Some(after_completion); + self } -} -impl std::str::FromStr for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } + pub fn allow_promotion_codes(mut self, allow_promotion_codes: bool) -> Self { + self.inner.allow_promotion_codes = Some(allow_promotion_codes); + self } -} -impl std::fmt::Display for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn automatic_tax(mut self, automatic_tax: AutomaticTaxParams) -> Self { + self.inner.automatic_tax = Some(automatic_tax); + self } -} -impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn billing_address_collection( + mut self, + billing_address_collection: stripe_shared::PaymentLinkBillingAddressCollection, + ) -> Self { + self.inner.billing_address_collection = Some(billing_address_collection); + self } -} -impl serde::Serialize for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn custom_fields( + mut self, + custom_fields: &'a [UpdatePaymentLinkBuilderCustomFields<'a>], + ) -> Self { + self.inner.custom_fields = Some(custom_fields); + self } -} -/// Settings related to subscription trials. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkSubscriptionDataTrialSettings { - /// Defines how the subscription should behave when the user's free trial ends. - pub end_behavior: UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior, -} -impl UpdatePaymentLinkSubscriptionDataTrialSettings { - pub fn new(end_behavior: UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior) -> Self { - Self { end_behavior } + + pub fn custom_text(mut self, custom_text: CustomTextParam<'a>) -> Self { + self.inner.custom_text = Some(custom_text); + self } -} -/// Defines how the subscription should behave when the user's free trial ends. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior { - /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. - pub missing_payment_method: - UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, -} -impl UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior { - pub fn new( - missing_payment_method: UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod, + + pub fn customer_creation( + mut self, + customer_creation: UpdatePaymentLinkBuilderCustomerCreation, ) -> Self { - Self { missing_payment_method } + self.inner.customer_creation = Some(customer_creation); + self } -} -/// Indicates how the subscription should change when the trial ends if the user did not provide a payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { - Cancel, - CreateInvoice, - Pause, -} -impl UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; - match self { - Cancel => "cancel", - CreateInvoice => "create_invoice", - Pause => "pause", - } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -impl std::str::FromStr - for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*; - match s { - "cancel" => Ok(Cancel), - "create_invoice" => Ok(CreateInvoice), - "pause" => Ok(Pause), - _ => Err(()), - } + pub fn invoice_creation( + mut self, + invoice_creation: UpdatePaymentLinkBuilderInvoiceCreation<'a>, + ) -> Self { + self.inner.invoice_creation = Some(invoice_creation); + self } -} -impl std::fmt::Display - for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn line_items(mut self, line_items: &'a [UpdatePaymentLinkBuilderLineItems<'a>]) -> Self { + self.inner.line_items = Some(line_items); + self } -} -impl std::fmt::Debug - for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self } -} -impl serde::Serialize - for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn payment_intent_data( + mut self, + payment_intent_data: UpdatePaymentLinkBuilderPaymentIntentData<'a>, + ) -> Self { + self.inner.payment_intent_data = Some(payment_intent_data); + self + } + + pub fn payment_method_collection( + mut self, + payment_method_collection: UpdatePaymentLinkBuilderPaymentMethodCollection, + ) -> Self { + self.inner.payment_method_collection = Some(payment_method_collection); + self + } + + pub fn payment_method_types( + mut self, + payment_method_types: &'a [stripe_shared::PaymentLinkPaymentMethodTypes], + ) -> Self { + self.inner.payment_method_types = Some(payment_method_types); + self + } + + pub fn shipping_address_collection( + mut self, + shipping_address_collection: UpdatePaymentLinkBuilderShippingAddressCollection<'a>, + ) -> Self { + self.inner.shipping_address_collection = Some(shipping_address_collection); + self + } + + pub fn subscription_data( + mut self, + subscription_data: UpdatePaymentLinkBuilderSubscriptionData<'a>, + ) -> Self { + self.inner.subscription_data = Some(subscription_data); + self } } -impl<'a> UpdatePaymentLink<'a> { - /// Updates a payment link. - pub fn send( +impl UpdatePaymentLink<'_> { + pub async fn send( &self, - client: &stripe::Client, - payment_link: &stripe_shared::PaymentLinkId, - ) -> stripe::Response { - client.send_form(&format!("/payment_links/{payment_link}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePaymentLink<'_> { + type Output = stripe_shared::PaymentLink; + + fn build(&self) -> RequestBuilder { + let payment_link = self.payment_link; + RequestBuilder::new(StripeMethod::Post, format!("/payment_links/{payment_link}")) + .form(&self.inner) } } + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct AfterCompletionConfirmationPageParams<'a> { /// A custom message to display to the customer after the purchase is complete. @@ -3919,6 +3666,16 @@ impl<'a> AfterCompletionRedirectParams<'a> { } } #[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParams { + /// If `true`, tax will be calculated automatically using the customer's location. + pub enabled: bool, +} +impl AutomaticTaxParams { + pub fn new(enabled: bool) -> Self { + Self { enabled } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CustomFieldOptionParam<'a> { /// The label for the option, displayed to the customer. Up to 100 characters. pub label: &'a str, @@ -3974,16 +3731,6 @@ impl AdjustableQuantityParams { } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CompletedSessionsParams { - /// The maximum number of checkout sessions that can be completed for the `completed_sessions` restriction to be met. - pub limit: i64, -} -impl CompletedSessionsParams { - pub fn new(limit: i64) -> Self { - Self { limit } - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CustomFieldDropdownParam<'a> { /// The options available for the customer to select. Up to 200 options allowed. pub options: &'a [CustomFieldOptionParam<'a>], @@ -3995,9 +3742,6 @@ impl<'a> CustomFieldDropdownParam<'a> { } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CustomTextParam<'a> { - /// Custom text that should be displayed after the payment confirmation button. - #[serde(skip_serializing_if = "Option::is_none")] - pub after_submit: Option>, /// Custom text that should be displayed alongside shipping address collection. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_address: Option>, @@ -4013,13 +3757,3 @@ impl<'a> CustomTextParam<'a> { Self::default() } } -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct RestrictionsParams { - /// Configuration for the `completed_sessions` restriction type. - pub completed_sessions: CompletedSessionsParams, -} -impl RestrictionsParams { - pub fn new(completed_sessions: CompletedSessionsParams) -> Self { - Self { completed_sessions } - } -} diff --git a/generated/stripe_payment/src/payment_method/requests.rs b/generated/stripe_payment/src/payment_method/requests.rs index 9e1f1f17b..d75b7698e 100644 --- a/generated/stripe_payment/src/payment_method/requests.rs +++ b/generated/stripe_payment/src/payment_method/requests.rs @@ -1,224 +1,12 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentMethod<'a> { - /// The ID of the customer whose PaymentMethods will be retrieved. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// An optional filter on the list, based on the object `type` field. - /// Without the filter, the list includes all current and future payment method types. - /// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -impl<'a> ListPaymentMethod<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An optional filter on the list, based on the object `type` field. -/// Without the filter, the list includes all current and future payment method types. -/// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum ListPaymentMethodType { - AcssDebit, - Affirm, - AfterpayClearpay, - Alipay, - AuBecsDebit, - BacsDebit, - Bancontact, - Blik, - Boleto, - Card, - Cashapp, - CustomerBalance, - Eps, - Fpx, - Giropay, - Grabpay, - Ideal, - Klarna, - Konbini, - Link, - Oxxo, - P24, - Paynow, - Paypal, - Pix, - Promptpay, - RevolutPay, - SepaDebit, - Sofort, - Swish, - UsBankAccount, - WechatPay, - Zip, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl ListPaymentMethodType { - pub fn as_str(self) -> &'static str { - use ListPaymentMethodType::*; - match self { - AcssDebit => "acss_debit", - Affirm => "affirm", - AfterpayClearpay => "afterpay_clearpay", - Alipay => "alipay", - AuBecsDebit => "au_becs_debit", - BacsDebit => "bacs_debit", - Bancontact => "bancontact", - Blik => "blik", - Boleto => "boleto", - Card => "card", - Cashapp => "cashapp", - CustomerBalance => "customer_balance", - Eps => "eps", - Fpx => "fpx", - Giropay => "giropay", - Grabpay => "grabpay", - Ideal => "ideal", - Klarna => "klarna", - Konbini => "konbini", - Link => "link", - Oxxo => "oxxo", - P24 => "p24", - Paynow => "paynow", - Paypal => "paypal", - Pix => "pix", - Promptpay => "promptpay", - RevolutPay => "revolut_pay", - SepaDebit => "sepa_debit", - Sofort => "sofort", - Swish => "swish", - UsBankAccount => "us_bank_account", - WechatPay => "wechat_pay", - Zip => "zip", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for ListPaymentMethodType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListPaymentMethodType::*; - match s { - "acss_debit" => Ok(AcssDebit), - "affirm" => Ok(Affirm), - "afterpay_clearpay" => Ok(AfterpayClearpay), - "alipay" => Ok(Alipay), - "au_becs_debit" => Ok(AuBecsDebit), - "bacs_debit" => Ok(BacsDebit), - "bancontact" => Ok(Bancontact), - "blik" => Ok(Blik), - "boleto" => Ok(Boleto), - "card" => Ok(Card), - "cashapp" => Ok(Cashapp), - "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), - "fpx" => Ok(Fpx), - "giropay" => Ok(Giropay), - "grabpay" => Ok(Grabpay), - "ideal" => Ok(Ideal), - "klarna" => Ok(Klarna), - "konbini" => Ok(Konbini), - "link" => Ok(Link), - "oxxo" => Ok(Oxxo), - "p24" => Ok(P24), - "paynow" => Ok(Paynow), - "paypal" => Ok(Paypal), - "pix" => Ok(Pix), - "promptpay" => Ok(Promptpay), - "revolut_pay" => Ok(RevolutPay), - "sepa_debit" => Ok(SepaDebit), - "sofort" => Ok(Sofort), - "swish" => Ok(Swish), - "us_bank_account" => Ok(UsBankAccount), - "wechat_pay" => Ok(WechatPay), - "zip" => Ok(Zip), - _ => Err(()), - } - } -} -impl std::fmt::Display for ListPaymentMethodType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; -impl std::fmt::Debug for ListPaymentMethodType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListPaymentMethodType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> ListPaymentMethod<'a> { - /// Returns a list of PaymentMethods for Treasury flows. - /// If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer’s PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_methods", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payment_methods", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentMethod<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePaymentMethod<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrievePaymentMethod<'a> { - /// Retrieves a PaymentMethod object attached to the StripeAccount. - /// To retrieve a payment method attached to a Customer, you should use [Retrieve a Customer’s PaymentMethods](https://stripe.com/docs/api/payment_methods/customer). - pub fn send( - &self, - client: &stripe::Client, - payment_method: &stripe_shared::PaymentMethodId, - ) -> stripe::Response { - client.get_query(&format!("/payment_methods/{payment_method}"), self) - } -} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethod<'a> { +pub struct CreatePaymentMethodBuilder<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -230,10 +18,10 @@ pub struct CreatePaymentMethod<'a> { pub alipay: Option<&'a serde_json::Value>, /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option>, + pub au_becs_debit: Option>, /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option>, + pub bacs_debit: Option>, /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method. #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option<&'a serde_json::Value>, @@ -245,13 +33,13 @@ pub struct CreatePaymentMethod<'a> { pub blik: Option<&'a serde_json::Value>, /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option>, + pub boleto: Option>, /// If this is a `card` PaymentMethod, this hash contains the user's card details. /// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`. /// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance). /// We strongly recommend using Stripe.js instead of interacting with this API directly. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option>, + pub card: Option>, /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option<&'a serde_json::Value>, @@ -263,13 +51,13 @@ pub struct CreatePaymentMethod<'a> { pub customer_balance: Option<&'a serde_json::Value>, /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub giropay: Option<&'a serde_json::Value>, @@ -278,13 +66,13 @@ pub struct CreatePaymentMethod<'a> { pub grabpay: Option<&'a serde_json::Value>, /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. #[serde(skip_serializing_if = "Option::is_none")] pub interac_present: Option<&'a serde_json::Value>, /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -302,7 +90,7 @@ pub struct CreatePaymentMethod<'a> { pub oxxo: Option<&'a serde_json::Value>, /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, /// The PaymentMethod to share. #[serde(skip_serializing_if = "Option::is_none")] pub payment_method: Option<&'a str>, @@ -321,28 +109,25 @@ pub struct CreatePaymentMethod<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option>, + pub sepa_debit: Option>, /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option<&'a serde_json::Value>, + pub sofort: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option>, + pub us_bank_account: Option>, /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option<&'a serde_json::Value>, @@ -350,14 +135,14 @@ pub struct CreatePaymentMethod<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub zip: Option<&'a serde_json::Value>, } -impl<'a> CreatePaymentMethod<'a> { +impl<'a> CreatePaymentMethodBuilder<'a> { pub fn new() -> Self { Self::default() } } /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodAcssDebit<'a> { +pub struct CreatePaymentMethodBuilderAcssDebit<'a> { /// Customer's bank account number. pub account_number: &'a str, /// Institution number of the customer's bank. @@ -365,7 +150,7 @@ pub struct CreatePaymentMethodAcssDebit<'a> { /// Transit number of the customer's bank. pub transit_number: &'a str, } -impl<'a> CreatePaymentMethodAcssDebit<'a> { +impl<'a> CreatePaymentMethodBuilderAcssDebit<'a> { pub fn new( account_number: &'a str, institution_number: &'a str, @@ -376,20 +161,20 @@ impl<'a> CreatePaymentMethodAcssDebit<'a> { } /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodAuBecsDebit<'a> { +pub struct CreatePaymentMethodBuilderAuBecsDebit<'a> { /// The account number for the bank account. pub account_number: &'a str, /// Bank-State-Branch number of the bank account. pub bsb_number: &'a str, } -impl<'a> CreatePaymentMethodAuBecsDebit<'a> { +impl<'a> CreatePaymentMethodBuilderAuBecsDebit<'a> { pub fn new(account_number: &'a str, bsb_number: &'a str) -> Self { Self { account_number, bsb_number } } } /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodBacsDebit<'a> { +pub struct CreatePaymentMethodBuilderBacsDebit<'a> { /// Account number of the bank account that the funds will be debited from. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, @@ -397,18 +182,18 @@ pub struct CreatePaymentMethodBacsDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub sort_code: Option<&'a str>, } -impl<'a> CreatePaymentMethodBacsDebit<'a> { +impl<'a> CreatePaymentMethodBuilderBacsDebit<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodBoleto<'a> { +pub struct CreatePaymentMethodBuilderBoleto<'a> { /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers) pub tax_id: &'a str, } -impl<'a> CreatePaymentMethodBoleto<'a> { +impl<'a> CreatePaymentMethodBuilderBoleto<'a> { pub fn new(tax_id: &'a str) -> Self { Self { tax_id } } @@ -419,16 +204,16 @@ impl<'a> CreatePaymentMethodBoleto<'a> { /// We strongly recommend using Stripe.js instead of interacting with this API directly. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePaymentMethodCard<'a> { - CardDetailsParams(CreatePaymentMethodCardDetailsParams<'a>), - TokenParams(CreatePaymentMethodTokenParams<'a>), +pub enum CreatePaymentMethodBuilderCard<'a> { + CardDetailsParams(CreatePaymentMethodBuilderCardDetailsParams<'a>), + TokenParams(CreatePaymentMethodBuilderTokenParams<'a>), } /// If this is a `card` PaymentMethod, this hash contains the user's card details. /// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`. /// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance). /// We strongly recommend using Stripe.js instead of interacting with this API directly. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodCardDetailsParams<'a> { +pub struct CreatePaymentMethodBuilderCardDetailsParams<'a> { /// The card's CVC. It is highly recommended to always include this value. #[serde(skip_serializing_if = "Option::is_none")] pub cvc: Option<&'a str>, @@ -439,7 +224,7 @@ pub struct CreatePaymentMethodCardDetailsParams<'a> { /// The card number, as a string without any separators. pub number: &'a str, } -impl<'a> CreatePaymentMethodCardDetailsParams<'a> { +impl<'a> CreatePaymentMethodBuilderCardDetailsParams<'a> { pub fn new(exp_month: i64, exp_year: i64, number: &'a str) -> Self { Self { cvc: None, exp_month, exp_year, number } } @@ -449,23 +234,23 @@ impl<'a> CreatePaymentMethodCardDetailsParams<'a> { /// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance). /// We strongly recommend using Stripe.js instead of interacting with this API directly. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodTokenParams<'a> { +pub struct CreatePaymentMethodBuilderTokenParams<'a> { /// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format card: {token: "tok_visa"}. pub token: &'a str, } -impl<'a> CreatePaymentMethodTokenParams<'a> { +impl<'a> CreatePaymentMethodBuilderTokenParams<'a> { pub fn new(token: &'a str) -> Self { Self { token } } } /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodEps { +pub struct CreatePaymentMethodBuilderEps { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentMethodEps { +impl CreatePaymentMethodBuilderEps { pub fn new() -> Self { Self::default() } @@ -473,7 +258,7 @@ impl CreatePaymentMethodEps { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentMethodEpsBank { +pub enum CreatePaymentMethodBuilderEpsBank { ArzteUndApothekerBank, AustrianAnadiBankAg, BankAustria, @@ -505,9 +290,9 @@ pub enum CreatePaymentMethodEpsBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentMethodEpsBank { +impl CreatePaymentMethodBuilderEpsBank { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodEpsBank::*; + use CreatePaymentMethodBuilderEpsBank::*; match self { ArzteUndApothekerBank => "arzte_und_apotheker_bank", AustrianAnadiBankAg => "austrian_anadi_bank_ag", @@ -542,10 +327,10 @@ impl CreatePaymentMethodEpsBank { } } -impl std::str::FromStr for CreatePaymentMethodEpsBank { +impl std::str::FromStr for CreatePaymentMethodBuilderEpsBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodEpsBank::*; + use CreatePaymentMethodBuilderEpsBank::*; match s { "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank), "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg), @@ -579,18 +364,18 @@ impl std::str::FromStr for CreatePaymentMethodEpsBank { } } } -impl std::fmt::Display for CreatePaymentMethodEpsBank { +impl std::fmt::Display for CreatePaymentMethodBuilderEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodEpsBank { +impl std::fmt::Debug for CreatePaymentMethodBuilderEpsBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodEpsBank { +impl serde::Serialize for CreatePaymentMethodBuilderEpsBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -600,27 +385,27 @@ impl serde::Serialize for CreatePaymentMethodEpsBank { } /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodFpx { +pub struct CreatePaymentMethodBuilderFpx { /// Account holder type for FPX transaction #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// The customer's bank. - pub bank: CreatePaymentMethodFpxBank, + pub bank: CreatePaymentMethodBuilderFpxBank, } -impl CreatePaymentMethodFpx { - pub fn new(bank: CreatePaymentMethodFpxBank) -> Self { +impl CreatePaymentMethodBuilderFpx { + pub fn new(bank: CreatePaymentMethodBuilderFpxBank) -> Self { Self { account_holder_type: None, bank } } } /// Account holder type for FPX transaction #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodFpxAccountHolderType { +pub enum CreatePaymentMethodBuilderFpxAccountHolderType { Company, Individual, } -impl CreatePaymentMethodFpxAccountHolderType { +impl CreatePaymentMethodBuilderFpxAccountHolderType { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodFpxAccountHolderType::*; + use CreatePaymentMethodBuilderFpxAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -628,10 +413,10 @@ impl CreatePaymentMethodFpxAccountHolderType { } } -impl std::str::FromStr for CreatePaymentMethodFpxAccountHolderType { +impl std::str::FromStr for CreatePaymentMethodBuilderFpxAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodFpxAccountHolderType::*; + use CreatePaymentMethodBuilderFpxAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -639,18 +424,18 @@ impl std::str::FromStr for CreatePaymentMethodFpxAccountHolderType { } } } -impl std::fmt::Display for CreatePaymentMethodFpxAccountHolderType { +impl std::fmt::Display for CreatePaymentMethodBuilderFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodFpxAccountHolderType { +impl std::fmt::Debug for CreatePaymentMethodBuilderFpxAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodFpxAccountHolderType { +impl serde::Serialize for CreatePaymentMethodBuilderFpxAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -661,7 +446,7 @@ impl serde::Serialize for CreatePaymentMethodFpxAccountHolderType { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentMethodFpxBank { +pub enum CreatePaymentMethodBuilderFpxBank { AffinBank, Agrobank, AllianceBank, @@ -687,9 +472,9 @@ pub enum CreatePaymentMethodFpxBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentMethodFpxBank { +impl CreatePaymentMethodBuilderFpxBank { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodFpxBank::*; + use CreatePaymentMethodBuilderFpxBank::*; match self { AffinBank => "affin_bank", Agrobank => "agrobank", @@ -718,10 +503,10 @@ impl CreatePaymentMethodFpxBank { } } -impl std::str::FromStr for CreatePaymentMethodFpxBank { +impl std::str::FromStr for CreatePaymentMethodBuilderFpxBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodFpxBank::*; + use CreatePaymentMethodBuilderFpxBank::*; match s { "affin_bank" => Ok(AffinBank), "agrobank" => Ok(Agrobank), @@ -749,18 +534,18 @@ impl std::str::FromStr for CreatePaymentMethodFpxBank { } } } -impl std::fmt::Display for CreatePaymentMethodFpxBank { +impl std::fmt::Display for CreatePaymentMethodBuilderFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodFpxBank { +impl std::fmt::Debug for CreatePaymentMethodBuilderFpxBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodFpxBank { +impl serde::Serialize for CreatePaymentMethodBuilderFpxBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -770,12 +555,12 @@ impl serde::Serialize for CreatePaymentMethodFpxBank { } /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodIdeal { +pub struct CreatePaymentMethodBuilderIdeal { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentMethodIdeal { +impl CreatePaymentMethodBuilderIdeal { pub fn new() -> Self { Self::default() } @@ -783,7 +568,7 @@ impl CreatePaymentMethodIdeal { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentMethodIdealBank { +pub enum CreatePaymentMethodBuilderIdealBank { AbnAmro, AsnBank, Bunq, @@ -792,7 +577,6 @@ pub enum CreatePaymentMethodIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -803,9 +587,9 @@ pub enum CreatePaymentMethodIdealBank { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentMethodIdealBank { +impl CreatePaymentMethodBuilderIdealBank { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodIdealBank::*; + use CreatePaymentMethodBuilderIdealBank::*; match self { AbnAmro => "abn_amro", AsnBank => "asn_bank", @@ -815,7 +599,6 @@ impl CreatePaymentMethodIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -828,10 +611,10 @@ impl CreatePaymentMethodIdealBank { } } -impl std::str::FromStr for CreatePaymentMethodIdealBank { +impl std::str::FromStr for CreatePaymentMethodBuilderIdealBank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodIdealBank::*; + use CreatePaymentMethodBuilderIdealBank::*; match s { "abn_amro" => Ok(AbnAmro), "asn_bank" => Ok(AsnBank), @@ -841,7 +624,6 @@ impl std::str::FromStr for CreatePaymentMethodIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -853,18 +635,18 @@ impl std::str::FromStr for CreatePaymentMethodIdealBank { } } } -impl std::fmt::Display for CreatePaymentMethodIdealBank { +impl std::fmt::Display for CreatePaymentMethodBuilderIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodIdealBank { +impl std::fmt::Debug for CreatePaymentMethodBuilderIdealBank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodIdealBank { +impl serde::Serialize for CreatePaymentMethodBuilderIdealBank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -874,19 +656,19 @@ impl serde::Serialize for CreatePaymentMethodIdealBank { } /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodKlarna { +pub struct CreatePaymentMethodBuilderKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } -impl CreatePaymentMethodKlarna { +impl CreatePaymentMethodBuilderKlarna { pub fn new() -> Self { Self::default() } } /// Customer's date of birth #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodKlarnaDob { +pub struct CreatePaymentMethodBuilderKlarnaDob { /// The day of birth, between 1 and 31. pub day: i64, /// The month of birth, between 1 and 12. @@ -894,19 +676,19 @@ pub struct CreatePaymentMethodKlarnaDob { /// The four-digit year of birth. pub year: i64, } -impl CreatePaymentMethodKlarnaDob { +impl CreatePaymentMethodBuilderKlarnaDob { pub fn new(day: i64, month: i64, year: i64) -> Self { Self { day, month, year } } } /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodP24 { +pub struct CreatePaymentMethodBuilderP24 { /// The customer's bank. #[serde(skip_serializing_if = "Option::is_none")] - pub bank: Option, + pub bank: Option, } -impl CreatePaymentMethodP24 { +impl CreatePaymentMethodBuilderP24 { pub fn new() -> Self { Self::default() } @@ -914,7 +696,7 @@ impl CreatePaymentMethodP24 { /// The customer's bank. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentMethodP24Bank { +pub enum CreatePaymentMethodBuilderP24Bank { AliorBank, BankMillennium, BankNowyBfgSa, @@ -939,14 +721,13 @@ pub enum CreatePaymentMethodP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentMethodP24Bank { +impl CreatePaymentMethodBuilderP24Bank { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodP24Bank::*; + use CreatePaymentMethodBuilderP24Bank::*; match self { AliorBank => "alior_bank", BankMillennium => "bank_millennium", @@ -972,17 +753,16 @@ impl CreatePaymentMethodP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } } } -impl std::str::FromStr for CreatePaymentMethodP24Bank { +impl std::str::FromStr for CreatePaymentMethodBuilderP24Bank { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodP24Bank::*; + use CreatePaymentMethodBuilderP24Bank::*; match s { "alior_bank" => Ok(AliorBank), "bank_millennium" => Ok(BankMillennium), @@ -1008,24 +788,23 @@ impl std::str::FromStr for CreatePaymentMethodP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } } } -impl std::fmt::Display for CreatePaymentMethodP24Bank { +impl std::fmt::Display for CreatePaymentMethodBuilderP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodP24Bank { +impl std::fmt::Debug for CreatePaymentMethodBuilderP24Bank { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodP24Bank { +impl serde::Serialize for CreatePaymentMethodBuilderP24Bank { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1036,41 +815,41 @@ impl serde::Serialize for CreatePaymentMethodP24Bank { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodRadarOptions<'a> { +pub struct CreatePaymentMethodBuilderRadarOptions<'a> { /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option<&'a str>, } -impl<'a> CreatePaymentMethodRadarOptions<'a> { +impl<'a> CreatePaymentMethodBuilderRadarOptions<'a> { pub fn new() -> Self { Self::default() } } /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodSepaDebit<'a> { +pub struct CreatePaymentMethodBuilderSepaDebit<'a> { /// IBAN of the bank account. pub iban: &'a str, } -impl<'a> CreatePaymentMethodSepaDebit<'a> { +impl<'a> CreatePaymentMethodBuilderSepaDebit<'a> { pub fn new(iban: &'a str) -> Self { Self { iban } } } /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodSofort { +pub struct CreatePaymentMethodBuilderSofort { /// Two-letter ISO code representing the country the bank account is located in. - pub country: CreatePaymentMethodSofortCountry, + pub country: CreatePaymentMethodBuilderSofortCountry, } -impl CreatePaymentMethodSofort { - pub fn new(country: CreatePaymentMethodSofortCountry) -> Self { +impl CreatePaymentMethodBuilderSofort { + pub fn new(country: CreatePaymentMethodBuilderSofortCountry) -> Self { Self { country } } } /// Two-letter ISO code representing the country the bank account is located in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodSofortCountry { +pub enum CreatePaymentMethodBuilderSofortCountry { At, Be, De, @@ -1078,9 +857,9 @@ pub enum CreatePaymentMethodSofortCountry { It, Nl, } -impl CreatePaymentMethodSofortCountry { +impl CreatePaymentMethodBuilderSofortCountry { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodSofortCountry::*; + use CreatePaymentMethodBuilderSofortCountry::*; match self { At => "AT", Be => "BE", @@ -1092,10 +871,10 @@ impl CreatePaymentMethodSofortCountry { } } -impl std::str::FromStr for CreatePaymentMethodSofortCountry { +impl std::str::FromStr for CreatePaymentMethodBuilderSofortCountry { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodSofortCountry::*; + use CreatePaymentMethodBuilderSofortCountry::*; match s { "AT" => Ok(At), "BE" => Ok(Be), @@ -1107,18 +886,18 @@ impl std::str::FromStr for CreatePaymentMethodSofortCountry { } } } -impl std::fmt::Display for CreatePaymentMethodSofortCountry { +impl std::fmt::Display for CreatePaymentMethodBuilderSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodSofortCountry { +impl std::fmt::Debug for CreatePaymentMethodBuilderSofortCountry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodSofortCountry { +impl serde::Serialize for CreatePaymentMethodBuilderSofortCountry { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1131,7 +910,7 @@ impl serde::Serialize for CreatePaymentMethodSofortCountry { /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum CreatePaymentMethodType { +pub enum CreatePaymentMethodBuilderType { AcssDebit, Affirm, AfterpayClearpay, @@ -1161,16 +940,15 @@ pub enum CreatePaymentMethodType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl CreatePaymentMethodType { +impl CreatePaymentMethodBuilderType { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodType::*; + use CreatePaymentMethodBuilderType::*; match self { AcssDebit => "acss_debit", Affirm => "affirm", @@ -1201,7 +979,6 @@ impl CreatePaymentMethodType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -1210,10 +987,10 @@ impl CreatePaymentMethodType { } } -impl std::str::FromStr for CreatePaymentMethodType { +impl std::str::FromStr for CreatePaymentMethodBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodType::*; + use CreatePaymentMethodBuilderType::*; match s { "acss_debit" => Ok(AcssDebit), "affirm" => Ok(Affirm), @@ -1244,7 +1021,6 @@ impl std::str::FromStr for CreatePaymentMethodType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), @@ -1252,18 +1028,18 @@ impl std::str::FromStr for CreatePaymentMethodType { } } } -impl std::fmt::Display for CreatePaymentMethodType { +impl std::fmt::Display for CreatePaymentMethodBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodType { +impl std::fmt::Debug for CreatePaymentMethodBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodType { +impl serde::Serialize for CreatePaymentMethodBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1273,16 +1049,16 @@ impl serde::Serialize for CreatePaymentMethodType { } /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodUsBankAccount<'a> { +pub struct CreatePaymentMethodBuilderUsBankAccount<'a> { /// Account holder type: individual or company. #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, + pub account_holder_type: Option, /// Account number of the bank account. #[serde(skip_serializing_if = "Option::is_none")] pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, + pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections_account: Option<&'a str>, @@ -1290,20 +1066,20 @@ pub struct CreatePaymentMethodUsBankAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreatePaymentMethodUsBankAccount<'a> { +impl<'a> CreatePaymentMethodBuilderUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodUsBankAccountAccountHolderType { +pub enum CreatePaymentMethodBuilderUsBankAccountAccountHolderType { Company, Individual, } -impl CreatePaymentMethodUsBankAccountAccountHolderType { +impl CreatePaymentMethodBuilderUsBankAccountAccountHolderType { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodUsBankAccountAccountHolderType::*; + use CreatePaymentMethodBuilderUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -1311,10 +1087,10 @@ impl CreatePaymentMethodUsBankAccountAccountHolderType { } } -impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountHolderType { +impl std::str::FromStr for CreatePaymentMethodBuilderUsBankAccountAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodUsBankAccountAccountHolderType::*; + use CreatePaymentMethodBuilderUsBankAccountAccountHolderType::*; match s { "company" => Ok(Company), "individual" => Ok(Individual), @@ -1322,18 +1098,18 @@ impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountHolderType { } } } -impl std::fmt::Display for CreatePaymentMethodUsBankAccountAccountHolderType { +impl std::fmt::Display for CreatePaymentMethodBuilderUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountHolderType { +impl std::fmt::Debug for CreatePaymentMethodBuilderUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountHolderType { +impl serde::Serialize for CreatePaymentMethodBuilderUsBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1343,13 +1119,13 @@ impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountHolderType { } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodUsBankAccountAccountType { +pub enum CreatePaymentMethodBuilderUsBankAccountAccountType { Checking, Savings, } -impl CreatePaymentMethodUsBankAccountAccountType { +impl CreatePaymentMethodBuilderUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodUsBankAccountAccountType::*; + use CreatePaymentMethodBuilderUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -1357,10 +1133,10 @@ impl CreatePaymentMethodUsBankAccountAccountType { } } -impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountType { +impl std::str::FromStr for CreatePaymentMethodBuilderUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodUsBankAccountAccountType::*; + use CreatePaymentMethodBuilderUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -1368,18 +1144,18 @@ impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountType { } } } -impl std::fmt::Display for CreatePaymentMethodUsBankAccountAccountType { +impl std::fmt::Display for CreatePaymentMethodBuilderUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountType { +impl std::fmt::Debug for CreatePaymentMethodBuilderUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountType { +impl serde::Serialize for CreatePaymentMethodBuilderUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1387,113 +1163,397 @@ impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountType { serializer.serialize_str(self.as_str()) } } -impl<'a> CreatePaymentMethod<'a> { - /// Creates a PaymentMethod object. - /// Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js. - /// - /// Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents](https://stripe.com/docs/payments/accept-a-payment) API to accept a payment immediately or the [SetupIntent](https://stripe.com/docs/payments/save-and-reuse) API to collect payment method details ahead of a future payment. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/payment_methods", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethod<'a> { - /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, - /// If this is a `card` PaymentMethod, this hash contains the user's card details. - #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option<&'a serde_json::Value>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option, +/// Creates a PaymentMethod object. +/// Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js. +/// +/// Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents](https://stripe.com/docs/payments/accept-a-payment) API to accept a payment immediately or the [SetupIntent](https://stripe.com/docs/payments/save-and-reuse) API to collect payment method details ahead of a future payment. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePaymentMethod<'a> { + inner: CreatePaymentMethodBuilder<'a>, } -impl<'a> UpdatePaymentMethod<'a> { +impl<'a> CreatePaymentMethod<'a> { pub fn new() -> Self { - Self::default() + Self { inner: CreatePaymentMethodBuilder::new() } } -} -/// If this is a `card` PaymentMethod, this hash contains the user's card details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodCard { - /// Two-digit number representing the card's expiration month. - #[serde(skip_serializing_if = "Option::is_none")] - pub exp_month: Option, - /// Four-digit number representing the card's expiration year. - #[serde(skip_serializing_if = "Option::is_none")] - pub exp_year: Option, -} -impl UpdatePaymentMethodCard { - pub fn new() -> Self { - Self::default() + pub fn acss_debit(mut self, acss_debit: CreatePaymentMethodBuilderAcssDebit<'a>) -> Self { + self.inner.acss_debit = Some(acss_debit); + self } -} -/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodUsBankAccount { - /// Bank account holder type. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option, - /// Bank account type. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: Option, -} -impl UpdatePaymentMethodUsBankAccount { - pub fn new() -> Self { - Self::default() + + pub fn affirm(mut self, affirm: &'a serde_json::Value) -> Self { + self.inner.affirm = Some(affirm); + self } -} -/// Bank account holder type. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodUsBankAccountAccountHolderType { - Company, - Individual, -} -impl UpdatePaymentMethodUsBankAccountAccountHolderType { - pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodUsBankAccountAccountHolderType::*; - match self { - Company => "company", - Individual => "individual", - } + + pub fn afterpay_clearpay(mut self, afterpay_clearpay: &'a serde_json::Value) -> Self { + self.inner.afterpay_clearpay = Some(afterpay_clearpay); + self } -} -impl std::str::FromStr for UpdatePaymentMethodUsBankAccountAccountHolderType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentMethodUsBankAccountAccountHolderType::*; - match s { - "company" => Ok(Company), - "individual" => Ok(Individual), + pub fn alipay(mut self, alipay: &'a serde_json::Value) -> Self { + self.inner.alipay = Some(alipay); + self + } + + pub fn au_becs_debit( + mut self, + au_becs_debit: CreatePaymentMethodBuilderAuBecsDebit<'a>, + ) -> Self { + self.inner.au_becs_debit = Some(au_becs_debit); + self + } + + pub fn bacs_debit(mut self, bacs_debit: CreatePaymentMethodBuilderBacsDebit<'a>) -> Self { + self.inner.bacs_debit = Some(bacs_debit); + self + } + + pub fn bancontact(mut self, bancontact: &'a serde_json::Value) -> Self { + self.inner.bancontact = Some(bancontact); + self + } + + pub fn billing_details(mut self, billing_details: BillingDetailsInnerParams<'a>) -> Self { + self.inner.billing_details = Some(billing_details); + self + } + + pub fn blik(mut self, blik: &'a serde_json::Value) -> Self { + self.inner.blik = Some(blik); + self + } + + pub fn boleto(mut self, boleto: CreatePaymentMethodBuilderBoleto<'a>) -> Self { + self.inner.boleto = Some(boleto); + self + } + + pub fn card(mut self, card: CreatePaymentMethodBuilderCard<'a>) -> Self { + self.inner.card = Some(card); + self + } + + pub fn cashapp(mut self, cashapp: &'a serde_json::Value) -> Self { + self.inner.cashapp = Some(cashapp); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn customer_balance(mut self, customer_balance: &'a serde_json::Value) -> Self { + self.inner.customer_balance = Some(customer_balance); + self + } + + pub fn eps(mut self, eps: CreatePaymentMethodBuilderEps) -> Self { + self.inner.eps = Some(eps); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fpx(mut self, fpx: CreatePaymentMethodBuilderFpx) -> Self { + self.inner.fpx = Some(fpx); + self + } + + pub fn giropay(mut self, giropay: &'a serde_json::Value) -> Self { + self.inner.giropay = Some(giropay); + self + } + + pub fn grabpay(mut self, grabpay: &'a serde_json::Value) -> Self { + self.inner.grabpay = Some(grabpay); + self + } + + pub fn ideal(mut self, ideal: CreatePaymentMethodBuilderIdeal) -> Self { + self.inner.ideal = Some(ideal); + self + } + + pub fn interac_present(mut self, interac_present: &'a serde_json::Value) -> Self { + self.inner.interac_present = Some(interac_present); + self + } + + pub fn klarna(mut self, klarna: CreatePaymentMethodBuilderKlarna) -> Self { + self.inner.klarna = Some(klarna); + self + } + + pub fn konbini(mut self, konbini: &'a serde_json::Value) -> Self { + self.inner.konbini = Some(konbini); + self + } + + pub fn link(mut self, link: &'a serde_json::Value) -> Self { + self.inner.link = Some(link); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn oxxo(mut self, oxxo: &'a serde_json::Value) -> Self { + self.inner.oxxo = Some(oxxo); + self + } + + pub fn p24(mut self, p24: CreatePaymentMethodBuilderP24) -> Self { + self.inner.p24 = Some(p24); + self + } + + pub fn payment_method(mut self, payment_method: &'a str) -> Self { + self.inner.payment_method = Some(payment_method); + self + } + + pub fn paynow(mut self, paynow: &'a serde_json::Value) -> Self { + self.inner.paynow = Some(paynow); + self + } + + pub fn paypal(mut self, paypal: &'a serde_json::Value) -> Self { + self.inner.paypal = Some(paypal); + self + } + + pub fn pix(mut self, pix: &'a serde_json::Value) -> Self { + self.inner.pix = Some(pix); + self + } + + pub fn promptpay(mut self, promptpay: &'a serde_json::Value) -> Self { + self.inner.promptpay = Some(promptpay); + self + } + + pub fn radar_options( + mut self, + radar_options: CreatePaymentMethodBuilderRadarOptions<'a>, + ) -> Self { + self.inner.radar_options = Some(radar_options); + self + } + + pub fn revolut_pay(mut self, revolut_pay: &'a serde_json::Value) -> Self { + self.inner.revolut_pay = Some(revolut_pay); + self + } + + pub fn sepa_debit(mut self, sepa_debit: CreatePaymentMethodBuilderSepaDebit<'a>) -> Self { + self.inner.sepa_debit = Some(sepa_debit); + self + } + + pub fn sofort(mut self, sofort: CreatePaymentMethodBuilderSofort) -> Self { + self.inner.sofort = Some(sofort); + self + } + + pub fn type_(mut self, type_: CreatePaymentMethodBuilderType) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn us_bank_account( + mut self, + us_bank_account: CreatePaymentMethodBuilderUsBankAccount<'a>, + ) -> Self { + self.inner.us_bank_account = Some(us_bank_account); + self + } + + pub fn wechat_pay(mut self, wechat_pay: &'a serde_json::Value) -> Self { + self.inner.wechat_pay = Some(wechat_pay); + self + } + + pub fn zip(mut self, zip: &'a serde_json::Value) -> Self { + self.inner.zip = Some(zip); + self + } +} +impl CreatePaymentMethod<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePaymentMethod<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payment_methods").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrievePaymentMethodBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePaymentMethodBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves a PaymentMethod object attached to the StripeAccount. +/// To retrieve a payment method attached to a Customer, you should use [Retrieve a Customer’s PaymentMethods](https://stripe.com/docs/api/payment_methods/customer). +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentMethod<'a> { + inner: RetrievePaymentMethodBuilder<'a>, + payment_method: &'a stripe_shared::PaymentMethodId, +} +impl<'a> RetrievePaymentMethod<'a> { + pub fn new(payment_method: &'a stripe_shared::PaymentMethodId) -> Self { + Self { payment_method, inner: RetrievePaymentMethodBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentMethod<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentMethod<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + let payment_method = self.payment_method; + RequestBuilder::new(StripeMethod::Get, format!("/payment_methods/{payment_method}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePaymentMethodBuilder<'a> { + /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_details: Option>, + /// If this is a `card` PaymentMethod, this hash contains the user's card details. + #[serde(skip_serializing_if = "Option::is_none")] + pub card: Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. + #[serde(skip_serializing_if = "Option::is_none")] + pub link: Option<&'a serde_json::Value>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. + #[serde(skip_serializing_if = "Option::is_none")] + pub us_bank_account: Option, +} +impl<'a> UpdatePaymentMethodBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// If this is a `card` PaymentMethod, this hash contains the user's card details. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePaymentMethodBuilderCard { + /// Two-digit number representing the card's expiration month. + #[serde(skip_serializing_if = "Option::is_none")] + pub exp_month: Option, + /// Four-digit number representing the card's expiration year. + #[serde(skip_serializing_if = "Option::is_none")] + pub exp_year: Option, +} +impl UpdatePaymentMethodBuilderCard { + pub fn new() -> Self { + Self::default() + } +} +/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePaymentMethodBuilderUsBankAccount { + /// Bank account type. + #[serde(skip_serializing_if = "Option::is_none")] + pub account_holder_type: Option, +} +impl UpdatePaymentMethodBuilderUsBankAccount { + pub fn new() -> Self { + Self::default() + } +} +/// Bank account type. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { + Company, + Individual, +} +impl UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { + pub fn as_str(self) -> &'static str { + use UpdatePaymentMethodBuilderUsBankAccountAccountHolderType::*; + match self { + Company => "company", + Individual => "individual", + } + } +} + +impl std::str::FromStr for UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdatePaymentMethodBuilderUsBankAccountAccountHolderType::*; + match s { + "company" => Ok(Company), + "individual" => Ok(Individual), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentMethodUsBankAccountAccountHolderType { +impl std::fmt::Display for UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountHolderType { +impl std::fmt::Debug for UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountHolderType { +impl serde::Serialize for UpdatePaymentMethodBuilderUsBankAccountAccountHolderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1501,45 +1561,243 @@ impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountHolderType { serializer.serialize_str(self.as_str()) } } -/// Bank account type. +/// Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePaymentMethod<'a> { + inner: UpdatePaymentMethodBuilder<'a>, + payment_method: &'a stripe_shared::PaymentMethodId, +} +impl<'a> UpdatePaymentMethod<'a> { + pub fn new(payment_method: &'a stripe_shared::PaymentMethodId) -> Self { + Self { payment_method, inner: UpdatePaymentMethodBuilder::new() } + } + pub fn billing_details(mut self, billing_details: BillingDetailsInnerParams<'a>) -> Self { + self.inner.billing_details = Some(billing_details); + self + } + + pub fn card(mut self, card: UpdatePaymentMethodBuilderCard) -> Self { + self.inner.card = Some(card); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn link(mut self, link: &'a serde_json::Value) -> Self { + self.inner.link = Some(link); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn us_bank_account( + mut self, + us_bank_account: UpdatePaymentMethodBuilderUsBankAccount, + ) -> Self { + self.inner.us_bank_account = Some(us_bank_account); + self + } +} +impl UpdatePaymentMethod<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePaymentMethod<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + let payment_method = self.payment_method; + RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListPaymentMethodBuilder<'a> { + /// The ID of the customer whose PaymentMethods will be retrieved. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// An optional filter on the list, based on the object `type` field. + /// Without the filter, the list includes all current and future payment method types. + /// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl<'a> ListPaymentMethodBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// An optional filter on the list, based on the object `type` field. +/// Without the filter, the list includes all current and future payment method types. +/// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodUsBankAccountAccountType { - Checking, - Savings, +#[non_exhaustive] +pub enum ListPaymentMethodBuilderType { + AcssDebit, + Affirm, + AfterpayClearpay, + Alipay, + AuBecsDebit, + BacsDebit, + Bancontact, + Blik, + Boleto, + Card, + Cashapp, + CustomerBalance, + Eps, + Fpx, + Giropay, + Grabpay, + Ideal, + Klarna, + Konbini, + Link, + Oxxo, + P24, + Paynow, + Paypal, + Pix, + Promptpay, + RevolutPay, + SepaDebit, + Sofort, + UsBankAccount, + WechatPay, + Zip, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, } -impl UpdatePaymentMethodUsBankAccountAccountType { +impl ListPaymentMethodBuilderType { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodUsBankAccountAccountType::*; + use ListPaymentMethodBuilderType::*; match self { - Checking => "checking", - Savings => "savings", + AcssDebit => "acss_debit", + Affirm => "affirm", + AfterpayClearpay => "afterpay_clearpay", + Alipay => "alipay", + AuBecsDebit => "au_becs_debit", + BacsDebit => "bacs_debit", + Bancontact => "bancontact", + Blik => "blik", + Boleto => "boleto", + Card => "card", + Cashapp => "cashapp", + CustomerBalance => "customer_balance", + Eps => "eps", + Fpx => "fpx", + Giropay => "giropay", + Grabpay => "grabpay", + Ideal => "ideal", + Klarna => "klarna", + Konbini => "konbini", + Link => "link", + Oxxo => "oxxo", + P24 => "p24", + Paynow => "paynow", + Paypal => "paypal", + Pix => "pix", + Promptpay => "promptpay", + RevolutPay => "revolut_pay", + SepaDebit => "sepa_debit", + Sofort => "sofort", + UsBankAccount => "us_bank_account", + WechatPay => "wechat_pay", + Zip => "zip", + Unknown => "unknown", } } } -impl std::str::FromStr for UpdatePaymentMethodUsBankAccountAccountType { +impl std::str::FromStr for ListPaymentMethodBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodUsBankAccountAccountType::*; + use ListPaymentMethodBuilderType::*; match s { - "checking" => Ok(Checking), - "savings" => Ok(Savings), + "acss_debit" => Ok(AcssDebit), + "affirm" => Ok(Affirm), + "afterpay_clearpay" => Ok(AfterpayClearpay), + "alipay" => Ok(Alipay), + "au_becs_debit" => Ok(AuBecsDebit), + "bacs_debit" => Ok(BacsDebit), + "bancontact" => Ok(Bancontact), + "blik" => Ok(Blik), + "boleto" => Ok(Boleto), + "card" => Ok(Card), + "cashapp" => Ok(Cashapp), + "customer_balance" => Ok(CustomerBalance), + "eps" => Ok(Eps), + "fpx" => Ok(Fpx), + "giropay" => Ok(Giropay), + "grabpay" => Ok(Grabpay), + "ideal" => Ok(Ideal), + "klarna" => Ok(Klarna), + "konbini" => Ok(Konbini), + "link" => Ok(Link), + "oxxo" => Ok(Oxxo), + "p24" => Ok(P24), + "paynow" => Ok(Paynow), + "paypal" => Ok(Paypal), + "pix" => Ok(Pix), + "promptpay" => Ok(Promptpay), + "revolut_pay" => Ok(RevolutPay), + "sepa_debit" => Ok(SepaDebit), + "sofort" => Ok(Sofort), + "us_bank_account" => Ok(UsBankAccount), + "wechat_pay" => Ok(WechatPay), + "zip" => Ok(Zip), _ => Err(()), } } } -impl std::fmt::Display for UpdatePaymentMethodUsBankAccountAccountType { +impl std::fmt::Display for ListPaymentMethodBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountType { +impl std::fmt::Debug for ListPaymentMethodBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountType { +impl serde::Serialize for ListPaymentMethodBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1547,86 +1805,188 @@ impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountType { serializer.serialize_str(self.as_str()) } } -impl<'a> UpdatePaymentMethod<'a> { - /// Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. - pub fn send( +/// Returns a list of PaymentMethods for Treasury flows. +/// If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer’s PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentMethod<'a> { + inner: ListPaymentMethodBuilder<'a>, +} +impl<'a> ListPaymentMethod<'a> { + pub fn new() -> Self { + Self { inner: ListPaymentMethodBuilder::new() } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: ListPaymentMethodBuilderType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl ListPaymentMethod<'_> { + pub async fn send( &self, - client: &stripe::Client, - payment_method: &stripe_shared::PaymentMethodId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_methods/{payment_method}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPaymentMethod<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_methods").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct AttachPaymentMethod<'a> { +pub struct AttachPaymentMethodBuilder<'a> { /// The ID of the customer to which to attach the PaymentMethod. pub customer: &'a str, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> AttachPaymentMethod<'a> { +impl<'a> AttachPaymentMethodBuilder<'a> { pub fn new(customer: &'a str) -> Self { Self { customer, expand: None } } } +/// Attaches a PaymentMethod object to a Customer. +/// +/// To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents). +/// or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage). +/// These approaches will perform any necessary steps to set up the PaymentMethod for future payments. +/// Using the `/v1/payment_methods/:id/attach`. +/// endpoint without first using a SetupIntent or PaymentIntent with `setup_future_usage` does not optimize the PaymentMethod for. +/// future use, which makes later declines and payment friction more likely. +/// See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up. +/// future payments. +/// +/// To use this PaymentMethod as the default for invoice or subscription payments, +/// set `invoice_settings.default_payment_method`,. +/// on the Customer to the PaymentMethod’s ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct AttachPaymentMethod<'a> { + inner: AttachPaymentMethodBuilder<'a>, + payment_method: &'a stripe_shared::PaymentMethodId, +} impl<'a> AttachPaymentMethod<'a> { - /// Attaches a PaymentMethod object to a Customer. - /// - /// To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents). - /// or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage). - /// These approaches will perform any necessary steps to set up the PaymentMethod for future payments. - /// Using the `/v1/payment_methods/:id/attach`. - /// endpoint without first using a SetupIntent or PaymentIntent with `setup_future_usage` does not optimize the PaymentMethod for. - /// future use, which makes later declines and payment friction more likely. - /// See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up. - /// future payments. - /// - /// To use this PaymentMethod as the default for invoice or subscription payments, - /// set `invoice_settings.default_payment_method`,. - /// on the Customer to the PaymentMethod’s ID. - pub fn send( + pub fn new(payment_method: &'a stripe_shared::PaymentMethodId, customer: &'a str) -> Self { + Self { payment_method, inner: AttachPaymentMethodBuilder::new(customer) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl AttachPaymentMethod<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_method: &stripe_shared::PaymentMethodId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_methods/{payment_method}/attach"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for AttachPaymentMethod<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + let payment_method = self.payment_method; + RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}/attach")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DetachPaymentMethod<'a> { +pub struct DetachPaymentMethodBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> DetachPaymentMethod<'a> { +impl<'a> DetachPaymentMethodBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Detaches a PaymentMethod object from a Customer. +/// After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DetachPaymentMethod<'a> { + inner: DetachPaymentMethodBuilder<'a>, + payment_method: &'a stripe_shared::PaymentMethodId, +} impl<'a> DetachPaymentMethod<'a> { - /// Detaches a PaymentMethod object from a Customer. - /// After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer. - pub fn send( + pub fn new(payment_method: &'a stripe_shared::PaymentMethodId) -> Self { + Self { payment_method, inner: DetachPaymentMethodBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DetachPaymentMethod<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_method: &stripe_shared::PaymentMethodId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_methods/{payment_method}/detach"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DetachPaymentMethod<'_> { + type Output = stripe_shared::PaymentMethod; + + fn build(&self) -> RequestBuilder { + let payment_method = self.payment_method; + RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}/detach")) + .form(&self.inner) } } + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct BillingDetailsAddress<'a> { /// City, district, suburb, town, or village. diff --git a/generated/stripe_payment/src/payment_method_configuration/requests.rs b/generated/stripe_payment/src/payment_method_configuration/requests.rs index 363c4bb5b..76213e222 100644 --- a/generated/stripe_payment/src/payment_method_configuration/requests.rs +++ b/generated/stripe_payment/src/payment_method_configuration/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentMethodConfiguration<'a> { +pub struct ListPaymentMethodConfigurationBuilder<'a> { /// The Connect application to filter by. #[serde(skip_serializing_if = "Option::is_none")] pub application: Option<&'a str>, @@ -7,118 +11,177 @@ pub struct ListPaymentMethodConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ListPaymentMethodConfiguration<'a> { +impl<'a> ListPaymentMethodConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// List payment method configurations +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentMethodConfiguration<'a> { + inner: ListPaymentMethodConfigurationBuilder<'a>, +} impl<'a> ListPaymentMethodConfiguration<'a> { - /// List payment method configurations - pub fn send( + pub fn new() -> Self { + Self { inner: ListPaymentMethodConfigurationBuilder::new() } + } + pub fn application(mut self, application: &'a str) -> Self { + self.inner.application = Some(application); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ListPaymentMethodConfiguration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_method_configurations", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payment_method_configurations", self) +} + +impl StripeRequest for ListPaymentMethodConfiguration<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_method_configurations").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentMethodConfiguration<'a> { +pub struct RetrievePaymentMethodConfigurationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrievePaymentMethodConfiguration<'a> { +impl<'a> RetrievePaymentMethodConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieve payment method configuration +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentMethodConfiguration<'a> { + inner: RetrievePaymentMethodConfigurationBuilder<'a>, + configuration: &'a stripe_payment::PaymentMethodConfigurationId, +} impl<'a> RetrievePaymentMethodConfiguration<'a> { - /// Retrieve payment method configuration - pub fn send( + pub fn new(configuration: &'a stripe_payment::PaymentMethodConfigurationId) -> Self { + Self { configuration, inner: RetrievePaymentMethodConfigurationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentMethodConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_payment::PaymentMethodConfigurationId, - ) -> stripe::Response { - client.get_query(&format!("/payment_method_configurations/{configuration}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentMethodConfiguration<'_> { + type Output = stripe_payment::PaymentMethodConfiguration; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new( + StripeMethod::Get, + format!("/payment_method_configurations/{configuration}"), + ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfiguration<'a> { +pub struct UpdatePaymentMethodConfigurationBuilder<'a> { /// Canadian pre-authorized debit payments, check this [page](https://stripe.com/docs/payments/acss-debit) for more details like country availability. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, + pub acss_debit: Option, + /// Whether the configuration can be used for new payments. + #[serde(skip_serializing_if = "Option::is_none")] + pub active: Option, /// [Affirm](https://www.affirm.com/) gives your customers a way to split purchases over a series of payments. /// Depending on the purchase, they can pay with four interest-free payments (Split Pay) or pay over a longer term (Installments), which might include interest. /// Check this [page](https://stripe.com/docs/payments/affirm) for more details like country availability. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option, + pub affirm: Option, /// Afterpay gives your customers a way to pay for purchases in installments, check this [page](https://stripe.com/docs/payments/afterpay-clearpay) for more details like country availability. /// Afterpay is particularly popular among businesses selling fashion, beauty, and sports products. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option, + pub afterpay_clearpay: Option, /// Alipay is a digital wallet in China that has more than a billion active users worldwide. /// Alipay users can pay on the web or on a mobile device using login credentials or their Alipay app. /// Alipay has a low dispute rate and reduces fraud by authenticating payments using the customer's login credentials. /// Check this [page](https://stripe.com/docs/payments/alipay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// Stripe users can accept [Apple Pay](/payments/apple-pay) in iOS applications in iOS 9 and later, and on the web in Safari starting with iOS 10 or macOS Sierra. /// There are no additional fees to process Apple Pay payments, and the [pricing](/pricing) is the same as other card transactions. /// Check this [page](https://stripe.com/docs/apple-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub apple_pay: Option, + pub apple_pay: Option, /// Apple Pay Later, a payment method for customers to buy now and pay later, gives your customers a way to split purchases into four installments across six weeks. #[serde(skip_serializing_if = "Option::is_none")] - pub apple_pay_later: Option, + pub apple_pay_later: Option, /// Stripe users in Australia can accept Bulk Electronic Clearing System (BECS) direct debit payments from customers with an Australian bank account. /// Check this [page](https://stripe.com/docs/payments/au-becs-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// Stripe users in the UK can accept Bacs Direct Debit payments from customers with a UK bank account, check this [page](https://stripe.com/docs/payments/payment-methods/bacs-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// Bancontact is the most popular online payment method in Belgium, with over 15 million cards in circulation. /// [Customers](https://stripe.com/docs/api/customers) use a Bancontact card or mobile app linked to a Belgian bank account to make online payments that are secure, guaranteed, and confirmed immediately. /// Check this [page](https://stripe.com/docs/payments/bancontact) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// BLIK is a [single use](https://stripe.com/docs/payments/payment-methods#usage) payment method that requires customers to authenticate their payments. /// When customers want to pay online using BLIK, they request a six-digit code from their banking application and enter it into the payment collection form. /// Check this [page](https://stripe.com/docs/payments/blik) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option, + pub blik: Option, /// Boleto is an official (regulated by the Central Bank of Brazil) payment method in Brazil. /// Check this [page](https://stripe.com/docs/payments/boleto) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// Cards are a popular way for consumers and businesses to pay online or in person. /// Stripe supports global and local card networks. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, + pub card: Option, /// Cartes Bancaires is France's local card network. /// More than 95% of these cards are co-branded with either Visa or Mastercard, meaning you can process these cards over either Cartes Bancaires or the Visa or Mastercard networks. /// Check this [page](https://stripe.com/docs/payments/cartes-bancaires) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option, + pub cartes_bancaires: Option, /// Cash App is a popular consumer app in the US that allows customers to bank, invest, send, and receive money using their digital wallet. /// Check this [page](https://stripe.com/docs/payments/cash-app-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, - /// Uses a customer’s [cash balance](https://stripe.com/docs/payments/customer-balance) for the payment. - /// The cash balance can be funded via a bank transfer. - /// Check this [page](https://stripe.com/docs/payments/bank-transfers) for more details. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option, + pub cashapp: Option, /// EPS is an Austria-based payment method that allows customers to complete transactions online using their bank credentials. /// EPS is supported by all Austrian banks and is accepted by over 80% of Austrian online retailers. /// Check this [page](https://stripe.com/docs/payments/eps) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -127,48 +190,48 @@ pub struct CreatePaymentMethodConfiguration<'a> { /// It is one of the most popular online payment methods in Malaysia, with nearly 90 million transactions in 2018 according to BNM. /// Check this [page](https://stripe.com/docs/payments/fpx) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// giropay is a German payment method based on online banking, introduced in 2006. /// It allows customers to complete transactions online using their online banking environment, with funds debited from their bank account. /// Depending on their bank, customers confirm payments on giropay using a second factor of authentication or a PIN. /// giropay accounts for 10% of online checkouts in Germany. /// Check this [page](https://stripe.com/docs/payments/giropay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// Google Pay allows customers to make payments in your app or website using any credit or debit card saved to their Google Account, including those from Google Play, YouTube, Chrome, or an Android device. /// Use the Google Pay API to request any credit or debit card stored in your customer's Google account. /// Check this [page](https://stripe.com/docs/google-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub google_pay: Option, + pub google_pay: Option, /// GrabPay is a payment method developed by [Grab](https://www.grab.com/sg/consumer/finance/pay/). /// GrabPay is a digital wallet - customers maintain a balance in their wallets that they pay out with. /// Check this [page](https://stripe.com/docs/payments/grabpay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// iDEAL is a Netherlands-based payment method that allows customers to complete transactions online using their bank credentials. /// All major Dutch banks are members of Currence, the scheme that operates iDEAL, making it the most popular online payment method in the Netherlands with a share of online transactions close to 55%. /// Check this [page](https://stripe.com/docs/payments/ideal) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// JCB is a credit card company based in Japan. /// JCB is currently available in Japan to businesses approved by JCB, and available to all businesses in Australia, Canada, Hong Kong, Japan, New Zealand, Singapore, Switzerland, United Kingdom, United States, and all countries in the European Economic Area except Iceland. /// Check this [page](https://support.stripe.com/questions/accepting-japan-credit-bureau-%28jcb%29-payments) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub jcb: Option, + pub jcb: Option, /// Klarna gives customers a range of [payment options](https://stripe.com/docs/payments/klarna#payment-options) during checkout. /// Available payment options vary depending on the customer's billing address and the transaction amount. /// These payment options make it convenient for customers to purchase items in all price ranges. /// Check this [page](https://stripe.com/docs/payments/klarna) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// Konbini allows customers in Japan to pay for bills and online purchases at convenience stores with cash. /// Check this [page](https://stripe.com/docs/payments/konbini) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option, + pub konbini: Option, /// [Link](https://stripe.com/docs/payments/link) is a payment method network. /// With Link, users save their payment details once, then reuse that information to pay with one click for any business on the network. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option, + pub link: Option, /// Configuration name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, @@ -176,89 +239,84 @@ pub struct CreatePaymentMethodConfiguration<'a> { /// OXXO allows customers to pay bills and online purchases in-store with cash. /// Check this [page](https://stripe.com/docs/payments/oxxo) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// Przelewy24 is a Poland-based payment method aggregator that allows customers to complete transactions online using bank transfers and other methods. /// Bank transfers account for 30% of online payments in Poland and Przelewy24 provides a way for customers to pay with over 165 banks. /// Check this [page](https://stripe.com/docs/payments/p24) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, - /// Configuration's parent configuration. Specify to create a child configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub parent: Option<&'a str>, + pub p24: Option, /// PayNow is a Singapore-based payment method that allows customers to make a payment using their preferred app from participating banks and participating non-bank financial institutions. /// Check this [page](https://stripe.com/docs/payments/paynow) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// PayPal, a digital wallet popular with customers in Europe, allows your customers worldwide to pay using their PayPal account. /// Check this [page](https://stripe.com/docs/payments/paypal) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option, + pub paypal: Option, /// PromptPay is a Thailand-based payment method that allows customers to make a payment using their preferred app from participating banks. /// Check this [page](https://stripe.com/docs/payments/promptpay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay: Option, - /// Revolut Pay, developed by Revolut, a global finance app, is a digital wallet payment method. - /// Revolut Pay uses the customer’s stored balance or cards to fund the payment, and offers the option for non-Revolut customers to save their details after their first purchase. - #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub promptpay: Option, /// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. /// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option, + pub sepa_debit: Option, /// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. /// Check this [page](https://stripe.com/docs/payments/sofort) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, + pub sofort: Option, /// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. /// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option, + pub us_bank_account: Option, /// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. /// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. /// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. /// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option, + pub wechat_pay: Option, } -impl<'a> CreatePaymentMethodConfiguration<'a> { +impl<'a> UpdatePaymentMethodConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Canadian pre-authorized debit payments, check this [page](https://stripe.com/docs/payments/acss-debit) for more details like country availability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAcssDebit { +pub struct UpdatePaymentMethodConfigurationBuilderAcssDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationAcssDebit { +impl UpdatePaymentMethodConfigurationBuilderAcssDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAcssDebitDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationAcssDebitDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -267,10 +325,12 @@ impl CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -279,18 +339,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationAcssDebitDisplayPrefe } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -302,38 +368,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationAcssDebitDisplayPrefer /// Depending on the purchase, they can pay with four interest-free payments (Split Pay) or pay over a longer term (Installments), which might include interest. /// Check this [page](https://stripe.com/docs/payments/affirm) for more details like country availability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAffirm { +pub struct UpdatePaymentMethodConfigurationBuilderAffirm { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationAffirm { +impl UpdatePaymentMethodConfigurationBuilderAffirm { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAffirmDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationAffirmDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -342,10 +409,12 @@ impl CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -354,18 +423,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationAffirmDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -376,40 +447,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationAffirmDisplayPreferenc /// Afterpay gives your customers a way to pay for purchases in installments, check this [page](https://stripe.com/docs/payments/afterpay-clearpay) for more details like country availability. /// Afterpay is particularly popular among businesses selling fashion, beauty, and sports products. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAfterpayClearpay { +pub struct UpdatePaymentMethodConfigurationBuilderAfterpayClearpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] pub display_preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationAfterpayClearpay { +impl UpdatePaymentMethodConfigurationBuilderAfterpayClearpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -419,11 +490,11 @@ impl CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference } impl std::str::FromStr - for CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -433,7 +504,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -441,14 +512,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -462,38 +533,39 @@ impl serde::Serialize /// Alipay has a low dispute rate and reduces fraud by authenticating payments using the customer's login credentials. /// Check this [page](https://stripe.com/docs/payments/alipay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAlipay { +pub struct UpdatePaymentMethodConfigurationBuilderAlipay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationAlipay { +impl UpdatePaymentMethodConfigurationBuilderAlipay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAlipayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationAlipayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -502,10 +574,12 @@ impl CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -514,18 +588,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationAlipayDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -537,38 +613,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationAlipayDisplayPreferenc /// There are no additional fees to process Apple Pay payments, and the [pricing](/pricing) is the same as other card transactions. /// Check this [page](https://stripe.com/docs/apple-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationApplePay { +pub struct UpdatePaymentMethodConfigurationBuilderApplePay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationApplePay { +impl UpdatePaymentMethodConfigurationBuilderApplePay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationApplePayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationApplePayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -577,10 +655,12 @@ impl CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -589,18 +669,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationApplePayDisplayPrefer } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -610,39 +696,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationApplePayDisplayPrefere } /// Apple Pay Later, a payment method for customers to buy now and pay later, gives your customers a way to split purchases into four installments across six weeks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationApplePayLater { +pub struct UpdatePaymentMethodConfigurationBuilderApplePayLater { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationApplePayLater { +impl UpdatePaymentMethodConfigurationBuilderApplePayLater { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationApplePayLaterDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationApplePayLaterDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -652,11 +739,11 @@ impl CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { } impl std::str::FromStr - for CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -666,19 +753,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -689,38 +780,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationApplePayLaterDisplayPr /// Stripe users in Australia can accept Bulk Electronic Clearing System (BECS) direct debit payments from customers with an Australian bank account. /// Check this [page](https://stripe.com/docs/payments/au-becs-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAuBecsDebit { +pub struct UpdatePaymentMethodConfigurationBuilderAuBecsDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationAuBecsDebit { +impl UpdatePaymentMethodConfigurationBuilderAuBecsDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationAuBecsDebitDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationAuBecsDebitDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -729,10 +822,12 @@ impl CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -741,18 +836,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationAuBecsDebitDisplayPre } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -762,38 +863,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationAuBecsDebitDisplayPref } /// Stripe users in the UK can accept Bacs Direct Debit payments from customers with a UK bank account, check this [page](https://stripe.com/docs/payments/payment-methods/bacs-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBacsDebit { +pub struct UpdatePaymentMethodConfigurationBuilderBacsDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationBacsDebit { +impl UpdatePaymentMethodConfigurationBuilderBacsDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBacsDebitDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationBacsDebitDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -802,10 +905,12 @@ impl CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -814,18 +919,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationBacsDebitDisplayPrefe } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -837,38 +948,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationBacsDebitDisplayPrefer /// [Customers](https://stripe.com/docs/api/customers) use a Bancontact card or mobile app linked to a Belgian bank account to make online payments that are secure, guaranteed, and confirmed immediately. /// Check this [page](https://stripe.com/docs/payments/bancontact) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBancontact { +pub struct UpdatePaymentMethodConfigurationBuilderBancontact { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationBancontact { +impl UpdatePaymentMethodConfigurationBuilderBancontact { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBancontactDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationBancontactDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -877,10 +990,12 @@ impl CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -889,18 +1004,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationBancontactDisplayPref } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -912,38 +1033,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationBancontactDisplayPrefe /// When customers want to pay online using BLIK, they request a six-digit code from their banking application and enter it into the payment collection form. /// Check this [page](https://stripe.com/docs/payments/blik) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBlik { +pub struct UpdatePaymentMethodConfigurationBuilderBlik { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationBlik { +impl UpdatePaymentMethodConfigurationBuilderBlik { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBlikDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderBlikDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationBlikDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderBlikDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationBlikDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -952,10 +1073,10 @@ impl CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationBlikDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -964,18 +1085,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationBlikDisplayPreference } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -986,38 +1107,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationBlikDisplayPreferenceP /// Boleto is an official (regulated by the Central Bank of Brazil) payment method in Brazil. /// Check this [page](https://stripe.com/docs/payments/boleto) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBoleto { +pub struct UpdatePaymentMethodConfigurationBuilderBoleto { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationBoleto { +impl UpdatePaymentMethodConfigurationBuilderBoleto { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationBoletoDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationBoletoDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1026,10 +1148,12 @@ impl CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1038,18 +1162,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationBoletoDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1060,38 +1186,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationBoletoDisplayPreferenc /// Cards are a popular way for consumers and businesses to pay online or in person. /// Stripe supports global and local card networks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCard { +pub struct UpdatePaymentMethodConfigurationBuilderCard { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationCard { +impl UpdatePaymentMethodConfigurationBuilderCard { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCardDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderCardDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationCardDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderCardDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationCardDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1100,10 +1226,10 @@ impl CreatePaymentMethodConfigurationCardDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationCardDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1112,18 +1238,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationCardDisplayPreference } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1135,40 +1261,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationCardDisplayPreferenceP /// More than 95% of these cards are co-branded with either Visa or Mastercard, meaning you can process these cards over either Cartes Bancaires or the Visa or Mastercard networks. /// Check this [page](https://stripe.com/docs/payments/cartes-bancaires) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCartesBancaires { +pub struct UpdatePaymentMethodConfigurationBuilderCartesBancaires { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] pub display_preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationCartesBancaires { +impl UpdatePaymentMethodConfigurationBuilderCartesBancaires { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCartesBancairesDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationCartesBancairesDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1178,11 +1304,11 @@ impl CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference } impl std::str::FromStr - for CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1192,7 +1318,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -1200,14 +1326,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -1219,115 +1345,39 @@ impl serde::Serialize /// Cash App is a popular consumer app in the US that allows customers to bank, invest, send, and receive money using their digital wallet. /// Check this [page](https://stripe.com/docs/payments/cash-app-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCashapp { - /// Whether or not the payment method should be displayed. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, -} -impl CreatePaymentMethodConfigurationCashapp { - pub fn new() -> Self { - Self::default() - } -} -/// Whether or not the payment method should be displayed. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCashappDisplayPreference { - /// The account's preference for whether or not to display this payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, -} -impl CreatePaymentMethodConfigurationCashappDisplayPreference { - pub fn new() -> Self { - Self::default() - } -} -/// The account's preference for whether or not to display this payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - None, - Off, - On, -} -impl CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationCashappDisplayPreferencePreference::*; - match self { - None => "none", - Off => "off", - On => "on", - } - } -} - -impl std::str::FromStr for CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationCashappDisplayPreferencePreference::*; - match s { - "none" => Ok(None), - "off" => Ok(Off), - "on" => Ok(On), - _ => Err(()), - } - } -} -impl std::fmt::Display for CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Uses a customer’s [cash balance](https://stripe.com/docs/payments/customer-balance) for the payment. -/// The cash balance can be funded via a bank transfer. -/// Check this [page](https://stripe.com/docs/payments/bank-transfers) for more details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCustomerBalance { +pub struct UpdatePaymentMethodConfigurationBuilderCashapp { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: - Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationCustomerBalance { +impl UpdatePaymentMethodConfigurationBuilderCashapp { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationCustomerBalanceDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderCashappDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationCustomerBalanceDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderCashappDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1337,11 +1387,11 @@ impl CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference } impl std::str::FromStr - for CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1351,22 +1401,20 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference -{ +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -1379,38 +1427,38 @@ impl serde::Serialize /// EPS is supported by all Austrian banks and is accepted by over 80% of Austrian online retailers. /// Check this [page](https://stripe.com/docs/payments/eps) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationEps { +pub struct UpdatePaymentMethodConfigurationBuilderEps { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationEps { +impl UpdatePaymentMethodConfigurationBuilderEps { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationEpsDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderEpsDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationEpsDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderEpsDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationEpsDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1419,10 +1467,10 @@ impl CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationEpsDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1431,18 +1479,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationEpsDisplayPreferenceP } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1455,38 +1503,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationEpsDisplayPreferencePr /// It is one of the most popular online payment methods in Malaysia, with nearly 90 million transactions in 2018 according to BNM. /// Check this [page](https://stripe.com/docs/payments/fpx) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationFpx { +pub struct UpdatePaymentMethodConfigurationBuilderFpx { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationFpx { +impl UpdatePaymentMethodConfigurationBuilderFpx { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationFpxDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderFpxDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationFpxDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderFpxDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationFpxDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1495,10 +1543,10 @@ impl CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationFpxDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1507,18 +1555,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationFpxDisplayPreferenceP } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1532,38 +1580,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationFpxDisplayPreferencePr /// giropay accounts for 10% of online checkouts in Germany. /// Check this [page](https://stripe.com/docs/payments/giropay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGiropay { +pub struct UpdatePaymentMethodConfigurationBuilderGiropay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationGiropay { +impl UpdatePaymentMethodConfigurationBuilderGiropay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGiropayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationGiropayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1572,10 +1621,12 @@ impl CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1584,18 +1635,22 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationGiropayDisplayPrefere } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1607,38 +1662,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationGiropayDisplayPreferen /// Use the Google Pay API to request any credit or debit card stored in your customer's Google account. /// Check this [page](https://stripe.com/docs/google-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGooglePay { +pub struct UpdatePaymentMethodConfigurationBuilderGooglePay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationGooglePay { +impl UpdatePaymentMethodConfigurationBuilderGooglePay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGooglePayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationGooglePayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1647,10 +1704,12 @@ impl CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1659,18 +1718,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationGooglePayDisplayPrefe } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1682,38 +1747,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationGooglePayDisplayPrefer /// GrabPay is a digital wallet - customers maintain a balance in their wallets that they pay out with. /// Check this [page](https://stripe.com/docs/payments/grabpay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGrabpay { +pub struct UpdatePaymentMethodConfigurationBuilderGrabpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationGrabpay { +impl UpdatePaymentMethodConfigurationBuilderGrabpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationGrabpayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationGrabpayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1722,10 +1788,12 @@ impl CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1734,18 +1802,22 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationGrabpayDisplayPrefere } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1757,38 +1829,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationGrabpayDisplayPreferen /// All major Dutch banks are members of Currence, the scheme that operates iDEAL, making it the most popular online payment method in the Netherlands with a share of online transactions close to 55%. /// Check this [page](https://stripe.com/docs/payments/ideal) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationIdeal { +pub struct UpdatePaymentMethodConfigurationBuilderIdeal { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationIdeal { +impl UpdatePaymentMethodConfigurationBuilderIdeal { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationIdealDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderIdealDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationIdealDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderIdealDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationIdealDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1797,10 +1869,10 @@ impl CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationIdealDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1809,18 +1881,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationIdealDisplayPreferenc } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1832,38 +1904,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationIdealDisplayPreference /// JCB is currently available in Japan to businesses approved by JCB, and available to all businesses in Australia, Canada, Hong Kong, Japan, New Zealand, Singapore, Switzerland, United Kingdom, United States, and all countries in the European Economic Area except Iceland. /// Check this [page](https://support.stripe.com/questions/accepting-japan-credit-bureau-%28jcb%29-payments) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationJcb { +pub struct UpdatePaymentMethodConfigurationBuilderJcb { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationJcb { +impl UpdatePaymentMethodConfigurationBuilderJcb { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationJcbDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderJcbDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationJcbDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderJcbDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationJcbDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1872,10 +1944,10 @@ impl CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationJcbDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1884,18 +1956,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationJcbDisplayPreferenceP } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1908,38 +1980,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationJcbDisplayPreferencePr /// These payment options make it convenient for customers to purchase items in all price ranges. /// Check this [page](https://stripe.com/docs/payments/klarna) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationKlarna { +pub struct UpdatePaymentMethodConfigurationBuilderKlarna { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationKlarna { +impl UpdatePaymentMethodConfigurationBuilderKlarna { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationKlarnaDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationKlarnaDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -1948,10 +2021,12 @@ impl CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -1960,18 +2035,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationKlarnaDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1982,38 +2059,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationKlarnaDisplayPreferenc /// Konbini allows customers in Japan to pay for bills and online purchases at convenience stores with cash. /// Check this [page](https://stripe.com/docs/payments/konbini) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationKonbini { +pub struct UpdatePaymentMethodConfigurationBuilderKonbini { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationKonbini { +impl UpdatePaymentMethodConfigurationBuilderKonbini { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationKonbiniDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationKonbiniDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2022,10 +2100,12 @@ impl CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2034,18 +2114,22 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationKonbiniDisplayPrefere } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2056,38 +2140,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationKonbiniDisplayPreferen /// [Link](https://stripe.com/docs/payments/link) is a payment method network. /// With Link, users save their payment details once, then reuse that information to pay with one click for any business on the network. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationLink { +pub struct UpdatePaymentMethodConfigurationBuilderLink { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationLink { +impl UpdatePaymentMethodConfigurationBuilderLink { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationLinkDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderLinkDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationLinkDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderLinkDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationLinkDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2096,10 +2180,10 @@ impl CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationLinkDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2108,18 +2192,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationLinkDisplayPreference } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2131,38 +2215,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationLinkDisplayPreferenceP /// OXXO allows customers to pay bills and online purchases in-store with cash. /// Check this [page](https://stripe.com/docs/payments/oxxo) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationOxxo { +pub struct UpdatePaymentMethodConfigurationBuilderOxxo { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationOxxo { +impl UpdatePaymentMethodConfigurationBuilderOxxo { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationOxxoDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationOxxoDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2171,10 +2255,10 @@ impl CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2183,18 +2267,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationOxxoDisplayPreference } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2206,38 +2290,38 @@ impl serde::Serialize for CreatePaymentMethodConfigurationOxxoDisplayPreferenceP /// Bank transfers account for 30% of online payments in Poland and Przelewy24 provides a way for customers to pay with over 165 banks. /// Check this [page](https://stripe.com/docs/payments/p24) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationP24 { +pub struct UpdatePaymentMethodConfigurationBuilderP24 { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationP24 { +impl UpdatePaymentMethodConfigurationBuilderP24 { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationP24DisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderP24DisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl CreatePaymentMethodConfigurationP24DisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderP24DisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationP24DisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2246,10 +2330,10 @@ impl CreatePaymentMethodConfigurationP24DisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::str::FromStr for UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationP24DisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2258,18 +2342,18 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationP24DisplayPreferenceP } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::fmt::Display for UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2280,38 +2364,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationP24DisplayPreferencePr /// PayNow is a Singapore-based payment method that allows customers to make a payment using their preferred app from participating banks and participating non-bank financial institutions. /// Check this [page](https://stripe.com/docs/payments/paynow) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPaynow { +pub struct UpdatePaymentMethodConfigurationBuilderPaynow { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationPaynow { +impl UpdatePaymentMethodConfigurationBuilderPaynow { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPaynowDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationPaynowDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2320,10 +2405,12 @@ impl CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2332,18 +2419,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationPaynowDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2354,38 +2443,39 @@ impl serde::Serialize for CreatePaymentMethodConfigurationPaynowDisplayPreferenc /// PayPal, a digital wallet popular with customers in Europe, allows your customers worldwide to pay using their PayPal account. /// Check this [page](https://stripe.com/docs/payments/paypal) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPaypal { +pub struct UpdatePaymentMethodConfigurationBuilderPaypal { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationPaypal { +impl UpdatePaymentMethodConfigurationBuilderPaypal { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPaypalDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationPaypalDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2394,10 +2484,12 @@ impl CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2406,18 +2498,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationPaypalDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2428,38 +2522,40 @@ impl serde::Serialize for CreatePaymentMethodConfigurationPaypalDisplayPreferenc /// PromptPay is a Thailand-based payment method that allows customers to make a payment using their preferred app from participating banks. /// Check this [page](https://stripe.com/docs/payments/promptpay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPromptpay { +pub struct UpdatePaymentMethodConfigurationBuilderPromptpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationPromptpay { +impl UpdatePaymentMethodConfigurationBuilderPromptpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationPromptpayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationPromptpayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2468,10 +2564,12 @@ impl CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2480,18 +2578,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationPromptpayDisplayPrefe } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2499,41 +2603,43 @@ impl serde::Serialize for CreatePaymentMethodConfigurationPromptpayDisplayPrefer serializer.serialize_str(self.as_str()) } } -/// Revolut Pay, developed by Revolut, a global finance app, is a digital wallet payment method. -/// Revolut Pay uses the customer’s stored balance or cards to fund the payment, and offers the option for non-Revolut customers to save their details after their first purchase. +/// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. +/// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationRevolutPay { +pub struct UpdatePaymentMethodConfigurationBuilderSepaDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationRevolutPay { +impl UpdatePaymentMethodConfigurationBuilderSepaDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationRevolutPayDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationRevolutPayDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2542,10 +2648,12 @@ impl CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2554,18 +2662,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationRevolutPayDisplayPref } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2573,41 +2687,42 @@ impl serde::Serialize for CreatePaymentMethodConfigurationRevolutPayDisplayPrefe serializer.serialize_str(self.as_str()) } } -/// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. -/// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. +/// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. +/// Check this [page](https://stripe.com/docs/payments/sofort) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationSepaDebit { +pub struct UpdatePaymentMethodConfigurationBuilderSofort { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl CreatePaymentMethodConfigurationSepaDebit { +impl UpdatePaymentMethodConfigurationBuilderSofort { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationSepaDebitDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderSofortDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationSepaDebitDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderSofortDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2616,10 +2731,12 @@ impl CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2628,18 +2745,20 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationSepaDebitDisplayPrefe } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::fmt::Debug for UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl serde::Serialize for UpdatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2647,41 +2766,43 @@ impl serde::Serialize for CreatePaymentMethodConfigurationSepaDebitDisplayPrefer serializer.serialize_str(self.as_str()) } } -/// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. -/// Check this [page](https://stripe.com/docs/payments/sofort) for more details. +/// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. +/// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationSofort { +pub struct UpdatePaymentMethodConfigurationBuilderUsBankAccount { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationSofort { +impl UpdatePaymentMethodConfigurationBuilderUsBankAccount { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationSofortDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl CreatePaymentMethodConfigurationSofortDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationSofortDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2690,10 +2811,12 @@ impl CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { } } -impl std::str::FromStr for CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::str::FromStr + for UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationSofortDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2702,18 +2825,24 @@ impl std::str::FromStr for CreatePaymentMethodConfigurationSofortDisplayPreferen } } } -impl std::fmt::Display for CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::fmt::Display + for UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2721,42 +2850,45 @@ impl serde::Serialize for CreatePaymentMethodConfigurationSofortDisplayPreferenc serializer.serialize_str(self.as_str()) } } -/// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. -/// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. +/// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. +/// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. +/// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. +/// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationUsBankAccount { +pub struct UpdatePaymentMethodConfigurationBuilderWechatPay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl CreatePaymentMethodConfigurationUsBankAccount { +impl UpdatePaymentMethodConfigurationBuilderWechatPay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationUsBankAccountDisplayPreference { +pub struct UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl CreatePaymentMethodConfigurationUsBankAccountDisplayPreference { +impl UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +pub enum UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { None, Off, On, } -impl CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -2766,11 +2898,11 @@ impl CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { } impl std::str::FromStr - for CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference::*; + use UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -2780,19 +2912,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference + for UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl std::fmt::Debug + for UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl serde::Serialize + for UpdatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -2800,166 +2936,327 @@ impl serde::Serialize for CreatePaymentMethodConfigurationUsBankAccountDisplayPr serializer.serialize_str(self.as_str()) } } -/// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. -/// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. -/// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. -/// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationWechatPay { - /// Whether or not the payment method should be displayed. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, +/// Update payment method configuration +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePaymentMethodConfiguration<'a> { + inner: UpdatePaymentMethodConfigurationBuilder<'a>, + configuration: &'a stripe_payment::PaymentMethodConfigurationId, } -impl CreatePaymentMethodConfigurationWechatPay { - pub fn new() -> Self { - Self::default() +impl<'a> UpdatePaymentMethodConfiguration<'a> { + pub fn new(configuration: &'a stripe_payment::PaymentMethodConfigurationId) -> Self { + Self { configuration, inner: UpdatePaymentMethodConfigurationBuilder::new() } } -} -/// Whether or not the payment method should be displayed. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodConfigurationWechatPayDisplayPreference { - /// The account's preference for whether or not to display this payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, -} -impl CreatePaymentMethodConfigurationWechatPayDisplayPreference { - pub fn new() -> Self { - Self::default() + pub fn acss_debit( + mut self, + acss_debit: UpdatePaymentMethodConfigurationBuilderAcssDebit, + ) -> Self { + self.inner.acss_debit = Some(acss_debit); + self } -} -/// The account's preference for whether or not to display this payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - None, - Off, - On, -} -impl CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - pub fn as_str(self) -> &'static str { - use CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference::*; - match self { - None => "none", - Off => "off", - On => "on", - } + + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self } -} -impl std::str::FromStr for CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference::*; - match s { - "none" => Ok(None), - "off" => Ok(Off), - "on" => Ok(On), - _ => Err(()), - } + pub fn affirm(mut self, affirm: UpdatePaymentMethodConfigurationBuilderAffirm) -> Self { + self.inner.affirm = Some(affirm); + self } -} -impl std::fmt::Display for CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn afterpay_clearpay( + mut self, + afterpay_clearpay: UpdatePaymentMethodConfigurationBuilderAfterpayClearpay, + ) -> Self { + self.inner.afterpay_clearpay = Some(afterpay_clearpay); + self } -} -impl std::fmt::Debug for CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn alipay(mut self, alipay: UpdatePaymentMethodConfigurationBuilderAlipay) -> Self { + self.inner.alipay = Some(alipay); + self } -} -impl serde::Serialize for CreatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn apple_pay(mut self, apple_pay: UpdatePaymentMethodConfigurationBuilderApplePay) -> Self { + self.inner.apple_pay = Some(apple_pay); + self + } + + pub fn apple_pay_later( + mut self, + apple_pay_later: UpdatePaymentMethodConfigurationBuilderApplePayLater, + ) -> Self { + self.inner.apple_pay_later = Some(apple_pay_later); + self + } + + pub fn au_becs_debit( + mut self, + au_becs_debit: UpdatePaymentMethodConfigurationBuilderAuBecsDebit, + ) -> Self { + self.inner.au_becs_debit = Some(au_becs_debit); + self + } + + pub fn bacs_debit( + mut self, + bacs_debit: UpdatePaymentMethodConfigurationBuilderBacsDebit, + ) -> Self { + self.inner.bacs_debit = Some(bacs_debit); + self + } + + pub fn bancontact( + mut self, + bancontact: UpdatePaymentMethodConfigurationBuilderBancontact, + ) -> Self { + self.inner.bancontact = Some(bancontact); + self + } + + pub fn blik(mut self, blik: UpdatePaymentMethodConfigurationBuilderBlik) -> Self { + self.inner.blik = Some(blik); + self + } + + pub fn boleto(mut self, boleto: UpdatePaymentMethodConfigurationBuilderBoleto) -> Self { + self.inner.boleto = Some(boleto); + self + } + + pub fn card(mut self, card: UpdatePaymentMethodConfigurationBuilderCard) -> Self { + self.inner.card = Some(card); + self + } + + pub fn cartes_bancaires( + mut self, + cartes_bancaires: UpdatePaymentMethodConfigurationBuilderCartesBancaires, + ) -> Self { + self.inner.cartes_bancaires = Some(cartes_bancaires); + self + } + + pub fn cashapp(mut self, cashapp: UpdatePaymentMethodConfigurationBuilderCashapp) -> Self { + self.inner.cashapp = Some(cashapp); + self + } + + pub fn eps(mut self, eps: UpdatePaymentMethodConfigurationBuilderEps) -> Self { + self.inner.eps = Some(eps); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fpx(mut self, fpx: UpdatePaymentMethodConfigurationBuilderFpx) -> Self { + self.inner.fpx = Some(fpx); + self + } + + pub fn giropay(mut self, giropay: UpdatePaymentMethodConfigurationBuilderGiropay) -> Self { + self.inner.giropay = Some(giropay); + self + } + + pub fn google_pay( + mut self, + google_pay: UpdatePaymentMethodConfigurationBuilderGooglePay, + ) -> Self { + self.inner.google_pay = Some(google_pay); + self + } + + pub fn grabpay(mut self, grabpay: UpdatePaymentMethodConfigurationBuilderGrabpay) -> Self { + self.inner.grabpay = Some(grabpay); + self + } + + pub fn ideal(mut self, ideal: UpdatePaymentMethodConfigurationBuilderIdeal) -> Self { + self.inner.ideal = Some(ideal); + self + } + + pub fn jcb(mut self, jcb: UpdatePaymentMethodConfigurationBuilderJcb) -> Self { + self.inner.jcb = Some(jcb); + self + } + + pub fn klarna(mut self, klarna: UpdatePaymentMethodConfigurationBuilderKlarna) -> Self { + self.inner.klarna = Some(klarna); + self + } + + pub fn konbini(mut self, konbini: UpdatePaymentMethodConfigurationBuilderKonbini) -> Self { + self.inner.konbini = Some(konbini); + self + } + + pub fn link(mut self, link: UpdatePaymentMethodConfigurationBuilderLink) -> Self { + self.inner.link = Some(link); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn oxxo(mut self, oxxo: UpdatePaymentMethodConfigurationBuilderOxxo) -> Self { + self.inner.oxxo = Some(oxxo); + self + } + + pub fn p24(mut self, p24: UpdatePaymentMethodConfigurationBuilderP24) -> Self { + self.inner.p24 = Some(p24); + self + } + + pub fn paynow(mut self, paynow: UpdatePaymentMethodConfigurationBuilderPaynow) -> Self { + self.inner.paynow = Some(paynow); + self + } + + pub fn paypal(mut self, paypal: UpdatePaymentMethodConfigurationBuilderPaypal) -> Self { + self.inner.paypal = Some(paypal); + self + } + + pub fn promptpay( + mut self, + promptpay: UpdatePaymentMethodConfigurationBuilderPromptpay, + ) -> Self { + self.inner.promptpay = Some(promptpay); + self + } + + pub fn sepa_debit( + mut self, + sepa_debit: UpdatePaymentMethodConfigurationBuilderSepaDebit, + ) -> Self { + self.inner.sepa_debit = Some(sepa_debit); + self + } + + pub fn sofort(mut self, sofort: UpdatePaymentMethodConfigurationBuilderSofort) -> Self { + self.inner.sofort = Some(sofort); + self + } + + pub fn us_bank_account( + mut self, + us_bank_account: UpdatePaymentMethodConfigurationBuilderUsBankAccount, + ) -> Self { + self.inner.us_bank_account = Some(us_bank_account); + self + } + + pub fn wechat_pay( + mut self, + wechat_pay: UpdatePaymentMethodConfigurationBuilderWechatPay, + ) -> Self { + self.inner.wechat_pay = Some(wechat_pay); + self } } -impl<'a> CreatePaymentMethodConfiguration<'a> { - /// Creates a payment method configuration - pub fn send( +impl UpdatePaymentMethodConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/payment_method_configurations", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePaymentMethodConfiguration<'_> { + type Output = stripe_payment::PaymentMethodConfiguration; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_method_configurations/{configuration}"), + ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfiguration<'a> { +pub struct CreatePaymentMethodConfigurationBuilder<'a> { /// Canadian pre-authorized debit payments, check this [page](https://stripe.com/docs/payments/acss-debit) for more details like country availability. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option, - /// Whether the configuration can be used for new payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub active: Option, + pub acss_debit: Option, /// [Affirm](https://www.affirm.com/) gives your customers a way to split purchases over a series of payments. /// Depending on the purchase, they can pay with four interest-free payments (Split Pay) or pay over a longer term (Installments), which might include interest. /// Check this [page](https://stripe.com/docs/payments/affirm) for more details like country availability. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option, + pub affirm: Option, /// Afterpay gives your customers a way to pay for purchases in installments, check this [page](https://stripe.com/docs/payments/afterpay-clearpay) for more details like country availability. /// Afterpay is particularly popular among businesses selling fashion, beauty, and sports products. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option, + pub afterpay_clearpay: Option, /// Alipay is a digital wallet in China that has more than a billion active users worldwide. /// Alipay users can pay on the web or on a mobile device using login credentials or their Alipay app. /// Alipay has a low dispute rate and reduces fraud by authenticating payments using the customer's login credentials. /// Check this [page](https://stripe.com/docs/payments/alipay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, + pub alipay: Option, /// Stripe users can accept [Apple Pay](/payments/apple-pay) in iOS applications in iOS 9 and later, and on the web in Safari starting with iOS 10 or macOS Sierra. /// There are no additional fees to process Apple Pay payments, and the [pricing](/pricing) is the same as other card transactions. /// Check this [page](https://stripe.com/docs/apple-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub apple_pay: Option, + pub apple_pay: Option, /// Apple Pay Later, a payment method for customers to buy now and pay later, gives your customers a way to split purchases into four installments across six weeks. #[serde(skip_serializing_if = "Option::is_none")] - pub apple_pay_later: Option, + pub apple_pay_later: Option, /// Stripe users in Australia can accept Bulk Electronic Clearing System (BECS) direct debit payments from customers with an Australian bank account. /// Check this [page](https://stripe.com/docs/payments/au-becs-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit: Option, + pub au_becs_debit: Option, /// Stripe users in the UK can accept Bacs Direct Debit payments from customers with a UK bank account, check this [page](https://stripe.com/docs/payments/payment-methods/bacs-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit: Option, + pub bacs_debit: Option, /// Bancontact is the most popular online payment method in Belgium, with over 15 million cards in circulation. /// [Customers](https://stripe.com/docs/api/customers) use a Bancontact card or mobile app linked to a Belgian bank account to make online payments that are secure, guaranteed, and confirmed immediately. /// Check this [page](https://stripe.com/docs/payments/bancontact) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, + pub bancontact: Option, /// BLIK is a [single use](https://stripe.com/docs/payments/payment-methods#usage) payment method that requires customers to authenticate their payments. /// When customers want to pay online using BLIK, they request a six-digit code from their banking application and enter it into the payment collection form. /// Check this [page](https://stripe.com/docs/payments/blik) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option, + pub blik: Option, /// Boleto is an official (regulated by the Central Bank of Brazil) payment method in Brazil. /// Check this [page](https://stripe.com/docs/payments/boleto) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, + pub boleto: Option, /// Cards are a popular way for consumers and businesses to pay online or in person. /// Stripe supports global and local card networks. #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, + pub card: Option, /// Cartes Bancaires is France's local card network. /// More than 95% of these cards are co-branded with either Visa or Mastercard, meaning you can process these cards over either Cartes Bancaires or the Visa or Mastercard networks. /// Check this [page](https://stripe.com/docs/payments/cartes-bancaires) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires: Option, + pub cartes_bancaires: Option, /// Cash App is a popular consumer app in the US that allows customers to bank, invest, send, and receive money using their digital wallet. /// Check this [page](https://stripe.com/docs/payments/cash-app-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, - /// Uses a customer’s [cash balance](https://stripe.com/docs/payments/customer-balance) for the payment. - /// The cash balance can be funded via a bank transfer. - /// Check this [page](https://stripe.com/docs/payments/bank-transfers) for more details. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: Option, + pub cashapp: Option, /// EPS is an Austria-based payment method that allows customers to complete transactions online using their bank credentials. /// EPS is supported by all Austrian banks and is accepted by over 80% of Austrian online retailers. /// Check this [page](https://stripe.com/docs/payments/eps) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, + pub eps: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -2968,48 +3265,48 @@ pub struct UpdatePaymentMethodConfiguration<'a> { /// It is one of the most popular online payment methods in Malaysia, with nearly 90 million transactions in 2018 according to BNM. /// Check this [page](https://stripe.com/docs/payments/fpx) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx: Option, + pub fpx: Option, /// giropay is a German payment method based on online banking, introduced in 2006. /// It allows customers to complete transactions online using their online banking environment, with funds debited from their bank account. /// Depending on their bank, customers confirm payments on giropay using a second factor of authentication or a PIN. /// giropay accounts for 10% of online checkouts in Germany. /// Check this [page](https://stripe.com/docs/payments/giropay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, + pub giropay: Option, /// Google Pay allows customers to make payments in your app or website using any credit or debit card saved to their Google Account, including those from Google Play, YouTube, Chrome, or an Android device. /// Use the Google Pay API to request any credit or debit card stored in your customer's Google account. /// Check this [page](https://stripe.com/docs/google-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub google_pay: Option, + pub google_pay: Option, /// GrabPay is a payment method developed by [Grab](https://www.grab.com/sg/consumer/finance/pay/). /// GrabPay is a digital wallet - customers maintain a balance in their wallets that they pay out with. /// Check this [page](https://stripe.com/docs/payments/grabpay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, + pub grabpay: Option, /// iDEAL is a Netherlands-based payment method that allows customers to complete transactions online using their bank credentials. /// All major Dutch banks are members of Currence, the scheme that operates iDEAL, making it the most popular online payment method in the Netherlands with a share of online transactions close to 55%. /// Check this [page](https://stripe.com/docs/payments/ideal) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal: Option, + pub ideal: Option, /// JCB is a credit card company based in Japan. /// JCB is currently available in Japan to businesses approved by JCB, and available to all businesses in Australia, Canada, Hong Kong, Japan, New Zealand, Singapore, Switzerland, United Kingdom, United States, and all countries in the European Economic Area except Iceland. /// Check this [page](https://support.stripe.com/questions/accepting-japan-credit-bureau-%28jcb%29-payments) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub jcb: Option, + pub jcb: Option, /// Klarna gives customers a range of [payment options](https://stripe.com/docs/payments/klarna#payment-options) during checkout. /// Available payment options vary depending on the customer's billing address and the transaction amount. /// These payment options make it convenient for customers to purchase items in all price ranges. /// Check this [page](https://stripe.com/docs/payments/klarna) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, + pub klarna: Option, /// Konbini allows customers in Japan to pay for bills and online purchases at convenience stores with cash. /// Check this [page](https://stripe.com/docs/payments/konbini) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini: Option, + pub konbini: Option, /// [Link](https://stripe.com/docs/payments/link) is a payment method network. /// With Link, users save their payment details once, then reuse that information to pay with one click for any business on the network. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option, + pub link: Option, /// Configuration name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, @@ -3017,86 +3314,87 @@ pub struct UpdatePaymentMethodConfiguration<'a> { /// OXXO allows customers to pay bills and online purchases in-store with cash. /// Check this [page](https://stripe.com/docs/payments/oxxo) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, + pub oxxo: Option, /// Przelewy24 is a Poland-based payment method aggregator that allows customers to complete transactions online using bank transfers and other methods. /// Bank transfers account for 30% of online payments in Poland and Przelewy24 provides a way for customers to pay with over 165 banks. /// Check this [page](https://stripe.com/docs/payments/p24) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, + pub p24: Option, + /// Configuration's parent configuration. Specify to create a child configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub parent: Option<&'a str>, /// PayNow is a Singapore-based payment method that allows customers to make a payment using their preferred app from participating banks and participating non-bank financial institutions. /// Check this [page](https://stripe.com/docs/payments/paynow) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, + pub paynow: Option, /// PayPal, a digital wallet popular with customers in Europe, allows your customers worldwide to pay using their PayPal account. /// Check this [page](https://stripe.com/docs/payments/paypal) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option, + pub paypal: Option, /// PromptPay is a Thailand-based payment method that allows customers to make a payment using their preferred app from participating banks. /// Check this [page](https://stripe.com/docs/payments/promptpay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay: Option, - /// Revolut Pay, developed by Revolut, a global finance app, is a digital wallet payment method. - /// Revolut Pay uses the customer’s stored balance or cards to fund the payment, and offers the option for non-Revolut customers to save their details after their first purchase. - #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, + pub promptpay: Option, /// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. /// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit: Option, + pub sepa_debit: Option, /// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. /// Check this [page](https://stripe.com/docs/payments/sofort) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, + pub sofort: Option, /// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. /// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: Option, + pub us_bank_account: Option, /// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. /// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. /// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. /// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option, + pub wechat_pay: Option, } -impl<'a> UpdatePaymentMethodConfiguration<'a> { +impl<'a> CreatePaymentMethodConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Canadian pre-authorized debit payments, check this [page](https://stripe.com/docs/payments/acss-debit) for more details like country availability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAcssDebit { +pub struct CreatePaymentMethodConfigurationBuilderAcssDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationAcssDebit { +impl CreatePaymentMethodConfigurationBuilderAcssDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAcssDebitDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationAcssDebitDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3105,10 +3403,12 @@ impl UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3117,18 +3417,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationAcssDebitDisplayPrefe } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationAcssDebitDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderAcssDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3140,38 +3446,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationAcssDebitDisplayPrefer /// Depending on the purchase, they can pay with four interest-free payments (Split Pay) or pay over a longer term (Installments), which might include interest. /// Check this [page](https://stripe.com/docs/payments/affirm) for more details like country availability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAffirm { +pub struct CreatePaymentMethodConfigurationBuilderAffirm { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationAffirm { +impl CreatePaymentMethodConfigurationBuilderAffirm { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAffirmDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderAffirmDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationAffirmDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderAffirmDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3180,10 +3487,12 @@ impl UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3192,18 +3501,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationAffirmDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationAffirmDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderAffirmDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3214,40 +3525,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationAffirmDisplayPreferenc /// Afterpay gives your customers a way to pay for purchases in installments, check this [page](https://stripe.com/docs/payments/afterpay-clearpay) for more details like country availability. /// Afterpay is particularly popular among businesses selling fashion, beauty, and sports products. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAfterpayClearpay { +pub struct CreatePaymentMethodConfigurationBuilderAfterpayClearpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] pub display_preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationAfterpayClearpay { +impl CreatePaymentMethodConfigurationBuilderAfterpayClearpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3257,11 +3568,11 @@ impl UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference } impl std::str::FromStr - for UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3271,7 +3582,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -3279,14 +3590,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentMethodConfigurationAfterpayClearpayDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderAfterpayClearpayDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -3300,38 +3611,39 @@ impl serde::Serialize /// Alipay has a low dispute rate and reduces fraud by authenticating payments using the customer's login credentials. /// Check this [page](https://stripe.com/docs/payments/alipay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAlipay { +pub struct CreatePaymentMethodConfigurationBuilderAlipay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationAlipay { +impl CreatePaymentMethodConfigurationBuilderAlipay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAlipayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderAlipayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationAlipayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderAlipayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3340,10 +3652,12 @@ impl UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3352,18 +3666,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationAlipayDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationAlipayDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderAlipayDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3375,38 +3691,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationAlipayDisplayPreferenc /// There are no additional fees to process Apple Pay payments, and the [pricing](/pricing) is the same as other card transactions. /// Check this [page](https://stripe.com/docs/apple-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationApplePay { +pub struct CreatePaymentMethodConfigurationBuilderApplePay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationApplePay { +impl CreatePaymentMethodConfigurationBuilderApplePay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationApplePayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderApplePayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationApplePayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderApplePayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3415,10 +3733,12 @@ impl UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3427,18 +3747,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationApplePayDisplayPrefer } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationApplePayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderApplePayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3448,39 +3774,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationApplePayDisplayPrefere } /// Apple Pay Later, a payment method for customers to buy now and pay later, gives your customers a way to split purchases into four installments across six weeks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationApplePayLater { +pub struct CreatePaymentMethodConfigurationBuilderApplePayLater { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationApplePayLater { +impl CreatePaymentMethodConfigurationBuilderApplePayLater { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationApplePayLaterDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationApplePayLaterDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3490,11 +3817,11 @@ impl UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { } impl std::str::FromStr - for UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3504,19 +3831,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationApplePayLaterDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderApplePayLaterDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3527,38 +3858,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationApplePayLaterDisplayPr /// Stripe users in Australia can accept Bulk Electronic Clearing System (BECS) direct debit payments from customers with an Australian bank account. /// Check this [page](https://stripe.com/docs/payments/au-becs-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAuBecsDebit { +pub struct CreatePaymentMethodConfigurationBuilderAuBecsDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationAuBecsDebit { +impl CreatePaymentMethodConfigurationBuilderAuBecsDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3567,10 +3900,12 @@ impl UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3579,18 +3914,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPre } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderAuBecsDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3600,38 +3941,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationAuBecsDebitDisplayPref } /// Stripe users in the UK can accept Bacs Direct Debit payments from customers with a UK bank account, check this [page](https://stripe.com/docs/payments/payment-methods/bacs-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBacsDebit { +pub struct CreatePaymentMethodConfigurationBuilderBacsDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationBacsDebit { +impl CreatePaymentMethodConfigurationBuilderBacsDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBacsDebitDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationBacsDebitDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3640,10 +3983,12 @@ impl UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3652,18 +3997,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationBacsDebitDisplayPrefe } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationBacsDebitDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderBacsDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3675,38 +4026,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationBacsDebitDisplayPrefer /// [Customers](https://stripe.com/docs/api/customers) use a Bancontact card or mobile app linked to a Belgian bank account to make online payments that are secure, guaranteed, and confirmed immediately. /// Check this [page](https://stripe.com/docs/payments/bancontact) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBancontact { +pub struct CreatePaymentMethodConfigurationBuilderBancontact { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationBancontact { +impl CreatePaymentMethodConfigurationBuilderBancontact { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBancontactDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderBancontactDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationBancontactDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderBancontactDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3715,10 +4068,12 @@ impl UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3727,18 +4082,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationBancontactDisplayPref } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationBancontactDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderBancontactDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3750,38 +4111,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationBancontactDisplayPrefe /// When customers want to pay online using BLIK, they request a six-digit code from their banking application and enter it into the payment collection form. /// Check this [page](https://stripe.com/docs/payments/blik) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBlik { +pub struct CreatePaymentMethodConfigurationBuilderBlik { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationBlik { +impl CreatePaymentMethodConfigurationBuilderBlik { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBlikDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderBlikDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationBlikDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderBlikDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3790,10 +4151,10 @@ impl UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3802,18 +4163,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationBlikDisplayPreference } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationBlikDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderBlikDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3824,38 +4185,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationBlikDisplayPreferenceP /// Boleto is an official (regulated by the Central Bank of Brazil) payment method in Brazil. /// Check this [page](https://stripe.com/docs/payments/boleto) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBoleto { +pub struct CreatePaymentMethodConfigurationBuilderBoleto { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationBoleto { +impl CreatePaymentMethodConfigurationBuilderBoleto { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationBoletoDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderBoletoDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationBoletoDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderBoletoDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3864,10 +4226,12 @@ impl UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3876,18 +4240,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationBoletoDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationBoletoDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderBoletoDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3898,38 +4264,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationBoletoDisplayPreferenc /// Cards are a popular way for consumers and businesses to pay online or in person. /// Stripe supports global and local card networks. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCard { +pub struct CreatePaymentMethodConfigurationBuilderCard { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationCard { +impl CreatePaymentMethodConfigurationBuilderCard { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCardDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderCardDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationCardDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderCardDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationCardDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -3938,10 +4304,10 @@ impl UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationCardDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -3950,18 +4316,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationCardDisplayPreference } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationCardDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderCardDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3973,40 +4339,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationCardDisplayPreferenceP /// More than 95% of these cards are co-branded with either Visa or Mastercard, meaning you can process these cards over either Cartes Bancaires or the Visa or Mastercard networks. /// Check this [page](https://stripe.com/docs/payments/cartes-bancaires) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCartesBancaires { +pub struct CreatePaymentMethodConfigurationBuilderCartesBancaires { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] pub display_preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationCartesBancaires { +impl CreatePaymentMethodConfigurationBuilderCartesBancaires { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCartesBancairesDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationCartesBancairesDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4016,11 +4382,11 @@ impl UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference } impl std::str::FromStr - for UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4030,7 +4396,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -4038,14 +4404,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentMethodConfigurationCartesBancairesDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCartesBancairesDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -4057,115 +4423,39 @@ impl serde::Serialize /// Cash App is a popular consumer app in the US that allows customers to bank, invest, send, and receive money using their digital wallet. /// Check this [page](https://stripe.com/docs/payments/cash-app-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCashapp { +pub struct CreatePaymentMethodConfigurationBuilderCashapp { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationCashapp { +impl CreatePaymentMethodConfigurationBuilderCashapp { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCashappDisplayPreference { - /// The account's preference for whether or not to display this payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, -} -impl UpdatePaymentMethodConfigurationCashappDisplayPreference { - pub fn new() -> Self { - Self::default() - } -} -/// The account's preference for whether or not to display this payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - None, - Off, - On, -} -impl UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference::*; - match self { - None => "none", - Off => "off", - On => "on", - } - } -} - -impl std::str::FromStr for UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference::*; - match s { - "none" => Ok(None), - "off" => Ok(Off), - "on" => Ok(On), - _ => Err(()), - } - } -} -impl std::fmt::Display for UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentMethodConfigurationCashappDisplayPreferencePreference { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Uses a customer’s [cash balance](https://stripe.com/docs/payments/customer-balance) for the payment. -/// The cash balance can be funded via a bank transfer. -/// Check this [page](https://stripe.com/docs/payments/bank-transfers) for more details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCustomerBalance { - /// Whether or not the payment method should be displayed. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: - Option, -} -impl UpdatePaymentMethodConfigurationCustomerBalance { - pub fn new() -> Self { - Self::default() - } -} -/// Whether or not the payment method should be displayed. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderCashappDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderCashappDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4175,11 +4465,11 @@ impl UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference } impl std::str::FromStr - for UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4189,22 +4479,20 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference -{ +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for UpdatePaymentMethodConfigurationCustomerBalanceDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderCashappDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where @@ -4217,38 +4505,38 @@ impl serde::Serialize /// EPS is supported by all Austrian banks and is accepted by over 80% of Austrian online retailers. /// Check this [page](https://stripe.com/docs/payments/eps) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationEps { +pub struct CreatePaymentMethodConfigurationBuilderEps { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationEps { +impl CreatePaymentMethodConfigurationBuilderEps { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationEpsDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderEpsDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationEpsDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderEpsDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4257,10 +4545,10 @@ impl UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4269,18 +4557,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationEpsDisplayPreferenceP } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationEpsDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderEpsDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4293,38 +4581,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationEpsDisplayPreferencePr /// It is one of the most popular online payment methods in Malaysia, with nearly 90 million transactions in 2018 according to BNM. /// Check this [page](https://stripe.com/docs/payments/fpx) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationFpx { +pub struct CreatePaymentMethodConfigurationBuilderFpx { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationFpx { +impl CreatePaymentMethodConfigurationBuilderFpx { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationFpxDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderFpxDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationFpxDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderFpxDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4333,10 +4621,10 @@ impl UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4345,18 +4633,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationFpxDisplayPreferenceP } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationFpxDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderFpxDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4370,38 +4658,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationFpxDisplayPreferencePr /// giropay accounts for 10% of online checkouts in Germany. /// Check this [page](https://stripe.com/docs/payments/giropay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGiropay { +pub struct CreatePaymentMethodConfigurationBuilderGiropay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationGiropay { +impl CreatePaymentMethodConfigurationBuilderGiropay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGiropayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderGiropayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationGiropayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderGiropayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4410,10 +4699,12 @@ impl UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4422,18 +4713,22 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationGiropayDisplayPrefere } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationGiropayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderGiropayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4445,38 +4740,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationGiropayDisplayPreferen /// Use the Google Pay API to request any credit or debit card stored in your customer's Google account. /// Check this [page](https://stripe.com/docs/google-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGooglePay { +pub struct CreatePaymentMethodConfigurationBuilderGooglePay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationGooglePay { +impl CreatePaymentMethodConfigurationBuilderGooglePay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGooglePayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationGooglePayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4485,10 +4782,12 @@ impl UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4497,18 +4796,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationGooglePayDisplayPrefe } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationGooglePayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderGooglePayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4520,38 +4825,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationGooglePayDisplayPrefer /// GrabPay is a digital wallet - customers maintain a balance in their wallets that they pay out with. /// Check this [page](https://stripe.com/docs/payments/grabpay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGrabpay { +pub struct CreatePaymentMethodConfigurationBuilderGrabpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationGrabpay { +impl CreatePaymentMethodConfigurationBuilderGrabpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationGrabpayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationGrabpayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4560,10 +4866,12 @@ impl UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4572,18 +4880,22 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationGrabpayDisplayPrefere } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationGrabpayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderGrabpayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4595,38 +4907,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationGrabpayDisplayPreferen /// All major Dutch banks are members of Currence, the scheme that operates iDEAL, making it the most popular online payment method in the Netherlands with a share of online transactions close to 55%. /// Check this [page](https://stripe.com/docs/payments/ideal) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationIdeal { +pub struct CreatePaymentMethodConfigurationBuilderIdeal { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationIdeal { +impl CreatePaymentMethodConfigurationBuilderIdeal { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationIdealDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderIdealDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationIdealDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderIdealDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4635,10 +4947,10 @@ impl UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4647,18 +4959,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationIdealDisplayPreferenc } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationIdealDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderIdealDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4670,38 +4982,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationIdealDisplayPreference /// JCB is currently available in Japan to businesses approved by JCB, and available to all businesses in Australia, Canada, Hong Kong, Japan, New Zealand, Singapore, Switzerland, United Kingdom, United States, and all countries in the European Economic Area except Iceland. /// Check this [page](https://support.stripe.com/questions/accepting-japan-credit-bureau-%28jcb%29-payments) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationJcb { +pub struct CreatePaymentMethodConfigurationBuilderJcb { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationJcb { +impl CreatePaymentMethodConfigurationBuilderJcb { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationJcbDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderJcbDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationJcbDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderJcbDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4710,10 +5022,10 @@ impl UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4722,18 +5034,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationJcbDisplayPreferenceP } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationJcbDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderJcbDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4746,38 +5058,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationJcbDisplayPreferencePr /// These payment options make it convenient for customers to purchase items in all price ranges. /// Check this [page](https://stripe.com/docs/payments/klarna) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationKlarna { +pub struct CreatePaymentMethodConfigurationBuilderKlarna { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationKlarna { +impl CreatePaymentMethodConfigurationBuilderKlarna { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationKlarnaDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationKlarnaDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4786,10 +5099,12 @@ impl UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4798,18 +5113,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationKlarnaDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationKlarnaDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderKlarnaDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4820,38 +5137,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationKlarnaDisplayPreferenc /// Konbini allows customers in Japan to pay for bills and online purchases at convenience stores with cash. /// Check this [page](https://stripe.com/docs/payments/konbini) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationKonbini { +pub struct CreatePaymentMethodConfigurationBuilderKonbini { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationKonbini { +impl CreatePaymentMethodConfigurationBuilderKonbini { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationKonbiniDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationKonbiniDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4860,10 +5178,12 @@ impl UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4872,18 +5192,22 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationKonbiniDisplayPrefere } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationKonbiniDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderKonbiniDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4894,38 +5218,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationKonbiniDisplayPreferen /// [Link](https://stripe.com/docs/payments/link) is a payment method network. /// With Link, users save their payment details once, then reuse that information to pay with one click for any business on the network. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationLink { +pub struct CreatePaymentMethodConfigurationBuilderLink { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationLink { +impl CreatePaymentMethodConfigurationBuilderLink { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationLinkDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderLinkDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationLinkDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderLinkDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -4934,10 +5258,10 @@ impl UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -4946,18 +5270,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationLinkDisplayPreference } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationLinkDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderLinkDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -4969,38 +5293,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationLinkDisplayPreferenceP /// OXXO allows customers to pay bills and online purchases in-store with cash. /// Check this [page](https://stripe.com/docs/payments/oxxo) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationOxxo { +pub struct CreatePaymentMethodConfigurationBuilderOxxo { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationOxxo { +impl CreatePaymentMethodConfigurationBuilderOxxo { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationOxxoDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderOxxoDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationOxxoDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderOxxoDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5009,10 +5333,10 @@ impl UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5021,18 +5345,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationOxxoDisplayPreference } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationOxxoDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderOxxoDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5044,38 +5368,38 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationOxxoDisplayPreferenceP /// Bank transfers account for 30% of online payments in Poland and Przelewy24 provides a way for customers to pay with over 165 banks. /// Check this [page](https://stripe.com/docs/payments/p24) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationP24 { +pub struct CreatePaymentMethodConfigurationBuilderP24 { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationP24 { +impl CreatePaymentMethodConfigurationBuilderP24 { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationP24DisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderP24DisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: Option, } -impl UpdatePaymentMethodConfigurationP24DisplayPreference { +impl CreatePaymentMethodConfigurationBuilderP24DisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationP24DisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5084,10 +5408,10 @@ impl UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::str::FromStr for CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationP24DisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5096,18 +5420,18 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationP24DisplayPreferenceP } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::fmt::Display for CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationP24DisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderP24DisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5118,38 +5442,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationP24DisplayPreferencePr /// PayNow is a Singapore-based payment method that allows customers to make a payment using their preferred app from participating banks and participating non-bank financial institutions. /// Check this [page](https://stripe.com/docs/payments/paynow) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPaynow { +pub struct CreatePaymentMethodConfigurationBuilderPaynow { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationPaynow { +impl CreatePaymentMethodConfigurationBuilderPaynow { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPaynowDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderPaynowDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationPaynowDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderPaynowDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5158,10 +5483,12 @@ impl UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5170,18 +5497,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationPaynowDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationPaynowDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderPaynowDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5192,38 +5521,39 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationPaynowDisplayPreferenc /// PayPal, a digital wallet popular with customers in Europe, allows your customers worldwide to pay using their PayPal account. /// Check this [page](https://stripe.com/docs/payments/paypal) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPaypal { +pub struct CreatePaymentMethodConfigurationBuilderPaypal { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationPaypal { +impl CreatePaymentMethodConfigurationBuilderPaypal { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPaypalDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderPaypalDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationPaypalDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderPaypalDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5232,10 +5562,12 @@ impl UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5244,18 +5576,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationPaypalDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationPaypalDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderPaypalDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5266,38 +5600,40 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationPaypalDisplayPreferenc /// PromptPay is a Thailand-based payment method that allows customers to make a payment using their preferred app from participating banks. /// Check this [page](https://stripe.com/docs/payments/promptpay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPromptpay { +pub struct CreatePaymentMethodConfigurationBuilderPromptpay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationPromptpay { +impl CreatePaymentMethodConfigurationBuilderPromptpay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationPromptpayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationPromptpayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5306,10 +5642,12 @@ impl UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5318,18 +5656,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationPromptpayDisplayPrefe } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationPromptpayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderPromptpayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5337,41 +5681,43 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationPromptpayDisplayPrefer serializer.serialize_str(self.as_str()) } } -/// Revolut Pay, developed by Revolut, a global finance app, is a digital wallet payment method. -/// Revolut Pay uses the customer’s stored balance or cards to fund the payment, and offers the option for non-Revolut customers to save their details after their first purchase. +/// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. +/// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationRevolutPay { +pub struct CreatePaymentMethodConfigurationBuilderSepaDebit { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationRevolutPay { +impl CreatePaymentMethodConfigurationBuilderSepaDebit { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationRevolutPayDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationRevolutPayDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5380,10 +5726,12 @@ impl UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5392,18 +5740,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationRevolutPayDisplayPref } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationRevolutPayDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderSepaDebitDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5411,41 +5765,42 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationRevolutPayDisplayPrefe serializer.serialize_str(self.as_str()) } } -/// The [Single Euro Payments Area (SEPA)](https://en.wikipedia.org/wiki/Single_Euro_Payments_Area) is an initiative of the European Union to simplify payments within and across member countries. -/// SEPA established and enforced banking standards to allow for the direct debiting of every EUR-denominated bank account within the SEPA region, check this [page](https://stripe.com/docs/payments/sepa-debit) for more details. +/// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. +/// Check this [page](https://stripe.com/docs/payments/sofort) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationSepaDebit { +pub struct CreatePaymentMethodConfigurationBuilderSofort { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: Option, } -impl UpdatePaymentMethodConfigurationSepaDebit { +impl CreatePaymentMethodConfigurationBuilderSofort { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationSepaDebitDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderSofortDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationSepaDebitDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderSofortDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5454,10 +5809,12 @@ impl UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5466,18 +5823,20 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationSepaDebitDisplayPrefe } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl std::fmt::Debug for CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationSepaDebitDisplayPreferencePreference { +impl serde::Serialize for CreatePaymentMethodConfigurationBuilderSofortDisplayPreferencePreference { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5485,41 +5844,43 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationSepaDebitDisplayPrefer serializer.serialize_str(self.as_str()) } } -/// Stripe users in Europe and the United States can use the [Payment Intents API](https://stripe.com/docs/payments/payment-intents)—a single integration path for creating payments using any supported method—to accept [Sofort](https://www.sofort.com/) payments from customers. -/// Check this [page](https://stripe.com/docs/payments/sofort) for more details. +/// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. +/// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationSofort { +pub struct CreatePaymentMethodConfigurationBuilderUsBankAccount { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationSofort { +impl CreatePaymentMethodConfigurationBuilderUsBankAccount { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationSofortDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, + pub preference: + Option, } -impl UpdatePaymentMethodConfigurationSofortDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5528,10 +5889,12 @@ impl UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { } } -impl std::str::FromStr for UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::str::FromStr + for CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5540,18 +5903,24 @@ impl std::str::FromStr for UpdatePaymentMethodConfigurationSofortDisplayPreferen } } } -impl std::fmt::Display for UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::fmt::Display + for CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationSofortDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderUsBankAccountDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5559,42 +5928,45 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationSofortDisplayPreferenc serializer.serialize_str(self.as_str()) } } -/// Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. -/// Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. +/// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. +/// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. +/// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. +/// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationUsBankAccount { +pub struct CreatePaymentMethodConfigurationBuilderWechatPay { /// Whether or not the payment method should be displayed. #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, + pub display_preference: + Option, } -impl UpdatePaymentMethodConfigurationUsBankAccount { +impl CreatePaymentMethodConfigurationBuilderWechatPay { pub fn new() -> Self { Self::default() } } /// Whether or not the payment method should be displayed. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationUsBankAccountDisplayPreference { +pub struct CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreference { /// The account's preference for whether or not to display this payment method. #[serde(skip_serializing_if = "Option::is_none")] pub preference: - Option, + Option, } -impl UpdatePaymentMethodConfigurationUsBankAccountDisplayPreference { +impl CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreference { pub fn new() -> Self { Self::default() } } /// The account's preference for whether or not to display this payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +pub enum CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { None, Off, On, } -impl UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference::*; match self { None => "none", Off => "off", @@ -5604,11 +5976,11 @@ impl UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { } impl std::str::FromStr - for UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { type Err = (); fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference::*; + use CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference::*; match s { "none" => Ok(None), "off" => Ok(Off), @@ -5618,19 +5990,23 @@ impl std::str::FromStr } } impl std::fmt::Display - for UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference + for CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl std::fmt::Debug + for CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdatePaymentMethodConfigurationUsBankAccountDisplayPreferencePreference { +impl serde::Serialize + for CreatePaymentMethodConfigurationBuilderWechatPayDisplayPreferencePreference +{ fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -5638,93 +6014,251 @@ impl serde::Serialize for UpdatePaymentMethodConfigurationUsBankAccountDisplayPr serializer.serialize_str(self.as_str()) } } -/// WeChat, owned by Tencent, is China's leading mobile app with over 1 billion monthly active users. -/// Chinese consumers can use WeChat Pay to pay for goods and services inside of businesses' apps and websites. -/// WeChat Pay users buy most frequently in gaming, e-commerce, travel, online education, and food/nutrition. -/// Check this [page](https://stripe.com/docs/payments/wechat-pay) for more details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationWechatPay { - /// Whether or not the payment method should be displayed. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_preference: Option, +/// Creates a payment method configuration +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePaymentMethodConfiguration<'a> { + inner: CreatePaymentMethodConfigurationBuilder<'a>, } -impl UpdatePaymentMethodConfigurationWechatPay { +impl<'a> CreatePaymentMethodConfiguration<'a> { pub fn new() -> Self { - Self::default() + Self { inner: CreatePaymentMethodConfigurationBuilder::new() } } -} -/// Whether or not the payment method should be displayed. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodConfigurationWechatPayDisplayPreference { - /// The account's preference for whether or not to display this payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub preference: Option, -} -impl UpdatePaymentMethodConfigurationWechatPayDisplayPreference { - pub fn new() -> Self { - Self::default() + pub fn acss_debit( + mut self, + acss_debit: CreatePaymentMethodConfigurationBuilderAcssDebit, + ) -> Self { + self.inner.acss_debit = Some(acss_debit); + self } -} -/// The account's preference for whether or not to display this payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - None, - Off, - On, -} -impl UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - pub fn as_str(self) -> &'static str { - use UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference::*; - match self { - None => "none", - Off => "off", - On => "on", - } + + pub fn affirm(mut self, affirm: CreatePaymentMethodConfigurationBuilderAffirm) -> Self { + self.inner.affirm = Some(affirm); + self } -} -impl std::str::FromStr for UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference::*; - match s { - "none" => Ok(None), - "off" => Ok(Off), - "on" => Ok(On), - _ => Err(()), - } + pub fn afterpay_clearpay( + mut self, + afterpay_clearpay: CreatePaymentMethodConfigurationBuilderAfterpayClearpay, + ) -> Self { + self.inner.afterpay_clearpay = Some(afterpay_clearpay); + self } -} -impl std::fmt::Display for UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + + pub fn alipay(mut self, alipay: CreatePaymentMethodConfigurationBuilderAlipay) -> Self { + self.inner.alipay = Some(alipay); + self } -} -impl std::fmt::Debug for UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn apple_pay(mut self, apple_pay: CreatePaymentMethodConfigurationBuilderApplePay) -> Self { + self.inner.apple_pay = Some(apple_pay); + self } -} -impl serde::Serialize for UpdatePaymentMethodConfigurationWechatPayDisplayPreferencePreference { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) + + pub fn apple_pay_later( + mut self, + apple_pay_later: CreatePaymentMethodConfigurationBuilderApplePayLater, + ) -> Self { + self.inner.apple_pay_later = Some(apple_pay_later); + self + } + + pub fn au_becs_debit( + mut self, + au_becs_debit: CreatePaymentMethodConfigurationBuilderAuBecsDebit, + ) -> Self { + self.inner.au_becs_debit = Some(au_becs_debit); + self + } + + pub fn bacs_debit( + mut self, + bacs_debit: CreatePaymentMethodConfigurationBuilderBacsDebit, + ) -> Self { + self.inner.bacs_debit = Some(bacs_debit); + self + } + + pub fn bancontact( + mut self, + bancontact: CreatePaymentMethodConfigurationBuilderBancontact, + ) -> Self { + self.inner.bancontact = Some(bancontact); + self + } + + pub fn blik(mut self, blik: CreatePaymentMethodConfigurationBuilderBlik) -> Self { + self.inner.blik = Some(blik); + self + } + + pub fn boleto(mut self, boleto: CreatePaymentMethodConfigurationBuilderBoleto) -> Self { + self.inner.boleto = Some(boleto); + self + } + + pub fn card(mut self, card: CreatePaymentMethodConfigurationBuilderCard) -> Self { + self.inner.card = Some(card); + self + } + + pub fn cartes_bancaires( + mut self, + cartes_bancaires: CreatePaymentMethodConfigurationBuilderCartesBancaires, + ) -> Self { + self.inner.cartes_bancaires = Some(cartes_bancaires); + self + } + + pub fn cashapp(mut self, cashapp: CreatePaymentMethodConfigurationBuilderCashapp) -> Self { + self.inner.cashapp = Some(cashapp); + self + } + + pub fn eps(mut self, eps: CreatePaymentMethodConfigurationBuilderEps) -> Self { + self.inner.eps = Some(eps); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fpx(mut self, fpx: CreatePaymentMethodConfigurationBuilderFpx) -> Self { + self.inner.fpx = Some(fpx); + self + } + + pub fn giropay(mut self, giropay: CreatePaymentMethodConfigurationBuilderGiropay) -> Self { + self.inner.giropay = Some(giropay); + self + } + + pub fn google_pay( + mut self, + google_pay: CreatePaymentMethodConfigurationBuilderGooglePay, + ) -> Self { + self.inner.google_pay = Some(google_pay); + self + } + + pub fn grabpay(mut self, grabpay: CreatePaymentMethodConfigurationBuilderGrabpay) -> Self { + self.inner.grabpay = Some(grabpay); + self + } + + pub fn ideal(mut self, ideal: CreatePaymentMethodConfigurationBuilderIdeal) -> Self { + self.inner.ideal = Some(ideal); + self + } + + pub fn jcb(mut self, jcb: CreatePaymentMethodConfigurationBuilderJcb) -> Self { + self.inner.jcb = Some(jcb); + self + } + + pub fn klarna(mut self, klarna: CreatePaymentMethodConfigurationBuilderKlarna) -> Self { + self.inner.klarna = Some(klarna); + self + } + + pub fn konbini(mut self, konbini: CreatePaymentMethodConfigurationBuilderKonbini) -> Self { + self.inner.konbini = Some(konbini); + self + } + + pub fn link(mut self, link: CreatePaymentMethodConfigurationBuilderLink) -> Self { + self.inner.link = Some(link); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn oxxo(mut self, oxxo: CreatePaymentMethodConfigurationBuilderOxxo) -> Self { + self.inner.oxxo = Some(oxxo); + self + } + + pub fn p24(mut self, p24: CreatePaymentMethodConfigurationBuilderP24) -> Self { + self.inner.p24 = Some(p24); + self + } + + pub fn parent(mut self, parent: &'a str) -> Self { + self.inner.parent = Some(parent); + self + } + + pub fn paynow(mut self, paynow: CreatePaymentMethodConfigurationBuilderPaynow) -> Self { + self.inner.paynow = Some(paynow); + self + } + + pub fn paypal(mut self, paypal: CreatePaymentMethodConfigurationBuilderPaypal) -> Self { + self.inner.paypal = Some(paypal); + self + } + + pub fn promptpay( + mut self, + promptpay: CreatePaymentMethodConfigurationBuilderPromptpay, + ) -> Self { + self.inner.promptpay = Some(promptpay); + self + } + + pub fn sepa_debit( + mut self, + sepa_debit: CreatePaymentMethodConfigurationBuilderSepaDebit, + ) -> Self { + self.inner.sepa_debit = Some(sepa_debit); + self + } + + pub fn sofort(mut self, sofort: CreatePaymentMethodConfigurationBuilderSofort) -> Self { + self.inner.sofort = Some(sofort); + self + } + + pub fn us_bank_account( + mut self, + us_bank_account: CreatePaymentMethodConfigurationBuilderUsBankAccount, + ) -> Self { + self.inner.us_bank_account = Some(us_bank_account); + self + } + + pub fn wechat_pay( + mut self, + wechat_pay: CreatePaymentMethodConfigurationBuilderWechatPay, + ) -> Self { + self.inner.wechat_pay = Some(wechat_pay); + self } } -impl<'a> UpdatePaymentMethodConfiguration<'a> { - /// Update payment method configuration - pub fn send( +impl CreatePaymentMethodConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_payment::PaymentMethodConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_method_configurations/{configuration}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePaymentMethodConfiguration<'_> { + type Output = stripe_payment::PaymentMethodConfiguration; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payment_method_configurations").form(&self.inner) } } diff --git a/generated/stripe_payment/src/payment_method_configuration/types.rs b/generated/stripe_payment/src/payment_method_configuration/types.rs index 2dd733767..d95e1828d 100644 --- a/generated/stripe_payment/src/payment_method_configuration/types.rs +++ b/generated/stripe_payment/src/payment_method_configuration/types.rs @@ -53,9 +53,6 @@ pub struct PaymentMethodConfiguration { #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: - Option, - #[serde(skip_serializing_if = "Option::is_none")] pub eps: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fpx: Option, @@ -68,6 +65,9 @@ pub struct PaymentMethodConfiguration { /// Unique identifier for the object. pub id: stripe_payment::PaymentMethodConfigurationId, #[serde(skip_serializing_if = "Option::is_none")] + pub id_bank_transfer: + Option, + #[serde(skip_serializing_if = "Option::is_none")] pub ideal: Option, /// The default configuration is used whenever a payment method configuration is not specified. pub is_default: bool, @@ -81,27 +81,33 @@ pub struct PaymentMethodConfiguration { pub link: Option, /// 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, + #[serde(skip_serializing_if = "Option::is_none")] + pub multibanco: Option, /// The configuration's name. pub name: String, #[serde(skip_serializing_if = "Option::is_none")] + pub netbanking: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub oxxo: Option, #[serde(skip_serializing_if = "Option::is_none")] pub p24: Option, /// For child configs, the configuration's parent configuration. pub parent: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub pay_by_bank: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub paynow: Option, #[serde(skip_serializing_if = "Option::is_none")] pub paypal: Option, #[serde(skip_serializing_if = "Option::is_none")] pub promptpay: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub sepa_debit: Option, #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub upi: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: Option, #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option, diff --git a/generated/stripe_payment/src/payment_method_domain/requests.rs b/generated/stripe_payment/src/payment_method_domain/requests.rs index 15a45c4a2..73b036733 100644 --- a/generated/stripe_payment/src/payment_method_domain/requests.rs +++ b/generated/stripe_payment/src/payment_method_domain/requests.rs @@ -1,5 +1,63 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPaymentMethodDomain<'a> { +pub struct RetrievePaymentMethodDomainBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePaymentMethodDomainBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing payment method domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePaymentMethodDomain<'a> { + inner: RetrievePaymentMethodDomainBuilder<'a>, + payment_method_domain: &'a stripe_payment::PaymentMethodDomainId, +} +impl<'a> RetrievePaymentMethodDomain<'a> { + pub fn new(payment_method_domain: &'a stripe_payment::PaymentMethodDomainId) -> Self { + Self { payment_method_domain, inner: RetrievePaymentMethodDomainBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePaymentMethodDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePaymentMethodDomain<'_> { + type Output = stripe_payment::PaymentMethodDomain; + + fn build(&self) -> RequestBuilder { + let payment_method_domain = self.payment_method_domain; + RequestBuilder::new( + StripeMethod::Get, + format!("/payment_method_domains/{payment_method_domain}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListPaymentMethodDomainBuilder<'a> { /// The domain name that this payment method domain object represents. #[serde(skip_serializing_if = "Option::is_none")] pub domain_name: Option<&'a str>, @@ -25,48 +83,75 @@ pub struct ListPaymentMethodDomain<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListPaymentMethodDomain<'a> { +impl<'a> ListPaymentMethodDomainBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Lists the details of existing payment method domains. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPaymentMethodDomain<'a> { + inner: ListPaymentMethodDomainBuilder<'a>, +} impl<'a> ListPaymentMethodDomain<'a> { - /// Lists the details of existing payment method domains. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/payment_method_domains", self) + pub fn new() -> Self { + Self { inner: ListPaymentMethodDomainBuilder::new() } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/payment_method_domains", self) + pub fn domain_name(mut self, domain_name: &'a str) -> Self { + self.inner.domain_name = Some(domain_name); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePaymentMethodDomain<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePaymentMethodDomain<'a> { - pub fn new() -> Self { - Self::default() + + pub fn enabled(mut self, enabled: bool) -> Self { + self.inner.enabled = Some(enabled); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrievePaymentMethodDomain<'a> { - /// Retrieves the details of an existing payment method domain. - pub fn send( +impl ListPaymentMethodDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_method_domain: &stripe_payment::PaymentMethodDomainId, - ) -> stripe::Response { - client.get_query(&format!("/payment_method_domains/{payment_method_domain}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPaymentMethodDomain<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/payment_method_domains").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentMethodDomain<'a> { +pub struct CreatePaymentMethodDomainBuilder<'a> { /// The domain name that this payment method domain object represents. pub domain_name: &'a str, /// Whether this payment method domain is enabled. @@ -77,22 +162,55 @@ pub struct CreatePaymentMethodDomain<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CreatePaymentMethodDomain<'a> { +impl<'a> CreatePaymentMethodDomainBuilder<'a> { pub fn new(domain_name: &'a str) -> Self { Self { domain_name, enabled: None, expand: None } } } +/// Creates a payment method domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePaymentMethodDomain<'a> { + inner: CreatePaymentMethodDomainBuilder<'a>, +} impl<'a> CreatePaymentMethodDomain<'a> { - /// Creates a payment method domain. - pub fn send( + pub fn new(domain_name: &'a str) -> Self { + Self { inner: CreatePaymentMethodDomainBuilder::new(domain_name) } + } + pub fn enabled(mut self, enabled: bool) -> Self { + self.inner.enabled = Some(enabled); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CreatePaymentMethodDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/payment_method_domains", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePaymentMethodDomain<'_> { + type Output = stripe_payment::PaymentMethodDomain; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/payment_method_domains").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodDomain<'a> { +pub struct UpdatePaymentMethodDomainBuilder<'a> { /// Whether this payment method domain is enabled. /// If the domain is not enabled, payment methods that require a payment method domain will not appear in Elements. #[serde(skip_serializing_if = "Option::is_none")] @@ -101,53 +219,116 @@ pub struct UpdatePaymentMethodDomain<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> UpdatePaymentMethodDomain<'a> { +impl<'a> UpdatePaymentMethodDomainBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates an existing payment method domain. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePaymentMethodDomain<'a> { + inner: UpdatePaymentMethodDomainBuilder<'a>, + payment_method_domain: &'a stripe_payment::PaymentMethodDomainId, +} impl<'a> UpdatePaymentMethodDomain<'a> { - /// Updates an existing payment method domain. - pub fn send( + pub fn new(payment_method_domain: &'a stripe_payment::PaymentMethodDomainId) -> Self { + Self { payment_method_domain, inner: UpdatePaymentMethodDomainBuilder::new() } + } + pub fn enabled(mut self, enabled: bool) -> Self { + self.inner.enabled = Some(enabled); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl UpdatePaymentMethodDomain<'_> { + pub async fn send( &self, - client: &stripe::Client, - payment_method_domain: &stripe_payment::PaymentMethodDomainId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_method_domains/{payment_method_domain}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePaymentMethodDomain<'_> { + type Output = stripe_payment::PaymentMethodDomain; + + fn build(&self) -> RequestBuilder { + let payment_method_domain = self.payment_method_domain; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_method_domains/{payment_method_domain}"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ValidatePaymentMethodDomain<'a> { +pub struct ValidatePaymentMethodDomainBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> ValidatePaymentMethodDomain<'a> { +impl<'a> ValidatePaymentMethodDomainBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Some payment methods such as Apple Pay require additional steps to verify a domain. +/// If the requirements weren’t satisfied when the domain was created, the payment method will be inactive on the domain. +/// The payment method doesn’t appear in Elements for this domain until it is active. +/// +/// To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint. +/// +/// Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration). +#[derive(Clone, Debug, serde::Serialize)] +pub struct ValidatePaymentMethodDomain<'a> { + inner: ValidatePaymentMethodDomainBuilder<'a>, + payment_method_domain: &'a stripe_payment::PaymentMethodDomainId, +} impl<'a> ValidatePaymentMethodDomain<'a> { - /// Some payment methods such as Apple Pay require additional steps to verify a domain. - /// If the requirements weren’t satisfied when the domain was created, the payment method will be inactive on the domain. - /// The payment method doesn’t appear in Elements for this domain until it is active. - /// - /// To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint. - /// - /// Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration). - pub fn send( + pub fn new(payment_method_domain: &'a stripe_payment::PaymentMethodDomainId) -> Self { + Self { payment_method_domain, inner: ValidatePaymentMethodDomainBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl ValidatePaymentMethodDomain<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - payment_method_domain: &stripe_payment::PaymentMethodDomainId, - ) -> stripe::Response { - client.send_form( - &format!("/payment_method_domains/{payment_method_domain}/validate"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ValidatePaymentMethodDomain<'_> { + type Output = stripe_payment::PaymentMethodDomain; + + fn build(&self) -> RequestBuilder { + let payment_method_domain = self.payment_method_domain; + RequestBuilder::new( + StripeMethod::Post, + format!("/payment_method_domains/{payment_method_domain}/validate"), ) + .form(&self.inner) } } diff --git a/generated/stripe_payment/src/source/requests.rs b/generated/stripe_payment/src/source/requests.rs index e8595713f..9d6012245 100644 --- a/generated/stripe_payment/src/source/requests.rs +++ b/generated/stripe_payment/src/source/requests.rs @@ -1,27 +1,58 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DetachSource<'a> { +pub struct DetachSourceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> DetachSource<'a> { +impl<'a> DetachSourceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Delete a specified source for a given customer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DetachSource<'a> { + inner: DetachSourceBuilder<'a>, + customer: &'a stripe_shared::CustomerId, + id: &'a str, +} impl<'a> DetachSource<'a> { - /// Delete a specified source for a given customer. - pub fn send( + pub fn new(customer: &'a stripe_shared::CustomerId, id: &'a str) -> Self { + Self { customer, id, inner: DetachSourceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl DetachSource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - customer: &stripe_shared::CustomerId, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/customers/{customer}/sources/{id}"), - self, - http_types::Method::Delete, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DetachSource<'_> { + type Output = DetachSourceReturned; + + fn build(&self) -> RequestBuilder { + let customer = self.customer; + let id = self.id; + RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/sources/{id}")) + .form(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -31,7 +62,7 @@ pub enum DetachSourceReturned { DeletedPaymentSource(stripe_shared::DeletedPaymentSource), } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveSource<'a> { +pub struct RetrieveSourceBuilder<'a> { /// The client secret of the source. Required if a publishable key is used to retrieve the source. #[serde(skip_serializing_if = "Option::is_none")] pub client_secret: Option<&'a str>, @@ -39,68 +70,58 @@ pub struct RetrieveSource<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveSource<'a> { +impl<'a> RetrieveSourceBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves an existing source object. +/// Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveSource<'a> { + inner: RetrieveSourceBuilder<'a>, + source: &'a stripe_shared::SourceId, +} impl<'a> RetrieveSource<'a> { - /// Retrieves an existing source object. - /// Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information. - pub fn send( - &self, - client: &stripe::Client, - source: &stripe_shared::SourceId, - ) -> stripe::Response { - client.get_query(&format!("/sources/{source}"), self) + pub fn new(source: &'a stripe_shared::SourceId) -> Self { + Self { source, inner: RetrieveSourceBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct SourceTransactionsSource<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> SourceTransactionsSource<'a> { - pub fn new() -> Self { - Self::default() + pub fn client_secret(mut self, client_secret: &'a str) -> Self { + self.inner.client_secret = Some(client_secret); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> SourceTransactionsSource<'a> { - /// List source transactions for a given source. - pub fn send( +impl RetrieveSource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - source: &stripe_shared::SourceId, - ) -> stripe::Response> { - client.get_query(&format!("/sources/{source}/source_transactions"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - source: &stripe_shared::SourceId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params( - &format!("/sources/{source}/source_transactions"), - self, - ) +} + +impl StripeRequest for RetrieveSource<'_> { + type Output = stripe_shared::Source; + + fn build(&self) -> RequestBuilder { + let source = self.source; + RequestBuilder::new(StripeMethod::Get, format!("/sources/{source}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSource<'a> { +pub struct CreateSourceBuilder<'a> { /// Amount associated with the source. /// This is the amount for which the source will be chargeable once ready. /// Required for `single_use` sources. @@ -122,10 +143,10 @@ pub struct CreateSource<'a> { /// `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. /// It is generally inferred unless a type supports multiple flows. #[serde(skip_serializing_if = "Option::is_none")] - pub flow: Option, + pub flow: Option, /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate: Option>, + pub mandate: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, /// The source to share. @@ -137,15 +158,15 @@ pub struct CreateSource<'a> { /// Optional parameters for the receiver flow. /// Can be set only if the source is a receiver (`flow` is `receiver`). #[serde(skip_serializing_if = "Option::is_none")] - pub receiver: Option, + pub receiver: Option, /// Parameters required for the redirect flow. /// Required if the source is authenticated by a redirect (`flow` is `redirect`). #[serde(skip_serializing_if = "Option::is_none")] - pub redirect: Option>, + pub redirect: Option>, /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[serde(skip_serializing_if = "Option::is_none")] - pub source_order: Option>, + pub source_order: Option>, /// An arbitrary string to be displayed on your customer's statement. /// As an example, if your website is `RunClub` and the item you're charging for is a race ticket, you may want to specify a `statement_descriptor` of `RunClub 5K race ticket.` While many payment types will display this information, some may not display it at all. #[serde(skip_serializing_if = "Option::is_none")] @@ -160,9 +181,9 @@ pub struct CreateSource<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] - pub usage: Option, + pub usage: Option, } -impl<'a> CreateSource<'a> { +impl<'a> CreateSourceBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -171,15 +192,15 @@ impl<'a> CreateSource<'a> { /// `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. /// It is generally inferred unless a type supports multiple flows. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceFlow { +pub enum CreateSourceBuilderFlow { CodeVerification, None, Receiver, Redirect, } -impl CreateSourceFlow { +impl CreateSourceBuilderFlow { pub fn as_str(self) -> &'static str { - use CreateSourceFlow::*; + use CreateSourceBuilderFlow::*; match self { CodeVerification => "code_verification", None => "none", @@ -189,10 +210,10 @@ impl CreateSourceFlow { } } -impl std::str::FromStr for CreateSourceFlow { +impl std::str::FromStr for CreateSourceBuilderFlow { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceFlow::*; + use CreateSourceBuilderFlow::*; match s { "code_verification" => Ok(CodeVerification), "none" => Ok(None), @@ -202,18 +223,18 @@ impl std::str::FromStr for CreateSourceFlow { } } } -impl std::fmt::Display for CreateSourceFlow { +impl std::fmt::Display for CreateSourceBuilderFlow { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceFlow { +impl std::fmt::Debug for CreateSourceBuilderFlow { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceFlow { +impl serde::Serialize for CreateSourceBuilderFlow { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -223,10 +244,10 @@ impl serde::Serialize for CreateSourceFlow { } /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceMandate<'a> { +pub struct CreateSourceBuilderMandate<'a> { /// The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub acceptance: Option>, + pub acceptance: Option>, /// The amount specified by the mandate. (Leave null for a mandate covering all amounts) #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -236,20 +257,20 @@ pub struct CreateSourceMandate<'a> { /// The interval of debits permitted by the mandate. /// Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency). #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, + pub interval: Option, /// The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. /// Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). #[serde(skip_serializing_if = "Option::is_none")] - pub notification_method: Option, + pub notification_method: Option, } -impl<'a> CreateSourceMandate<'a> { +impl<'a> CreateSourceBuilderMandate<'a> { pub fn new() -> Self { Self::default() } } /// The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSourceMandateAcceptance<'a> { +pub struct CreateSourceBuilderMandateAcceptance<'a> { /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub date: Option, @@ -266,17 +287,17 @@ pub struct CreateSourceMandateAcceptance<'a> { pub online: Option>, /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). - pub status: CreateSourceMandateAcceptanceStatus, + pub status: CreateSourceBuilderMandateAcceptanceStatus, /// The type of acceptance information included with the mandate. Either `online` or `offline` #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// The user agent of the browser from which the mandate was accepted or refused by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> CreateSourceMandateAcceptance<'a> { - pub fn new(status: CreateSourceMandateAcceptanceStatus) -> Self { +impl<'a> CreateSourceBuilderMandateAcceptance<'a> { + pub fn new(status: CreateSourceBuilderMandateAcceptanceStatus) -> Self { Self { date: None, ip: None, @@ -291,15 +312,15 @@ impl<'a> CreateSourceMandateAcceptance<'a> { /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceMandateAcceptanceStatus { +pub enum CreateSourceBuilderMandateAcceptanceStatus { Accepted, Pending, Refused, Revoked, } -impl CreateSourceMandateAcceptanceStatus { +impl CreateSourceBuilderMandateAcceptanceStatus { pub fn as_str(self) -> &'static str { - use CreateSourceMandateAcceptanceStatus::*; + use CreateSourceBuilderMandateAcceptanceStatus::*; match self { Accepted => "accepted", Pending => "pending", @@ -309,10 +330,10 @@ impl CreateSourceMandateAcceptanceStatus { } } -impl std::str::FromStr for CreateSourceMandateAcceptanceStatus { +impl std::str::FromStr for CreateSourceBuilderMandateAcceptanceStatus { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceMandateAcceptanceStatus::*; + use CreateSourceBuilderMandateAcceptanceStatus::*; match s { "accepted" => Ok(Accepted), "pending" => Ok(Pending), @@ -322,18 +343,18 @@ impl std::str::FromStr for CreateSourceMandateAcceptanceStatus { } } } -impl std::fmt::Display for CreateSourceMandateAcceptanceStatus { +impl std::fmt::Display for CreateSourceBuilderMandateAcceptanceStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceMandateAcceptanceStatus { +impl std::fmt::Debug for CreateSourceBuilderMandateAcceptanceStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceMandateAcceptanceStatus { +impl serde::Serialize for CreateSourceBuilderMandateAcceptanceStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -343,13 +364,13 @@ impl serde::Serialize for CreateSourceMandateAcceptanceStatus { } /// The type of acceptance information included with the mandate. Either `online` or `offline` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceMandateAcceptanceType { +pub enum CreateSourceBuilderMandateAcceptanceType { Offline, Online, } -impl CreateSourceMandateAcceptanceType { +impl CreateSourceBuilderMandateAcceptanceType { pub fn as_str(self) -> &'static str { - use CreateSourceMandateAcceptanceType::*; + use CreateSourceBuilderMandateAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -357,10 +378,10 @@ impl CreateSourceMandateAcceptanceType { } } -impl std::str::FromStr for CreateSourceMandateAcceptanceType { +impl std::str::FromStr for CreateSourceBuilderMandateAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceMandateAcceptanceType::*; + use CreateSourceBuilderMandateAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -368,18 +389,18 @@ impl std::str::FromStr for CreateSourceMandateAcceptanceType { } } } -impl std::fmt::Display for CreateSourceMandateAcceptanceType { +impl std::fmt::Display for CreateSourceBuilderMandateAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceMandateAcceptanceType { +impl std::fmt::Debug for CreateSourceBuilderMandateAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceMandateAcceptanceType { +impl serde::Serialize for CreateSourceBuilderMandateAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -390,14 +411,14 @@ impl serde::Serialize for CreateSourceMandateAcceptanceType { /// The interval of debits permitted by the mandate. /// Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceMandateInterval { +pub enum CreateSourceBuilderMandateInterval { OneTime, Scheduled, Variable, } -impl CreateSourceMandateInterval { +impl CreateSourceBuilderMandateInterval { pub fn as_str(self) -> &'static str { - use CreateSourceMandateInterval::*; + use CreateSourceBuilderMandateInterval::*; match self { OneTime => "one_time", Scheduled => "scheduled", @@ -406,10 +427,10 @@ impl CreateSourceMandateInterval { } } -impl std::str::FromStr for CreateSourceMandateInterval { +impl std::str::FromStr for CreateSourceBuilderMandateInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceMandateInterval::*; + use CreateSourceBuilderMandateInterval::*; match s { "one_time" => Ok(OneTime), "scheduled" => Ok(Scheduled), @@ -418,18 +439,18 @@ impl std::str::FromStr for CreateSourceMandateInterval { } } } -impl std::fmt::Display for CreateSourceMandateInterval { +impl std::fmt::Display for CreateSourceBuilderMandateInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceMandateInterval { +impl std::fmt::Debug for CreateSourceBuilderMandateInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceMandateInterval { +impl serde::Serialize for CreateSourceBuilderMandateInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -440,16 +461,16 @@ impl serde::Serialize for CreateSourceMandateInterval { /// The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. /// Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceMandateNotificationMethod { +pub enum CreateSourceBuilderMandateNotificationMethod { DeprecatedNone, Email, Manual, None, StripeEmail, } -impl CreateSourceMandateNotificationMethod { +impl CreateSourceBuilderMandateNotificationMethod { pub fn as_str(self) -> &'static str { - use CreateSourceMandateNotificationMethod::*; + use CreateSourceBuilderMandateNotificationMethod::*; match self { DeprecatedNone => "deprecated_none", Email => "email", @@ -460,10 +481,10 @@ impl CreateSourceMandateNotificationMethod { } } -impl std::str::FromStr for CreateSourceMandateNotificationMethod { +impl std::str::FromStr for CreateSourceBuilderMandateNotificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceMandateNotificationMethod::*; + use CreateSourceBuilderMandateNotificationMethod::*; match s { "deprecated_none" => Ok(DeprecatedNone), "email" => Ok(Email), @@ -474,18 +495,18 @@ impl std::str::FromStr for CreateSourceMandateNotificationMethod { } } } -impl std::fmt::Display for CreateSourceMandateNotificationMethod { +impl std::fmt::Display for CreateSourceBuilderMandateNotificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceMandateNotificationMethod { +impl std::fmt::Debug for CreateSourceBuilderMandateNotificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceMandateNotificationMethod { +impl serde::Serialize for CreateSourceBuilderMandateNotificationMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -496,14 +517,14 @@ impl serde::Serialize for CreateSourceMandateNotificationMethod { /// Optional parameters for the receiver flow. /// Can be set only if the source is a receiver (`flow` is `receiver`). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceReceiver { +pub struct CreateSourceBuilderReceiver { /// The method Stripe should use to request information needed to process a refund or mispayment. /// Either `email` (an email is sent directly to the customer) or `manual` (a `source.refund_attributes_required` event is sent to your webhooks endpoint). /// Refer to each payment method's documentation to learn which refund attributes may be required. #[serde(skip_serializing_if = "Option::is_none")] - pub refund_attributes_method: Option, + pub refund_attributes_method: Option, } -impl CreateSourceReceiver { +impl CreateSourceBuilderReceiver { pub fn new() -> Self { Self::default() } @@ -512,14 +533,14 @@ impl CreateSourceReceiver { /// Either `email` (an email is sent directly to the customer) or `manual` (a `source.refund_attributes_required` event is sent to your webhooks endpoint). /// Refer to each payment method's documentation to learn which refund attributes may be required. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceReceiverRefundAttributesMethod { +pub enum CreateSourceBuilderReceiverRefundAttributesMethod { Email, Manual, None, } -impl CreateSourceReceiverRefundAttributesMethod { +impl CreateSourceBuilderReceiverRefundAttributesMethod { pub fn as_str(self) -> &'static str { - use CreateSourceReceiverRefundAttributesMethod::*; + use CreateSourceBuilderReceiverRefundAttributesMethod::*; match self { Email => "email", Manual => "manual", @@ -528,10 +549,10 @@ impl CreateSourceReceiverRefundAttributesMethod { } } -impl std::str::FromStr for CreateSourceReceiverRefundAttributesMethod { +impl std::str::FromStr for CreateSourceBuilderReceiverRefundAttributesMethod { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceReceiverRefundAttributesMethod::*; + use CreateSourceBuilderReceiverRefundAttributesMethod::*; match s { "email" => Ok(Email), "manual" => Ok(Manual), @@ -540,18 +561,18 @@ impl std::str::FromStr for CreateSourceReceiverRefundAttributesMethod { } } } -impl std::fmt::Display for CreateSourceReceiverRefundAttributesMethod { +impl std::fmt::Display for CreateSourceBuilderReceiverRefundAttributesMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceReceiverRefundAttributesMethod { +impl std::fmt::Debug for CreateSourceBuilderReceiverRefundAttributesMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceReceiverRefundAttributesMethod { +impl serde::Serialize for CreateSourceBuilderReceiverRefundAttributesMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -562,12 +583,12 @@ impl serde::Serialize for CreateSourceReceiverRefundAttributesMethod { /// Parameters required for the redirect flow. /// Required if the source is authenticated by a redirect (`flow` is `redirect`). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSourceRedirect<'a> { +pub struct CreateSourceBuilderRedirect<'a> { /// The URL you provide to redirect the customer back to you after they authenticated their payment. /// It can use your application URI scheme in the context of a mobile application. pub return_url: &'a str, } -impl<'a> CreateSourceRedirect<'a> { +impl<'a> CreateSourceBuilderRedirect<'a> { pub fn new(return_url: &'a str) -> Self { Self { return_url } } @@ -575,23 +596,23 @@ impl<'a> CreateSourceRedirect<'a> { /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceSourceOrder<'a> { +pub struct CreateSourceBuilderSourceOrder<'a> { /// List of items constituting the order. #[serde(skip_serializing_if = "Option::is_none")] - pub items: Option<&'a [CreateSourceSourceOrderItems<'a>]>, + pub items: Option<&'a [CreateSourceBuilderSourceOrderItems<'a>]>, /// Shipping address for the order. /// Required if any of the SKUs are for products that have `shippable` set to true. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option>, } -impl<'a> CreateSourceSourceOrder<'a> { +impl<'a> CreateSourceBuilderSourceOrder<'a> { pub fn new() -> Self { Self::default() } } /// List of items constituting the order. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceSourceOrderItems<'a> { +pub struct CreateSourceBuilderSourceOrderItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -607,23 +628,23 @@ pub struct CreateSourceSourceOrderItems<'a> { pub quantity: Option, #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> CreateSourceSourceOrderItems<'a> { +impl<'a> CreateSourceBuilderSourceOrderItems<'a> { pub fn new() -> Self { Self::default() } } #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceSourceOrderItemsType { +pub enum CreateSourceBuilderSourceOrderItemsType { Discount, Shipping, Sku, Tax, } -impl CreateSourceSourceOrderItemsType { +impl CreateSourceBuilderSourceOrderItemsType { pub fn as_str(self) -> &'static str { - use CreateSourceSourceOrderItemsType::*; + use CreateSourceBuilderSourceOrderItemsType::*; match self { Discount => "discount", Shipping => "shipping", @@ -633,10 +654,10 @@ impl CreateSourceSourceOrderItemsType { } } -impl std::str::FromStr for CreateSourceSourceOrderItemsType { +impl std::str::FromStr for CreateSourceBuilderSourceOrderItemsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceSourceOrderItemsType::*; + use CreateSourceBuilderSourceOrderItemsType::*; match s { "discount" => Ok(Discount), "shipping" => Ok(Shipping), @@ -646,18 +667,18 @@ impl std::str::FromStr for CreateSourceSourceOrderItemsType { } } } -impl std::fmt::Display for CreateSourceSourceOrderItemsType { +impl std::fmt::Display for CreateSourceBuilderSourceOrderItemsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceSourceOrderItemsType { +impl std::fmt::Debug for CreateSourceBuilderSourceOrderItemsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceSourceOrderItemsType { +impl serde::Serialize for CreateSourceBuilderSourceOrderItemsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -666,13 +687,13 @@ impl serde::Serialize for CreateSourceSourceOrderItemsType { } } #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSourceUsage { +pub enum CreateSourceBuilderUsage { Reusable, SingleUse, } -impl CreateSourceUsage { +impl CreateSourceBuilderUsage { pub fn as_str(self) -> &'static str { - use CreateSourceUsage::*; + use CreateSourceBuilderUsage::*; match self { Reusable => "reusable", SingleUse => "single_use", @@ -680,10 +701,10 @@ impl CreateSourceUsage { } } -impl std::str::FromStr for CreateSourceUsage { +impl std::str::FromStr for CreateSourceBuilderUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreateSourceUsage::*; + use CreateSourceBuilderUsage::*; match s { "reusable" => Ok(Reusable), "single_use" => Ok(SingleUse), @@ -691,18 +712,18 @@ impl std::str::FromStr for CreateSourceUsage { } } } -impl std::fmt::Display for CreateSourceUsage { +impl std::fmt::Display for CreateSourceBuilderUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateSourceUsage { +impl std::fmt::Debug for CreateSourceBuilderUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateSourceUsage { +impl serde::Serialize for CreateSourceBuilderUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -710,14 +731,120 @@ impl serde::Serialize for CreateSourceUsage { serializer.serialize_str(self.as_str()) } } +/// Creates a new source object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateSource<'a> { + inner: CreateSourceBuilder<'a>, +} impl<'a> CreateSource<'a> { - /// Creates a new source object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/sources", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateSourceBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn flow(mut self, flow: CreateSourceBuilderFlow) -> Self { + self.inner.flow = Some(flow); + self + } + + pub fn mandate(mut self, mandate: CreateSourceBuilderMandate<'a>) -> Self { + self.inner.mandate = Some(mandate); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn original_source(mut self, original_source: &'a str) -> Self { + self.inner.original_source = Some(original_source); + self + } + + pub fn owner(mut self, owner: Owner<'a>) -> Self { + self.inner.owner = Some(owner); + self + } + + pub fn receiver(mut self, receiver: CreateSourceBuilderReceiver) -> Self { + self.inner.receiver = Some(receiver); + self + } + + pub fn redirect(mut self, redirect: CreateSourceBuilderRedirect<'a>) -> Self { + self.inner.redirect = Some(redirect); + self + } + + pub fn source_order(mut self, source_order: CreateSourceBuilderSourceOrder<'a>) -> Self { + self.inner.source_order = Some(source_order); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn token(mut self, token: &'a str) -> Self { + self.inner.token = Some(token); + self + } + + pub fn type_(mut self, type_: &'a str) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn usage(mut self, usage: CreateSourceBuilderUsage) -> Self { + self.inner.usage = Some(usage); + self + } +} +impl CreateSource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateSource<'_> { + type Output = stripe_shared::Source; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/sources").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSource<'a> { +pub struct UpdateSourceBuilder<'a> { /// Amount associated with the source. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -726,7 +853,7 @@ pub struct UpdateSource<'a> { pub expand: Option<&'a [&'a str]>, /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. #[serde(skip_serializing_if = "Option::is_none")] - pub mandate: Option>, + pub mandate: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -739,19 +866,19 @@ pub struct UpdateSource<'a> { /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[serde(skip_serializing_if = "Option::is_none")] - pub source_order: Option>, + pub source_order: Option>, } -impl<'a> UpdateSource<'a> { +impl<'a> UpdateSourceBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceMandate<'a> { +pub struct UpdateSourceBuilderMandate<'a> { /// The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub acceptance: Option>, + pub acceptance: Option>, /// The amount specified by the mandate. (Leave null for a mandate covering all amounts) #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -761,20 +888,20 @@ pub struct UpdateSourceMandate<'a> { /// The interval of debits permitted by the mandate. /// Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency). #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, + pub interval: Option, /// The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. /// Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). #[serde(skip_serializing_if = "Option::is_none")] - pub notification_method: Option, + pub notification_method: Option, } -impl<'a> UpdateSourceMandate<'a> { +impl<'a> UpdateSourceBuilderMandate<'a> { pub fn new() -> Self { Self::default() } } /// The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSourceMandateAcceptance<'a> { +pub struct UpdateSourceBuilderMandateAcceptance<'a> { /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub date: Option, @@ -791,17 +918,17 @@ pub struct UpdateSourceMandateAcceptance<'a> { pub online: Option>, /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). - pub status: UpdateSourceMandateAcceptanceStatus, + pub status: UpdateSourceBuilderMandateAcceptanceStatus, /// The type of acceptance information included with the mandate. Either `online` or `offline` #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// The user agent of the browser from which the mandate was accepted or refused by the customer. #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> UpdateSourceMandateAcceptance<'a> { - pub fn new(status: UpdateSourceMandateAcceptanceStatus) -> Self { +impl<'a> UpdateSourceBuilderMandateAcceptance<'a> { + pub fn new(status: UpdateSourceBuilderMandateAcceptanceStatus) -> Self { Self { date: None, ip: None, @@ -816,15 +943,15 @@ impl<'a> UpdateSourceMandateAcceptance<'a> { /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSourceMandateAcceptanceStatus { +pub enum UpdateSourceBuilderMandateAcceptanceStatus { Accepted, Pending, Refused, Revoked, } -impl UpdateSourceMandateAcceptanceStatus { +impl UpdateSourceBuilderMandateAcceptanceStatus { pub fn as_str(self) -> &'static str { - use UpdateSourceMandateAcceptanceStatus::*; + use UpdateSourceBuilderMandateAcceptanceStatus::*; match self { Accepted => "accepted", Pending => "pending", @@ -834,10 +961,10 @@ impl UpdateSourceMandateAcceptanceStatus { } } -impl std::str::FromStr for UpdateSourceMandateAcceptanceStatus { +impl std::str::FromStr for UpdateSourceBuilderMandateAcceptanceStatus { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSourceMandateAcceptanceStatus::*; + use UpdateSourceBuilderMandateAcceptanceStatus::*; match s { "accepted" => Ok(Accepted), "pending" => Ok(Pending), @@ -847,18 +974,18 @@ impl std::str::FromStr for UpdateSourceMandateAcceptanceStatus { } } } -impl std::fmt::Display for UpdateSourceMandateAcceptanceStatus { +impl std::fmt::Display for UpdateSourceBuilderMandateAcceptanceStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSourceMandateAcceptanceStatus { +impl std::fmt::Debug for UpdateSourceBuilderMandateAcceptanceStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSourceMandateAcceptanceStatus { +impl serde::Serialize for UpdateSourceBuilderMandateAcceptanceStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -868,13 +995,13 @@ impl serde::Serialize for UpdateSourceMandateAcceptanceStatus { } /// The type of acceptance information included with the mandate. Either `online` or `offline` #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSourceMandateAcceptanceType { +pub enum UpdateSourceBuilderMandateAcceptanceType { Offline, Online, } -impl UpdateSourceMandateAcceptanceType { +impl UpdateSourceBuilderMandateAcceptanceType { pub fn as_str(self) -> &'static str { - use UpdateSourceMandateAcceptanceType::*; + use UpdateSourceBuilderMandateAcceptanceType::*; match self { Offline => "offline", Online => "online", @@ -882,10 +1009,10 @@ impl UpdateSourceMandateAcceptanceType { } } -impl std::str::FromStr for UpdateSourceMandateAcceptanceType { +impl std::str::FromStr for UpdateSourceBuilderMandateAcceptanceType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSourceMandateAcceptanceType::*; + use UpdateSourceBuilderMandateAcceptanceType::*; match s { "offline" => Ok(Offline), "online" => Ok(Online), @@ -893,18 +1020,18 @@ impl std::str::FromStr for UpdateSourceMandateAcceptanceType { } } } -impl std::fmt::Display for UpdateSourceMandateAcceptanceType { +impl std::fmt::Display for UpdateSourceBuilderMandateAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSourceMandateAcceptanceType { +impl std::fmt::Debug for UpdateSourceBuilderMandateAcceptanceType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSourceMandateAcceptanceType { +impl serde::Serialize for UpdateSourceBuilderMandateAcceptanceType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -915,14 +1042,14 @@ impl serde::Serialize for UpdateSourceMandateAcceptanceType { /// The interval of debits permitted by the mandate. /// Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSourceMandateInterval { +pub enum UpdateSourceBuilderMandateInterval { OneTime, Scheduled, Variable, } -impl UpdateSourceMandateInterval { +impl UpdateSourceBuilderMandateInterval { pub fn as_str(self) -> &'static str { - use UpdateSourceMandateInterval::*; + use UpdateSourceBuilderMandateInterval::*; match self { OneTime => "one_time", Scheduled => "scheduled", @@ -931,10 +1058,10 @@ impl UpdateSourceMandateInterval { } } -impl std::str::FromStr for UpdateSourceMandateInterval { +impl std::str::FromStr for UpdateSourceBuilderMandateInterval { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSourceMandateInterval::*; + use UpdateSourceBuilderMandateInterval::*; match s { "one_time" => Ok(OneTime), "scheduled" => Ok(Scheduled), @@ -943,18 +1070,18 @@ impl std::str::FromStr for UpdateSourceMandateInterval { } } } -impl std::fmt::Display for UpdateSourceMandateInterval { +impl std::fmt::Display for UpdateSourceBuilderMandateInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSourceMandateInterval { +impl std::fmt::Debug for UpdateSourceBuilderMandateInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSourceMandateInterval { +impl serde::Serialize for UpdateSourceBuilderMandateInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -965,16 +1092,16 @@ impl serde::Serialize for UpdateSourceMandateInterval { /// The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. /// Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSourceMandateNotificationMethod { +pub enum UpdateSourceBuilderMandateNotificationMethod { DeprecatedNone, Email, Manual, None, StripeEmail, } -impl UpdateSourceMandateNotificationMethod { +impl UpdateSourceBuilderMandateNotificationMethod { pub fn as_str(self) -> &'static str { - use UpdateSourceMandateNotificationMethod::*; + use UpdateSourceBuilderMandateNotificationMethod::*; match self { DeprecatedNone => "deprecated_none", Email => "email", @@ -985,10 +1112,10 @@ impl UpdateSourceMandateNotificationMethod { } } -impl std::str::FromStr for UpdateSourceMandateNotificationMethod { +impl std::str::FromStr for UpdateSourceBuilderMandateNotificationMethod { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSourceMandateNotificationMethod::*; + use UpdateSourceBuilderMandateNotificationMethod::*; match s { "deprecated_none" => Ok(DeprecatedNone), "email" => Ok(Email), @@ -999,18 +1126,18 @@ impl std::str::FromStr for UpdateSourceMandateNotificationMethod { } } } -impl std::fmt::Display for UpdateSourceMandateNotificationMethod { +impl std::fmt::Display for UpdateSourceBuilderMandateNotificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSourceMandateNotificationMethod { +impl std::fmt::Debug for UpdateSourceBuilderMandateNotificationMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSourceMandateNotificationMethod { +impl serde::Serialize for UpdateSourceBuilderMandateNotificationMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1021,23 +1148,23 @@ impl serde::Serialize for UpdateSourceMandateNotificationMethod { /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceSourceOrder<'a> { +pub struct UpdateSourceBuilderSourceOrder<'a> { /// List of items constituting the order. #[serde(skip_serializing_if = "Option::is_none")] - pub items: Option<&'a [UpdateSourceSourceOrderItems<'a>]>, + pub items: Option<&'a [UpdateSourceBuilderSourceOrderItems<'a>]>, /// Shipping address for the order. /// Required if any of the SKUs are for products that have `shippable` set to true. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option>, } -impl<'a> UpdateSourceSourceOrder<'a> { +impl<'a> UpdateSourceBuilderSourceOrder<'a> { pub fn new() -> Self { Self::default() } } /// List of items constituting the order. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceSourceOrderItems<'a> { +pub struct UpdateSourceBuilderSourceOrderItems<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -1053,23 +1180,23 @@ pub struct UpdateSourceSourceOrderItems<'a> { pub quantity: Option, #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> UpdateSourceSourceOrderItems<'a> { +impl<'a> UpdateSourceBuilderSourceOrderItems<'a> { pub fn new() -> Self { Self::default() } } #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSourceSourceOrderItemsType { +pub enum UpdateSourceBuilderSourceOrderItemsType { Discount, Shipping, Sku, Tax, } -impl UpdateSourceSourceOrderItemsType { +impl UpdateSourceBuilderSourceOrderItemsType { pub fn as_str(self) -> &'static str { - use UpdateSourceSourceOrderItemsType::*; + use UpdateSourceBuilderSourceOrderItemsType::*; match self { Discount => "discount", Shipping => "shipping", @@ -1079,10 +1206,10 @@ impl UpdateSourceSourceOrderItemsType { } } -impl std::str::FromStr for UpdateSourceSourceOrderItemsType { +impl std::str::FromStr for UpdateSourceBuilderSourceOrderItemsType { type Err = (); fn from_str(s: &str) -> Result { - use UpdateSourceSourceOrderItemsType::*; + use UpdateSourceBuilderSourceOrderItemsType::*; match s { "discount" => Ok(Discount), "shipping" => Ok(Shipping), @@ -1092,18 +1219,18 @@ impl std::str::FromStr for UpdateSourceSourceOrderItemsType { } } } -impl std::fmt::Display for UpdateSourceSourceOrderItemsType { +impl std::fmt::Display for UpdateSourceBuilderSourceOrderItemsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateSourceSourceOrderItemsType { +impl std::fmt::Debug for UpdateSourceBuilderSourceOrderItemsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateSourceSourceOrderItemsType { +impl serde::Serialize for UpdateSourceBuilderSourceOrderItemsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -1111,44 +1238,209 @@ impl serde::Serialize for UpdateSourceSourceOrderItemsType { serializer.serialize_str(self.as_str()) } } +/// Updates the specified source by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +/// +/// This request accepts the `metadata` and `owner` as arguments. +/// It is also possible to update type specific information for selected payment methods. +/// Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateSource<'a> { + inner: UpdateSourceBuilder<'a>, + source: &'a stripe_shared::SourceId, +} impl<'a> UpdateSource<'a> { - /// Updates the specified source by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - /// - /// This request accepts the `metadata` and `owner` as arguments. - /// It is also possible to update type specific information for selected payment methods. - /// Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail. - pub fn send( + pub fn new(source: &'a stripe_shared::SourceId) -> Self { + Self { source, inner: UpdateSourceBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn mandate(mut self, mandate: UpdateSourceBuilderMandate<'a>) -> Self { + self.inner.mandate = Some(mandate); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn owner(mut self, owner: Owner<'a>) -> Self { + self.inner.owner = Some(owner); + self + } + + pub fn source_order(mut self, source_order: UpdateSourceBuilderSourceOrder<'a>) -> Self { + self.inner.source_order = Some(source_order); + self + } +} +impl UpdateSource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - source: &stripe_shared::SourceId, - ) -> stripe::Response { - client.send_form(&format!("/sources/{source}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateSource<'_> { + type Output = stripe_shared::Source; + + fn build(&self) -> RequestBuilder { + let source = self.source; + RequestBuilder::new(StripeMethod::Post, format!("/sources/{source}")).form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct VerifySource<'a> { +pub struct VerifySourceBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// The values needed to verify the source. pub values: &'a [&'a str], } -impl<'a> VerifySource<'a> { +impl<'a> VerifySourceBuilder<'a> { pub fn new(values: &'a [&'a str]) -> Self { Self { expand: None, values } } } +/// Verify a given source. +#[derive(Clone, Debug, serde::Serialize)] +pub struct VerifySource<'a> { + inner: VerifySourceBuilder<'a>, + source: &'a stripe_shared::SourceId, +} impl<'a> VerifySource<'a> { - /// Verify a given source. - pub fn send( + pub fn new(source: &'a stripe_shared::SourceId, values: &'a [&'a str]) -> Self { + Self { source, inner: VerifySourceBuilder::new(values) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl VerifySource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - source: &stripe_shared::SourceId, - ) -> stripe::Response { - client.send_form(&format!("/sources/{source}/verify"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for VerifySource<'_> { + type Output = stripe_shared::Source; + + fn build(&self) -> RequestBuilder { + let source = self.source; + RequestBuilder::new(StripeMethod::Post, format!("/sources/{source}/verify")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SourceTransactionsSourceBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> SourceTransactionsSourceBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// List source transactions for a given source. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SourceTransactionsSource<'a> { + inner: SourceTransactionsSourceBuilder<'a>, + source: &'a stripe_shared::SourceId, +} +impl<'a> SourceTransactionsSource<'a> { + pub fn new(source: &'a stripe_shared::SourceId) -> Self { + Self { source, inner: SourceTransactionsSourceBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl SourceTransactionsSource<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SourceTransactionsSource<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + let source = self.source; + RequestBuilder::new(StripeMethod::Get, format!("/sources/{source}/source_transactions")) + .query(&self.inner) + } +} + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct MandateOfflineAcceptanceParams<'a> { /// An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. diff --git a/generated/stripe_product/Cargo.toml b/generated/stripe_product/Cargo.toml index 8dd73d620..46aa4e509 100644 --- a/generated/stripe_product/Cargo.toml +++ b/generated/stripe_product/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - coupon = [] price = [] product = [] @@ -54,5 +43,5 @@ full = ["coupon", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_product/src/coupon/requests.rs b/generated/stripe_product/src/coupon/requests.rs index 5be70a4da..a82b18082 100644 --- a/generated/stripe_product/src/coupon/requests.rs +++ b/generated/stripe_product/src/coupon/requests.rs @@ -1,24 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteCoupon {} -impl DeleteCoupon { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteCoupon { - /// You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. - /// However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. - /// You can also delete coupons via the API. - pub fn send( - &self, - client: &stripe::Client, - coupon: &stripe_shared::CouponId, - ) -> stripe::Response { - client.send_form(&format!("/coupons/{coupon}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListCoupon<'a> { +pub struct ListCouponBuilder<'a> { /// A filter on the list, based on the object `created` field. /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. #[serde(skip_serializing_if = "Option::is_none")] @@ -41,52 +26,76 @@ pub struct ListCoupon<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListCoupon<'a> { +impl<'a> ListCouponBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your coupons. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListCoupon<'a> { + inner: ListCouponBuilder<'a>, +} impl<'a> ListCoupon<'a> { - /// Returns a list of your coupons. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/coupons", self) + pub fn new() -> Self { + Self { inner: ListCouponBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/coupons", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveCoupon<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveCoupon<'a> { - pub fn new() -> Self { - Self::default() + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self } } -impl<'a> RetrieveCoupon<'a> { - /// Retrieves the coupon with the given ID. - pub fn send( +impl ListCoupon<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - coupon: &stripe_shared::CouponId, - ) -> stripe::Response { - client.get_query(&format!("/coupons/{coupon}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListCoupon<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/coupons").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCoupon<'a> { +pub struct CreateCouponBuilder<'a> { /// A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed). #[serde(skip_serializing_if = "Option::is_none")] pub amount_off: Option, /// A hash containing directions for what this Coupon will apply discounts to. #[serde(skip_serializing_if = "Option::is_none")] - pub applies_to: Option>, + pub applies_to: Option>, /// Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed). #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option, @@ -130,36 +139,180 @@ pub struct CreateCoupon<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub redeem_by: Option, } -impl<'a> CreateCoupon<'a> { +impl<'a> CreateCouponBuilder<'a> { pub fn new() -> Self { Self::default() } } /// A hash containing directions for what this Coupon will apply discounts to. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCouponAppliesTo<'a> { +pub struct CreateCouponBuilderAppliesTo<'a> { /// An array of Product IDs that this Coupon will apply to. #[serde(skip_serializing_if = "Option::is_none")] pub products: Option<&'a [&'a str]>, } -impl<'a> CreateCouponAppliesTo<'a> { +impl<'a> CreateCouponBuilderAppliesTo<'a> { pub fn new() -> Self { Self::default() } } +/// You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. +/// Coupon creation is also accessible via the API if you need to create coupons on the fly. +/// +/// A coupon has either a `percent_off` or an `amount_off` and `currency`. +/// If you set an `amount_off`, that amount will be subtracted from any invoice’s subtotal. +/// For example, an invoice with a subtotal of $100 will have a final total of $0 if a coupon with an `amount_off` of 20000 is applied to it and an invoice with a subtotal of $300 will have a final total of $100 if a coupon with an `amount_off` of 20000 is applied to it. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateCoupon<'a> { + inner: CreateCouponBuilder<'a>, +} impl<'a> CreateCoupon<'a> { - /// You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. - /// Coupon creation is also accessible via the API if you need to create coupons on the fly. - /// - /// A coupon has either a `percent_off` or an `amount_off` and `currency`. - /// If you set an `amount_off`, that amount will be subtracted from any invoice’s subtotal. - /// For example, an invoice with a subtotal of $100 will have a final total of $0 if a coupon with an `amount_off` of 20000 is applied to it and an invoice with a subtotal of $300 will have a final total of $100 if a coupon with an `amount_off` of 20000 is applied to it. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/coupons", self, http_types::Method::Post) + pub fn new() -> Self { + Self { inner: CreateCouponBuilder::new() } + } + pub fn amount_off(mut self, amount_off: i64) -> Self { + self.inner.amount_off = Some(amount_off); + self + } + + pub fn applies_to(mut self, applies_to: CreateCouponBuilderAppliesTo<'a>) -> Self { + self.inner.applies_to = Some(applies_to); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn currency_options( + mut self, + currency_options: &'a std::collections::HashMap, + ) -> Self { + self.inner.currency_options = Some(currency_options); + self + } + + pub fn duration(mut self, duration: stripe_shared::CouponDuration) -> Self { + self.inner.duration = Some(duration); + self + } + + pub fn duration_in_months(mut self, duration_in_months: i64) -> Self { + self.inner.duration_in_months = Some(duration_in_months); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn id(mut self, id: &'a str) -> Self { + self.inner.id = Some(id); + self + } + + pub fn max_redemptions(mut self, max_redemptions: i64) -> Self { + self.inner.max_redemptions = Some(max_redemptions); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn percent_off(mut self, percent_off: f64) -> Self { + self.inner.percent_off = Some(percent_off); + self + } + + pub fn redeem_by(mut self, redeem_by: stripe_types::Timestamp) -> Self { + self.inner.redeem_by = Some(redeem_by); + self + } +} +impl CreateCoupon<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateCoupon<'_> { + type Output = stripe_shared::Coupon; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/coupons").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCoupon<'a> { +pub struct RetrieveCouponBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveCouponBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the coupon with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveCoupon<'a> { + inner: RetrieveCouponBuilder<'a>, + coupon: &'a stripe_shared::CouponId, +} +impl<'a> RetrieveCoupon<'a> { + pub fn new(coupon: &'a stripe_shared::CouponId) -> Self { + Self { coupon, inner: RetrieveCouponBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveCoupon<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveCoupon<'_> { + type Output = stripe_shared::Coupon; + + fn build(&self) -> RequestBuilder { + let coupon = self.coupon; + RequestBuilder::new(StripeMethod::Get, format!("/coupons/{coupon}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateCouponBuilder<'a> { /// Coupons defined in each available currency option (only supported if the coupon is amount-based). /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] @@ -179,22 +332,106 @@ pub struct UpdateCoupon<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, } -impl<'a> UpdateCoupon<'a> { +impl<'a> UpdateCouponBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the metadata of a coupon. +/// Other coupon details (currency, duration, amount_off) are, by design, not editable. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateCoupon<'a> { + inner: UpdateCouponBuilder<'a>, + coupon: &'a stripe_shared::CouponId, +} impl<'a> UpdateCoupon<'a> { - /// Updates the metadata of a coupon. - /// Other coupon details (currency, duration, amount_off) are, by design, not editable. - pub fn send( + pub fn new(coupon: &'a stripe_shared::CouponId) -> Self { + Self { coupon, inner: UpdateCouponBuilder::new() } + } + pub fn currency_options( + mut self, + currency_options: &'a std::collections::HashMap, + ) -> Self { + self.inner.currency_options = Some(currency_options); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } +} +impl UpdateCoupon<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - coupon: &stripe_shared::CouponId, - ) -> stripe::Response { - client.send_form(&format!("/coupons/{coupon}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateCoupon<'_> { + type Output = stripe_shared::Coupon; + + fn build(&self) -> RequestBuilder { + let coupon = self.coupon; + RequestBuilder::new(StripeMethod::Post, format!("/coupons/{coupon}")).form(&self.inner) + } +} +/// You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. +/// However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. +/// You can also delete coupons via the API. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteCoupon<'a> { + coupon: &'a stripe_shared::CouponId, +} +impl<'a> DeleteCoupon<'a> { + pub fn new(coupon: &'a stripe_shared::CouponId) -> Self { + Self { coupon } + } +} +impl DeleteCoupon<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteCoupon<'_> { + type Output = stripe_shared::DeletedCoupon; + + fn build(&self) -> RequestBuilder { + let coupon = self.coupon; + RequestBuilder::new(StripeMethod::Delete, format!("/coupons/{coupon}")) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CurrencyOption { /// A positive integer representing the amount to subtract from an invoice total. diff --git a/generated/stripe_product/src/price/requests.rs b/generated/stripe_product/src/price/requests.rs index 36800ef73..0721827d0 100644 --- a/generated/stripe_product/src/price/requests.rs +++ b/generated/stripe_product/src/price/requests.rs @@ -1,5 +1,84 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct SearchPriceBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for pagination across multiple pages of results. + /// Don't include this parameter on the first call. + /// Use the next_page value returned in a previous response to request subsequent results. + #[serde(skip_serializing_if = "Option::is_none")] + pub page: Option<&'a str>, + /// The search query string. + /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for prices](https://stripe.com/docs/search#query-fields-for-prices). + pub query: &'a str, +} +impl<'a> SearchPriceBuilder<'a> { + pub fn new(query: &'a str) -> Self { + Self { expand: None, limit: None, page: None, query } + } +} +/// Search for prices you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchPrice<'a> { + inner: SearchPriceBuilder<'a>, +} +impl<'a> SearchPrice<'a> { + pub fn new(query: &'a str) -> Self { + Self { inner: SearchPriceBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self + } +} +impl SearchPrice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SearchPrice<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/prices/search").query(&self.inner) + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPrice<'a> { +pub struct ListPriceBuilder<'a> { /// Only return prices that are active or inactive (e.g., pass `false` to list all inactive prices). #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -30,7 +109,7 @@ pub struct ListPrice<'a> { pub product: Option<&'a str>, /// Only return prices with these recurring fields. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @@ -41,37 +120,37 @@ pub struct ListPrice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> ListPrice<'a> { +impl<'a> ListPriceBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Only return prices with these recurring fields. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPriceRecurring { +pub struct ListPriceBuilderRecurring { /// Filter by billing frequency. Either `day`, `week`, `month` or `year`. #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, + pub interval: Option, /// Filter by the usage type for this price. Can be either `metered` or `licensed`. #[serde(skip_serializing_if = "Option::is_none")] - pub usage_type: Option, + pub usage_type: Option, } -impl ListPriceRecurring { +impl ListPriceBuilderRecurring { pub fn new() -> Self { Self::default() } } /// Filter by billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListPriceRecurringInterval { +pub enum ListPriceBuilderRecurringInterval { Day, Month, Week, Year, } -impl ListPriceRecurringInterval { +impl ListPriceBuilderRecurringInterval { pub fn as_str(self) -> &'static str { - use ListPriceRecurringInterval::*; + use ListPriceBuilderRecurringInterval::*; match self { Day => "day", Month => "month", @@ -81,10 +160,10 @@ impl ListPriceRecurringInterval { } } -impl std::str::FromStr for ListPriceRecurringInterval { +impl std::str::FromStr for ListPriceBuilderRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use ListPriceRecurringInterval::*; + use ListPriceBuilderRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -94,18 +173,18 @@ impl std::str::FromStr for ListPriceRecurringInterval { } } } -impl std::fmt::Display for ListPriceRecurringInterval { +impl std::fmt::Display for ListPriceBuilderRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListPriceRecurringInterval { +impl std::fmt::Debug for ListPriceBuilderRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListPriceRecurringInterval { +impl serde::Serialize for ListPriceBuilderRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -115,13 +194,13 @@ impl serde::Serialize for ListPriceRecurringInterval { } /// Filter by the usage type for this price. Can be either `metered` or `licensed`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListPriceRecurringUsageType { +pub enum ListPriceBuilderRecurringUsageType { Licensed, Metered, } -impl ListPriceRecurringUsageType { +impl ListPriceBuilderRecurringUsageType { pub fn as_str(self) -> &'static str { - use ListPriceRecurringUsageType::*; + use ListPriceBuilderRecurringUsageType::*; match self { Licensed => "licensed", Metered => "metered", @@ -129,10 +208,10 @@ impl ListPriceRecurringUsageType { } } -impl std::str::FromStr for ListPriceRecurringUsageType { +impl std::str::FromStr for ListPriceBuilderRecurringUsageType { type Err = (); fn from_str(s: &str) -> Result { - use ListPriceRecurringUsageType::*; + use ListPriceBuilderRecurringUsageType::*; match s { "licensed" => Ok(Licensed), "metered" => Ok(Metered), @@ -140,18 +219,18 @@ impl std::str::FromStr for ListPriceRecurringUsageType { } } } -impl std::fmt::Display for ListPriceRecurringUsageType { +impl std::fmt::Display for ListPriceBuilderRecurringUsageType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListPriceRecurringUsageType { +impl std::fmt::Debug for ListPriceBuilderRecurringUsageType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListPriceRecurringUsageType { +impl serde::Serialize for ListPriceBuilderRecurringUsageType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -159,82 +238,96 @@ impl serde::Serialize for ListPriceRecurringUsageType { serializer.serialize_str(self.as_str()) } } +/// Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). +/// For the list of inactive prices, set `active` to false. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPrice<'a> { + inner: ListPriceBuilder<'a>, +} impl<'a> ListPrice<'a> { - /// Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). - /// For the list of inactive prices, set `active` to false. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/prices", self) + pub fn new() -> Self { + Self { inner: ListPriceBuilder::new() } } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/prices", self) + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrievePrice<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrievePrice<'a> { - pub fn new() -> Self { - Self::default() + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -impl<'a> RetrievePrice<'a> { - /// Retrieves the price with the given ID. - pub fn send( - &self, - client: &stripe::Client, - price: &stripe_shared::PriceId, - ) -> stripe::Response { - client.get_query(&format!("/prices/{price}"), self) + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchPrice<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for pagination across multiple pages of results. - /// Don't include this parameter on the first call. - /// Use the next_page value returned in a previous response to request subsequent results. - #[serde(skip_serializing_if = "Option::is_none")] - pub page: Option<&'a str>, - /// The search query string. - /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for prices](https://stripe.com/docs/search#query-fields-for-prices). - pub query: &'a str, -} -impl<'a> SearchPrice<'a> { - pub fn new(query: &'a str) -> Self { - Self { expand: None, limit: None, page: None, query } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn lookup_keys(mut self, lookup_keys: &'a [&'a str]) -> Self { + self.inner.lookup_keys = Some(lookup_keys); + self + } + + pub fn product(mut self, product: &'a str) -> Self { + self.inner.product = Some(product); + self + } + + pub fn recurring(mut self, recurring: ListPriceBuilderRecurring) -> Self { + self.inner.recurring = Some(recurring); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: stripe_shared::PriceType) -> Self { + self.inner.type_ = Some(type_); + self } } -impl<'a> SearchPrice<'a> { - /// Search for prices you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( +impl ListPrice<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/prices/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/prices/search", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPrice<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/prices").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePrice<'a> { +pub struct CreatePriceBuilder<'a> { /// Whether the price can be used for new purchases. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -250,8 +343,9 @@ pub struct CreatePrice<'a> { /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency_options: - Option<&'a std::collections::HashMap>, + pub currency_options: Option< + &'a std::collections::HashMap, + >, /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] pub custom_unit_amount: Option, @@ -276,10 +370,10 @@ pub struct CreatePrice<'a> { pub product: Option<&'a str>, /// These fields can be used to create a new product that this price will belong to. #[serde(skip_serializing_if = "Option::is_none")] - pub product_data: Option>, + pub product_data: Option>, /// The recurring components of a price such as `interval` and `usage_type`. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. @@ -290,7 +384,7 @@ pub struct CreatePrice<'a> { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers: Option<&'a [CreatePriceTiers<'a>]>, + pub tiers: Option<&'a [CreatePriceBuilderTiers<'a>]>, /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. #[serde(skip_serializing_if = "Option::is_none")] @@ -301,7 +395,7 @@ pub struct CreatePrice<'a> { /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[serde(skip_serializing_if = "Option::is_none")] - pub transform_quantity: Option, + pub transform_quantity: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. /// One of `unit_amount` or `custom_unit_amount` is required, unless `billing_scheme=tiered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -311,7 +405,7 @@ pub struct CreatePrice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreatePrice<'a> { +impl<'a> CreatePriceBuilder<'a> { pub fn new(currency: stripe_types::Currency) -> Self { Self { active: None, @@ -339,7 +433,7 @@ impl<'a> CreatePrice<'a> { /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Clone, Debug, Default, serde::Serialize)] -pub struct CreatePriceCurrencyOptions { +pub struct CreatePriceBuilderCurrencyOptions { /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] pub custom_unit_amount: Option, @@ -353,7 +447,7 @@ pub struct CreatePriceCurrencyOptions { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers: Option>, + pub tiers: Option>, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -362,7 +456,7 @@ pub struct CreatePriceCurrencyOptions { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option, } -impl CreatePriceCurrencyOptions { +impl CreatePriceBuilderCurrencyOptions { pub fn new() -> Self { Self::default() } @@ -371,7 +465,7 @@ impl CreatePriceCurrencyOptions { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[derive(Clone, Debug, serde::Serialize)] -pub struct CreatePriceCurrencyOptionsTiers { +pub struct CreatePriceBuilderCurrencyOptionsTiers { /// The flat billing amount for an entire tier, regardless of the number of units in the tier. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, @@ -389,10 +483,10 @@ pub struct CreatePriceCurrencyOptionsTiers { /// Specifies the upper bound of this tier. /// The lower bound of a tier is the upper bound of the previous tier adding one. /// Use `inf` to define a fallback tier. - pub up_to: CreatePriceCurrencyOptionsTiersUpTo, + pub up_to: CreatePriceBuilderCurrencyOptionsTiersUpTo, } -impl CreatePriceCurrencyOptionsTiers { - pub fn new(up_to: CreatePriceCurrencyOptionsTiersUpTo) -> Self { +impl CreatePriceBuilderCurrencyOptionsTiers { + pub fn new(up_to: CreatePriceBuilderCurrencyOptionsTiersUpTo) -> Self { Self { flat_amount: None, flat_amount_decimal: None, @@ -407,13 +501,13 @@ impl CreatePriceCurrencyOptionsTiers { /// Use `inf` to define a fallback tier. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePriceCurrencyOptionsTiersUpTo { +pub enum CreatePriceBuilderCurrencyOptionsTiersUpTo { Inf, I64(i64), } /// These fields can be used to create a new product that this price will belong to. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceProductData<'a> { +pub struct CreatePriceBuilderProductData<'a> { /// Whether the product is currently available for purchase. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -446,7 +540,7 @@ pub struct CreatePriceProductData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_label: Option<&'a str>, } -impl<'a> CreatePriceProductData<'a> { +impl<'a> CreatePriceBuilderProductData<'a> { pub fn new(name: &'a str) -> Self { Self { active: None, @@ -461,15 +555,17 @@ impl<'a> CreatePriceProductData<'a> { } /// The recurring components of a price such as `interval` and `usage_type`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceRecurring { - /// Specifies a usage aggregation strategy for prices of `usage_type=metered`. Defaults to `sum`. +pub struct CreatePriceBuilderRecurring { + /// Specifies a usage aggregation strategy for prices of `usage_type=metered`. + /// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. + /// Defaults to `sum`. #[serde(skip_serializing_if = "Option::is_none")] - pub aggregate_usage: Option, + pub aggregate_usage: Option, /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreatePriceRecurringInterval, + pub interval: CreatePriceBuilderRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, /// Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). @@ -481,10 +577,10 @@ pub struct CreatePriceRecurring { /// `metered` aggregates the total usage based on usage records. /// Defaults to `licensed`. #[serde(skip_serializing_if = "Option::is_none")] - pub usage_type: Option, + pub usage_type: Option, } -impl CreatePriceRecurring { - pub fn new(interval: CreatePriceRecurringInterval) -> Self { +impl CreatePriceBuilderRecurring { + pub fn new(interval: CreatePriceBuilderRecurringInterval) -> Self { Self { aggregate_usage: None, interval, @@ -494,17 +590,19 @@ impl CreatePriceRecurring { } } } -/// Specifies a usage aggregation strategy for prices of `usage_type=metered`. Defaults to `sum`. +/// Specifies a usage aggregation strategy for prices of `usage_type=metered`. +/// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. +/// Defaults to `sum`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceRecurringAggregateUsage { +pub enum CreatePriceBuilderRecurringAggregateUsage { LastDuringPeriod, LastEver, Max, Sum, } -impl CreatePriceRecurringAggregateUsage { +impl CreatePriceBuilderRecurringAggregateUsage { pub fn as_str(self) -> &'static str { - use CreatePriceRecurringAggregateUsage::*; + use CreatePriceBuilderRecurringAggregateUsage::*; match self { LastDuringPeriod => "last_during_period", LastEver => "last_ever", @@ -514,10 +612,10 @@ impl CreatePriceRecurringAggregateUsage { } } -impl std::str::FromStr for CreatePriceRecurringAggregateUsage { +impl std::str::FromStr for CreatePriceBuilderRecurringAggregateUsage { type Err = (); fn from_str(s: &str) -> Result { - use CreatePriceRecurringAggregateUsage::*; + use CreatePriceBuilderRecurringAggregateUsage::*; match s { "last_during_period" => Ok(LastDuringPeriod), "last_ever" => Ok(LastEver), @@ -527,18 +625,18 @@ impl std::str::FromStr for CreatePriceRecurringAggregateUsage { } } } -impl std::fmt::Display for CreatePriceRecurringAggregateUsage { +impl std::fmt::Display for CreatePriceBuilderRecurringAggregateUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePriceRecurringAggregateUsage { +impl std::fmt::Debug for CreatePriceBuilderRecurringAggregateUsage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePriceRecurringAggregateUsage { +impl serde::Serialize for CreatePriceBuilderRecurringAggregateUsage { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -548,15 +646,15 @@ impl serde::Serialize for CreatePriceRecurringAggregateUsage { } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceRecurringInterval { +pub enum CreatePriceBuilderRecurringInterval { Day, Month, Week, Year, } -impl CreatePriceRecurringInterval { +impl CreatePriceBuilderRecurringInterval { pub fn as_str(self) -> &'static str { - use CreatePriceRecurringInterval::*; + use CreatePriceBuilderRecurringInterval::*; match self { Day => "day", Month => "month", @@ -566,10 +664,10 @@ impl CreatePriceRecurringInterval { } } -impl std::str::FromStr for CreatePriceRecurringInterval { +impl std::str::FromStr for CreatePriceBuilderRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreatePriceRecurringInterval::*; + use CreatePriceBuilderRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -579,18 +677,18 @@ impl std::str::FromStr for CreatePriceRecurringInterval { } } } -impl std::fmt::Display for CreatePriceRecurringInterval { +impl std::fmt::Display for CreatePriceBuilderRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePriceRecurringInterval { +impl std::fmt::Debug for CreatePriceBuilderRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePriceRecurringInterval { +impl serde::Serialize for CreatePriceBuilderRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -604,13 +702,13 @@ impl serde::Serialize for CreatePriceRecurringInterval { /// `metered` aggregates the total usage based on usage records. /// Defaults to `licensed`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceRecurringUsageType { +pub enum CreatePriceBuilderRecurringUsageType { Licensed, Metered, } -impl CreatePriceRecurringUsageType { +impl CreatePriceBuilderRecurringUsageType { pub fn as_str(self) -> &'static str { - use CreatePriceRecurringUsageType::*; + use CreatePriceBuilderRecurringUsageType::*; match self { Licensed => "licensed", Metered => "metered", @@ -618,10 +716,10 @@ impl CreatePriceRecurringUsageType { } } -impl std::str::FromStr for CreatePriceRecurringUsageType { +impl std::str::FromStr for CreatePriceBuilderRecurringUsageType { type Err = (); fn from_str(s: &str) -> Result { - use CreatePriceRecurringUsageType::*; + use CreatePriceBuilderRecurringUsageType::*; match s { "licensed" => Ok(Licensed), "metered" => Ok(Metered), @@ -629,18 +727,18 @@ impl std::str::FromStr for CreatePriceRecurringUsageType { } } } -impl std::fmt::Display for CreatePriceRecurringUsageType { +impl std::fmt::Display for CreatePriceBuilderRecurringUsageType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePriceRecurringUsageType { +impl std::fmt::Debug for CreatePriceBuilderRecurringUsageType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePriceRecurringUsageType { +impl serde::Serialize for CreatePriceBuilderRecurringUsageType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -652,7 +750,7 @@ impl serde::Serialize for CreatePriceRecurringUsageType { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceTiers<'a> { +pub struct CreatePriceBuilderTiers<'a> { /// The flat billing amount for an entire tier, regardless of the number of units in the tier. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, @@ -670,10 +768,10 @@ pub struct CreatePriceTiers<'a> { /// Specifies the upper bound of this tier. /// The lower bound of a tier is the upper bound of the previous tier adding one. /// Use `inf` to define a fallback tier. - pub up_to: CreatePriceTiersUpTo, + pub up_to: CreatePriceBuilderTiersUpTo, } -impl<'a> CreatePriceTiers<'a> { - pub fn new(up_to: CreatePriceTiersUpTo) -> Self { +impl<'a> CreatePriceBuilderTiers<'a> { + pub fn new(up_to: CreatePriceBuilderTiersUpTo) -> Self { Self { flat_amount: None, flat_amount_decimal: None, @@ -688,33 +786,33 @@ impl<'a> CreatePriceTiers<'a> { /// Use `inf` to define a fallback tier. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreatePriceTiersUpTo { +pub enum CreatePriceBuilderTiersUpTo { Inf, I64(i64), } /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceTransformQuantity { +pub struct CreatePriceBuilderTransformQuantity { /// Divide usage by this number. pub divide_by: i64, /// After division, either round the result `up` or `down`. - pub round: CreatePriceTransformQuantityRound, + pub round: CreatePriceBuilderTransformQuantityRound, } -impl CreatePriceTransformQuantity { - pub fn new(divide_by: i64, round: CreatePriceTransformQuantityRound) -> Self { +impl CreatePriceBuilderTransformQuantity { + pub fn new(divide_by: i64, round: CreatePriceBuilderTransformQuantityRound) -> Self { Self { divide_by, round } } } /// After division, either round the result `up` or `down`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceTransformQuantityRound { +pub enum CreatePriceBuilderTransformQuantityRound { Down, Up, } -impl CreatePriceTransformQuantityRound { +impl CreatePriceBuilderTransformQuantityRound { pub fn as_str(self) -> &'static str { - use CreatePriceTransformQuantityRound::*; + use CreatePriceBuilderTransformQuantityRound::*; match self { Down => "down", Up => "up", @@ -722,10 +820,10 @@ impl CreatePriceTransformQuantityRound { } } -impl std::str::FromStr for CreatePriceTransformQuantityRound { +impl std::str::FromStr for CreatePriceBuilderTransformQuantityRound { type Err = (); fn from_str(s: &str) -> Result { - use CreatePriceTransformQuantityRound::*; + use CreatePriceBuilderTransformQuantityRound::*; match s { "down" => Ok(Down), "up" => Ok(Up), @@ -733,18 +831,18 @@ impl std::str::FromStr for CreatePriceTransformQuantityRound { } } } -impl std::fmt::Display for CreatePriceTransformQuantityRound { +impl std::fmt::Display for CreatePriceBuilderTransformQuantityRound { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreatePriceTransformQuantityRound { +impl std::fmt::Debug for CreatePriceBuilderTransformQuantityRound { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreatePriceTransformQuantityRound { +impl serde::Serialize for CreatePriceBuilderTransformQuantityRound { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -752,22 +850,198 @@ impl serde::Serialize for CreatePriceTransformQuantityRound { serializer.serialize_str(self.as_str()) } } +/// Creates a new price for an existing product. The price can be recurring or one-time. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePrice<'a> { + inner: CreatePriceBuilder<'a>, +} impl<'a> CreatePrice<'a> { - /// Creates a new price for an existing product. The price can be recurring or one-time. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/prices", self, http_types::Method::Post) + pub fn new(currency: stripe_types::Currency) -> Self { + Self { inner: CreatePriceBuilder::new(currency) } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn billing_scheme(mut self, billing_scheme: stripe_shared::PriceBillingScheme) -> Self { + self.inner.billing_scheme = Some(billing_scheme); + self + } + + pub fn currency_options( + mut self, + currency_options: &'a std::collections::HashMap< + stripe_types::Currency, + CreatePriceBuilderCurrencyOptions, + >, + ) -> Self { + self.inner.currency_options = Some(currency_options); + self + } + + pub fn custom_unit_amount(mut self, custom_unit_amount: CustomUnitAmount) -> Self { + self.inner.custom_unit_amount = Some(custom_unit_amount); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn lookup_key(mut self, lookup_key: &'a str) -> Self { + self.inner.lookup_key = Some(lookup_key); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nickname(mut self, nickname: &'a str) -> Self { + self.inner.nickname = Some(nickname); + self + } + + pub fn product(mut self, product: &'a str) -> Self { + self.inner.product = Some(product); + self + } + + pub fn product_data(mut self, product_data: CreatePriceBuilderProductData<'a>) -> Self { + self.inner.product_data = Some(product_data); + self + } + + pub fn recurring(mut self, recurring: CreatePriceBuilderRecurring) -> Self { + self.inner.recurring = Some(recurring); + self + } + + pub fn tax_behavior(mut self, tax_behavior: stripe_shared::PriceTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } + + pub fn tiers(mut self, tiers: &'a [CreatePriceBuilderTiers<'a>]) -> Self { + self.inner.tiers = Some(tiers); + self + } + + pub fn tiers_mode(mut self, tiers_mode: stripe_shared::PriceTiersMode) -> Self { + self.inner.tiers_mode = Some(tiers_mode); + self + } + + pub fn transfer_lookup_key(mut self, transfer_lookup_key: bool) -> Self { + self.inner.transfer_lookup_key = Some(transfer_lookup_key); + self + } + + pub fn transform_quantity( + mut self, + transform_quantity: CreatePriceBuilderTransformQuantity, + ) -> Self { + self.inner.transform_quantity = Some(transform_quantity); + self + } + + pub fn unit_amount(mut self, unit_amount: i64) -> Self { + self.inner.unit_amount = Some(unit_amount); + self + } + + pub fn unit_amount_decimal(mut self, unit_amount_decimal: &'a str) -> Self { + self.inner.unit_amount_decimal = Some(unit_amount_decimal); + self + } +} +impl CreatePrice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePrice<'_> { + type Output = stripe_shared::Price; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/prices").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePrice<'a> { +pub struct RetrievePriceBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrievePriceBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the price with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrievePrice<'a> { + inner: RetrievePriceBuilder<'a>, + price: &'a stripe_shared::PriceId, +} +impl<'a> RetrievePrice<'a> { + pub fn new(price: &'a stripe_shared::PriceId) -> Self { + Self { price, inner: RetrievePriceBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrievePrice<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePrice<'_> { + type Output = stripe_shared::Price; + + fn build(&self) -> RequestBuilder { + let price = self.price; + RequestBuilder::new(StripeMethod::Get, format!("/prices/{price}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdatePriceBuilder<'a> { /// Whether the price can be used for new purchases. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency_options: - Option<&'a std::collections::HashMap>, + pub currency_options: Option< + &'a std::collections::HashMap, + >, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -794,7 +1068,7 @@ pub struct UpdatePrice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transfer_lookup_key: Option, } -impl<'a> UpdatePrice<'a> { +impl<'a> UpdatePriceBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -802,7 +1076,7 @@ impl<'a> UpdatePrice<'a> { /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePriceCurrencyOptions { +pub struct UpdatePriceBuilderCurrencyOptions { /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] pub custom_unit_amount: Option, @@ -816,7 +1090,7 @@ pub struct UpdatePriceCurrencyOptions { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers: Option>, + pub tiers: Option>, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -825,7 +1099,7 @@ pub struct UpdatePriceCurrencyOptions { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option, } -impl UpdatePriceCurrencyOptions { +impl UpdatePriceBuilderCurrencyOptions { pub fn new() -> Self { Self::default() } @@ -834,7 +1108,7 @@ impl UpdatePriceCurrencyOptions { /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[derive(Clone, Debug, serde::Serialize)] -pub struct UpdatePriceCurrencyOptionsTiers { +pub struct UpdatePriceBuilderCurrencyOptionsTiers { /// The flat billing amount for an entire tier, regardless of the number of units in the tier. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, @@ -852,10 +1126,10 @@ pub struct UpdatePriceCurrencyOptionsTiers { /// Specifies the upper bound of this tier. /// The lower bound of a tier is the upper bound of the previous tier adding one. /// Use `inf` to define a fallback tier. - pub up_to: UpdatePriceCurrencyOptionsTiersUpTo, + pub up_to: UpdatePriceBuilderCurrencyOptionsTiersUpTo, } -impl UpdatePriceCurrencyOptionsTiers { - pub fn new(up_to: UpdatePriceCurrencyOptionsTiersUpTo) -> Self { +impl UpdatePriceBuilderCurrencyOptionsTiers { + pub fn new(up_to: UpdatePriceBuilderCurrencyOptionsTiersUpTo) -> Self { Self { flat_amount: None, flat_amount_decimal: None, @@ -870,21 +1144,92 @@ impl UpdatePriceCurrencyOptionsTiers { /// Use `inf` to define a fallback tier. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum UpdatePriceCurrencyOptionsTiersUpTo { +pub enum UpdatePriceBuilderCurrencyOptionsTiersUpTo { Inf, I64(i64), } +/// Updates the specified price by setting the values of the parameters passed. +/// Any parameters not provided are left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePrice<'a> { + inner: UpdatePriceBuilder<'a>, + price: &'a stripe_shared::PriceId, +} impl<'a> UpdatePrice<'a> { - /// Updates the specified price by setting the values of the parameters passed. - /// Any parameters not provided are left unchanged. - pub fn send( + pub fn new(price: &'a stripe_shared::PriceId) -> Self { + Self { price, inner: UpdatePriceBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn currency_options( + mut self, + currency_options: &'a std::collections::HashMap< + stripe_types::Currency, + UpdatePriceBuilderCurrencyOptions, + >, + ) -> Self { + self.inner.currency_options = Some(currency_options); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn lookup_key(mut self, lookup_key: &'a str) -> Self { + self.inner.lookup_key = Some(lookup_key); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn nickname(mut self, nickname: &'a str) -> Self { + self.inner.nickname = Some(nickname); + self + } + + pub fn tax_behavior(mut self, tax_behavior: stripe_shared::PriceTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } + + pub fn transfer_lookup_key(mut self, transfer_lookup_key: bool) -> Self { + self.inner.transfer_lookup_key = Some(transfer_lookup_key); + self + } +} +impl UpdatePrice<'_> { + pub async fn send( &self, - client: &stripe::Client, - price: &stripe_shared::PriceId, - ) -> stripe::Response { - client.send_form(&format!("/prices/{price}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePrice<'_> { + type Output = stripe_shared::Price; + + fn build(&self) -> RequestBuilder { + let price = self.price; + RequestBuilder::new(StripeMethod::Post, format!("/prices/{price}")).form(&self.inner) } } + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CustomUnitAmount { /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. diff --git a/generated/stripe_product/src/product/requests.rs b/generated/stripe_product/src/product/requests.rs index 4fc865adb..8e2343136 100644 --- a/generated/stripe_product/src/product/requests.rs +++ b/generated/stripe_product/src/product/requests.rs @@ -1,104 +1,9 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteProduct {} -impl DeleteProduct { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteProduct { - /// Delete a product. - /// Deleting a product is only possible if it has no prices associated with it. - /// Additionally, deleting a product with `type=good` is only possible if it has no SKUs associated with it. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::ProductId, - ) -> stripe::Response { - client.send_form(&format!("/products/{id}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListProduct<'a> { - /// Only return products that are active or inactive (e.g., pass `false` to list all inactive products). - #[serde(skip_serializing_if = "Option::is_none")] - pub active: Option, - /// Only return products that were created during the given date interval. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Only return products with the given IDs. - /// Cannot be used with [starting_after](https://stripe.com/docs/api#list_products-starting_after) or [ending_before](https://stripe.com/docs/api#list_products-ending_before). - #[serde(skip_serializing_if = "Option::is_none")] - pub ids: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Only return products that can be shipped (i.e., physical, not digital products). - #[serde(skip_serializing_if = "Option::is_none")] - pub shippable: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// Only return products of this type. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, - /// Only return products with the given url. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option<&'a str>, -} -impl<'a> ListProduct<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListProduct<'a> { - /// Returns a list of your products. - /// The products are returned sorted by creation date, with the most recently created products appearing first. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/products", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/products", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveProduct<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveProduct<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveProduct<'a> { - /// Retrieves the details of an existing product. - /// Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_shared::ProductId, - ) -> stripe::Response { - client.get_query(&format!("/products/{id}"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SearchProduct<'a> { +pub struct SearchProductBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -115,39 +20,72 @@ pub struct SearchProduct<'a> { /// See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for products](https://stripe.com/docs/search#query-fields-for-products). pub query: &'a str, } -impl<'a> SearchProduct<'a> { +impl<'a> SearchProductBuilder<'a> { pub fn new(query: &'a str) -> Self { Self { expand: None, limit: None, page: None, query } } } +/// Search for products you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). +/// Don’t use search in read-after-write flows where strict consistency is necessary. +/// Under normal operating. +/// conditions, data is searchable in less than a minute. +/// Occasionally, propagation of new or updated data can be up. +/// to an hour behind during outages. Search functionality is not available to merchants in India. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SearchProduct<'a> { + inner: SearchProductBuilder<'a>, +} impl<'a> SearchProduct<'a> { - /// Search for products you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language). - /// Don’t use search in read-after-write flows where strict consistency is necessary. - /// Under normal operating. - /// conditions, data is searchable in less than a minute. - /// Occasionally, propagation of new or updated data can be up. - /// to an hour behind during outages. Search functionality is not available to merchants in India. - pub fn send( + pub fn new(query: &'a str) -> Self { + Self { inner: SearchProductBuilder::new(query) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn page(mut self, page: &'a str) -> Self { + self.inner.page = Some(page); + self + } +} +impl SearchProduct<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/products/search", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_search_params("/products/search", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SearchProduct<'_> { + type Output = stripe_types::SearchList; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/products/search").query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProduct<'a> { +pub struct CreateProductBuilder<'a> { /// Whether the product is currently available for purchase. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object. /// This Price will be set as the default price for this product. #[serde(skip_serializing_if = "Option::is_none")] - pub default_price_data: Option>, + pub default_price_data: Option>, /// The product's description, meant to be displayable to the customer. /// Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. #[serde(skip_serializing_if = "Option::is_none")] @@ -207,7 +145,7 @@ pub struct CreateProduct<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> CreateProduct<'a> { +impl<'a> CreateProductBuilder<'a> { pub fn new(name: &'a str) -> Self { Self { active: None, @@ -232,7 +170,7 @@ impl<'a> CreateProduct<'a> { /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object. /// This Price will be set as the default price for this product. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProductDefaultPriceData<'a> { +pub struct CreateProductBuilderDefaultPriceData<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, @@ -242,18 +180,18 @@ pub struct CreateProductDefaultPriceData<'a> { pub currency_options: Option< &'a std::collections::HashMap< stripe_types::Currency, - CreateProductDefaultPriceDataCurrencyOptions, + CreateProductBuilderDefaultPriceDataCurrencyOptions, >, >, /// The recurring components of a price such as `interval` and `interval_count`. #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, + pub recurring: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. /// One of `unit_amount` or `unit_amount_decimal` is required. #[serde(skip_serializing_if = "Option::is_none")] @@ -263,7 +201,7 @@ pub struct CreateProductDefaultPriceData<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option<&'a str>, } -impl<'a> CreateProductDefaultPriceData<'a> { +impl<'a> CreateProductBuilderDefaultPriceData<'a> { pub fn new(currency: stripe_types::Currency) -> Self { Self { currency, @@ -278,21 +216,22 @@ impl<'a> CreateProductDefaultPriceData<'a> { /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Clone, Debug, Default, serde::Serialize)] -pub struct CreateProductDefaultPriceDataCurrencyOptions { +pub struct CreateProductBuilderDefaultPriceDataCurrencyOptions { /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_unit_amount: Option, + pub custom_unit_amount: + Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers: Option>, + pub tiers: Option>, /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -301,14 +240,14 @@ pub struct CreateProductDefaultPriceDataCurrencyOptions { #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount_decimal: Option, } -impl CreateProductDefaultPriceDataCurrencyOptions { +impl CreateProductBuilderDefaultPriceDataCurrencyOptions { pub fn new() -> Self { Self::default() } } /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProductDefaultPriceDataCurrencyOptionsCustomUnitAmount { +pub struct CreateProductBuilderDefaultPriceDataCurrencyOptionsCustomUnitAmount { /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. pub enabled: bool, /// The maximum unit amount the customer can specify for this item. @@ -322,7 +261,7 @@ pub struct CreateProductDefaultPriceDataCurrencyOptionsCustomUnitAmount { #[serde(skip_serializing_if = "Option::is_none")] pub preset: Option, } -impl CreateProductDefaultPriceDataCurrencyOptionsCustomUnitAmount { +impl CreateProductBuilderDefaultPriceDataCurrencyOptionsCustomUnitAmount { pub fn new(enabled: bool) -> Self { Self { enabled, maximum: None, minimum: None, preset: None } } @@ -332,14 +271,14 @@ impl CreateProductDefaultPriceDataCurrencyOptionsCustomUnitAmount { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +pub enum CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +impl CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior::*; + use CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -348,10 +287,10 @@ impl CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { } } -impl std::str::FromStr for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +impl std::str::FromStr for CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior::*; + use CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -360,18 +299,18 @@ impl std::str::FromStr for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavi } } } -impl std::fmt::Display for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +impl std::fmt::Display for CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +impl std::fmt::Debug for CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavior { +impl serde::Serialize for CreateProductBuilderDefaultPriceDataCurrencyOptionsTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -383,7 +322,7 @@ impl serde::Serialize for CreateProductDefaultPriceDataCurrencyOptionsTaxBehavio /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. #[derive(Clone, Debug, serde::Serialize)] -pub struct CreateProductDefaultPriceDataCurrencyOptionsTiers { +pub struct CreateProductBuilderDefaultPriceDataCurrencyOptionsTiers { /// The flat billing amount for an entire tier, regardless of the number of units in the tier. #[serde(skip_serializing_if = "Option::is_none")] pub flat_amount: Option, @@ -401,10 +340,10 @@ pub struct CreateProductDefaultPriceDataCurrencyOptionsTiers { /// Specifies the upper bound of this tier. /// The lower bound of a tier is the upper bound of the previous tier adding one. /// Use `inf` to define a fallback tier. - pub up_to: CreateProductDefaultPriceDataCurrencyOptionsTiersUpTo, + pub up_to: CreateProductBuilderDefaultPriceDataCurrencyOptionsTiersUpTo, } -impl CreateProductDefaultPriceDataCurrencyOptionsTiers { - pub fn new(up_to: CreateProductDefaultPriceDataCurrencyOptionsTiersUpTo) -> Self { +impl CreateProductBuilderDefaultPriceDataCurrencyOptionsTiers { + pub fn new(up_to: CreateProductBuilderDefaultPriceDataCurrencyOptionsTiersUpTo) -> Self { Self { flat_amount: None, flat_amount_decimal: None, @@ -419,37 +358,37 @@ impl CreateProductDefaultPriceDataCurrencyOptionsTiers { /// Use `inf` to define a fallback tier. #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] -pub enum CreateProductDefaultPriceDataCurrencyOptionsTiersUpTo { +pub enum CreateProductBuilderDefaultPriceDataCurrencyOptionsTiersUpTo { Inf, I64(i64), } /// The recurring components of a price such as `interval` and `interval_count`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProductDefaultPriceDataRecurring { +pub struct CreateProductBuilderDefaultPriceDataRecurring { /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreateProductDefaultPriceDataRecurringInterval, + pub interval: CreateProductBuilderDefaultPriceDataRecurringInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. - /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). #[serde(skip_serializing_if = "Option::is_none")] pub interval_count: Option, } -impl CreateProductDefaultPriceDataRecurring { - pub fn new(interval: CreateProductDefaultPriceDataRecurringInterval) -> Self { +impl CreateProductBuilderDefaultPriceDataRecurring { + pub fn new(interval: CreateProductBuilderDefaultPriceDataRecurringInterval) -> Self { Self { interval, interval_count: None } } } /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateProductDefaultPriceDataRecurringInterval { +pub enum CreateProductBuilderDefaultPriceDataRecurringInterval { Day, Month, Week, Year, } -impl CreateProductDefaultPriceDataRecurringInterval { +impl CreateProductBuilderDefaultPriceDataRecurringInterval { pub fn as_str(self) -> &'static str { - use CreateProductDefaultPriceDataRecurringInterval::*; + use CreateProductBuilderDefaultPriceDataRecurringInterval::*; match self { Day => "day", Month => "month", @@ -459,10 +398,10 @@ impl CreateProductDefaultPriceDataRecurringInterval { } } -impl std::str::FromStr for CreateProductDefaultPriceDataRecurringInterval { +impl std::str::FromStr for CreateProductBuilderDefaultPriceDataRecurringInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateProductDefaultPriceDataRecurringInterval::*; + use CreateProductBuilderDefaultPriceDataRecurringInterval::*; match s { "day" => Ok(Day), "month" => Ok(Month), @@ -472,18 +411,18 @@ impl std::str::FromStr for CreateProductDefaultPriceDataRecurringInterval { } } } -impl std::fmt::Display for CreateProductDefaultPriceDataRecurringInterval { +impl std::fmt::Display for CreateProductBuilderDefaultPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateProductDefaultPriceDataRecurringInterval { +impl std::fmt::Debug for CreateProductBuilderDefaultPriceDataRecurringInterval { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateProductDefaultPriceDataRecurringInterval { +impl serde::Serialize for CreateProductBuilderDefaultPriceDataRecurringInterval { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -496,14 +435,14 @@ impl serde::Serialize for CreateProductDefaultPriceDataRecurringInterval { /// One of `inclusive`, `exclusive`, or `unspecified`. /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateProductDefaultPriceDataTaxBehavior { +pub enum CreateProductBuilderDefaultPriceDataTaxBehavior { Exclusive, Inclusive, Unspecified, } -impl CreateProductDefaultPriceDataTaxBehavior { +impl CreateProductBuilderDefaultPriceDataTaxBehavior { pub fn as_str(self) -> &'static str { - use CreateProductDefaultPriceDataTaxBehavior::*; + use CreateProductBuilderDefaultPriceDataTaxBehavior::*; match self { Exclusive => "exclusive", Inclusive => "inclusive", @@ -512,10 +451,10 @@ impl CreateProductDefaultPriceDataTaxBehavior { } } -impl std::str::FromStr for CreateProductDefaultPriceDataTaxBehavior { +impl std::str::FromStr for CreateProductBuilderDefaultPriceDataTaxBehavior { type Err = (); fn from_str(s: &str) -> Result { - use CreateProductDefaultPriceDataTaxBehavior::*; + use CreateProductBuilderDefaultPriceDataTaxBehavior::*; match s { "exclusive" => Ok(Exclusive), "inclusive" => Ok(Inclusive), @@ -524,18 +463,18 @@ impl std::str::FromStr for CreateProductDefaultPriceDataTaxBehavior { } } } -impl std::fmt::Display for CreateProductDefaultPriceDataTaxBehavior { +impl std::fmt::Display for CreateProductBuilderDefaultPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateProductDefaultPriceDataTaxBehavior { +impl std::fmt::Debug for CreateProductBuilderDefaultPriceDataTaxBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateProductDefaultPriceDataTaxBehavior { +impl serde::Serialize for CreateProductBuilderDefaultPriceDataTaxBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -543,14 +482,169 @@ impl serde::Serialize for CreateProductDefaultPriceDataTaxBehavior { serializer.serialize_str(self.as_str()) } } +/// Creates a new product object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateProduct<'a> { + inner: CreateProductBuilder<'a>, +} impl<'a> CreateProduct<'a> { - /// Creates a new product object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/products", self, http_types::Method::Post) + pub fn new(name: &'a str) -> Self { + Self { inner: CreateProductBuilder::new(name) } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn default_price_data( + mut self, + default_price_data: CreateProductBuilderDefaultPriceData<'a>, + ) -> Self { + self.inner.default_price_data = Some(default_price_data); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn features(mut self, features: &'a [Features<'a>]) -> Self { + self.inner.features = Some(features); + self + } + + pub fn id(mut self, id: &'a str) -> Self { + self.inner.id = Some(id); + self + } + + pub fn images(mut self, images: &'a [&'a str]) -> Self { + self.inner.images = Some(images); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn package_dimensions(mut self, package_dimensions: PackageDimensionsSpecs) -> Self { + self.inner.package_dimensions = Some(package_dimensions); + self + } + + pub fn shippable(mut self, shippable: bool) -> Self { + self.inner.shippable = Some(shippable); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn tax_code(mut self, tax_code: &'a str) -> Self { + self.inner.tax_code = Some(tax_code); + self + } + + pub fn type_(mut self, type_: stripe_shared::ProductType) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn unit_label(mut self, unit_label: &'a str) -> Self { + self.inner.unit_label = Some(unit_label); + self + } + + pub fn url(mut self, url: &'a str) -> Self { + self.inner.url = Some(url); + self + } +} +impl CreateProduct<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateProduct<'_> { + type Output = stripe_shared::Product; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/products").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateProduct<'a> { +pub struct RetrieveProductBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveProductBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing product. +/// Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveProduct<'a> { + inner: RetrieveProductBuilder<'a>, + id: &'a stripe_shared::ProductId, +} +impl<'a> RetrieveProduct<'a> { + pub fn new(id: &'a stripe_shared::ProductId) -> Self { + Self { id, inner: RetrieveProductBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveProduct<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveProduct<'_> { + type Output = stripe_shared::Product; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/products/{id}")).query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateProductBuilder<'a> { /// Whether the product is available for purchase. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -607,22 +701,281 @@ pub struct UpdateProduct<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, } -impl<'a> UpdateProduct<'a> { +impl<'a> UpdateProductBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specific product by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateProduct<'a> { + inner: UpdateProductBuilder<'a>, + id: &'a stripe_shared::ProductId, +} impl<'a> UpdateProduct<'a> { - /// Updates the specific product by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(id: &'a stripe_shared::ProductId) -> Self { + Self { id, inner: UpdateProductBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn default_price(mut self, default_price: &'a str) -> Self { + self.inner.default_price = Some(default_price); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn features(mut self, features: &'a [Features<'a>]) -> Self { + self.inner.features = Some(features); + self + } + + pub fn images(mut self, images: &'a [&'a str]) -> Self { + self.inner.images = Some(images); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn name(mut self, name: &'a str) -> Self { + self.inner.name = Some(name); + self + } + + pub fn package_dimensions(mut self, package_dimensions: PackageDimensionsSpecs) -> Self { + self.inner.package_dimensions = Some(package_dimensions); + self + } + + pub fn shippable(mut self, shippable: bool) -> Self { + self.inner.shippable = Some(shippable); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } + + pub fn tax_code(mut self, tax_code: &'a str) -> Self { + self.inner.tax_code = Some(tax_code); + self + } + + pub fn unit_label(mut self, unit_label: &'a str) -> Self { + self.inner.unit_label = Some(unit_label); + self + } + + pub fn url(mut self, url: &'a str) -> Self { + self.inner.url = Some(url); + self + } +} +impl UpdateProduct<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_shared::ProductId, - ) -> stripe::Response { - client.send_form(&format!("/products/{id}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for UpdateProduct<'_> { + type Output = stripe_shared::Product; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/products/{id}")).form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListProductBuilder<'a> { + /// Only return products that are active or inactive (e.g., pass `false` to list all inactive products). + #[serde(skip_serializing_if = "Option::is_none")] + pub active: Option, + /// Only return products that were created during the given date interval. + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Only return products with the given IDs. + /// Cannot be used with [starting_after](https://stripe.com/docs/api#list_products-starting_after) or [ending_before](https://stripe.com/docs/api#list_products-ending_before). + #[serde(skip_serializing_if = "Option::is_none")] + pub ids: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Only return products that can be shipped (i.e., physical, not digital products). + #[serde(skip_serializing_if = "Option::is_none")] + pub shippable: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// Only return products of this type. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option, + /// Only return products with the given url. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option<&'a str>, +} +impl<'a> ListProductBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of your products. +/// The products are returned sorted by creation date, with the most recently created products appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListProduct<'a> { + inner: ListProductBuilder<'a>, +} +impl<'a> ListProduct<'a> { + pub fn new() -> Self { + Self { inner: ListProductBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn ids(mut self, ids: &'a [&'a str]) -> Self { + self.inner.ids = Some(ids); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn shippable(mut self, shippable: bool) -> Self { + self.inner.shippable = Some(shippable); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn type_(mut self, type_: stripe_shared::ProductType) -> Self { + self.inner.type_ = Some(type_); + self + } + + pub fn url(mut self, url: &'a str) -> Self { + self.inner.url = Some(url); + self + } +} +impl ListProduct<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListProduct<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/products").query(&self.inner) + } +} +/// Delete a product. +/// Deleting a product is only possible if it has no prices associated with it. +/// Additionally, deleting a product with `type=good` is only possible if it has no SKUs associated with it. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteProduct<'a> { + id: &'a stripe_shared::ProductId, +} +impl<'a> DeleteProduct<'a> { + pub fn new(id: &'a stripe_shared::ProductId) -> Self { + Self { id } + } +} +impl DeleteProduct<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteProduct<'_> { + type Output = stripe_shared::DeletedProduct; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Delete, format!("/products/{id}")) + } +} + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct Features<'a> { /// The feature's name. Up to 80 characters long. diff --git a/generated/stripe_product/src/promotion_code/requests.rs b/generated/stripe_product/src/promotion_code/requests.rs index 9e35b2d1d..6c0b9e890 100644 --- a/generated/stripe_product/src/promotion_code/requests.rs +++ b/generated/stripe_product/src/promotion_code/requests.rs @@ -1,82 +1,61 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListPromotionCode<'a> { - /// Filter promotion codes by whether they are active. - #[serde(skip_serializing_if = "Option::is_none")] - pub active: Option, - /// Only return promotion codes that have this case-insensitive code. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, - /// Only return promotion codes for this coupon. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// A filter on the list, based on the object `created` field. - /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// Only return promotion codes that are restricted to this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrievePromotionCodeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> ListPromotionCode<'a> { +impl<'a> RetrievePromotionCodeBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListPromotionCode<'a> { - /// Returns a list of your promotion codes. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/promotion_codes", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/promotion_codes", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves the promotion code with the given ID. +/// In order to retrieve a promotion code by the customer-facing `code` use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired `code`. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrievePromotionCode<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: RetrievePromotionCodeBuilder<'a>, + promotion_code: &'a stripe_shared::PromotionCodeId, } impl<'a> RetrievePromotionCode<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(promotion_code: &'a stripe_shared::PromotionCodeId) -> Self { + Self { promotion_code, inner: RetrievePromotionCodeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrievePromotionCode<'a> { - /// Retrieves the promotion code with the given ID. - /// In order to retrieve a promotion code by the customer-facing `code` use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired `code`. - pub fn send( +impl RetrievePromotionCode<'_> { + pub async fn send( &self, - client: &stripe::Client, - promotion_code: &stripe_shared::PromotionCodeId, - ) -> stripe::Response { - client.get_query(&format!("/promotion_codes/{promotion_code}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrievePromotionCode<'_> { + type Output = stripe_shared::PromotionCode; + + fn build(&self) -> RequestBuilder { + let promotion_code = self.promotion_code; + RequestBuilder::new(StripeMethod::Get, format!("/promotion_codes/{promotion_code}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePromotionCode<'a> { +pub struct CreatePromotionCodeBuilder<'a> { /// Whether the promotion code is currently active. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -110,9 +89,9 @@ pub struct CreatePromotionCode<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Settings that restrict the redemption of the promotion code. #[serde(skip_serializing_if = "Option::is_none")] - pub restrictions: Option>, + pub restrictions: Option>, } -impl<'a> CreatePromotionCode<'a> { +impl<'a> CreatePromotionCodeBuilder<'a> { pub fn new(coupon: &'a str) -> Self { Self { active: None, @@ -129,7 +108,7 @@ impl<'a> CreatePromotionCode<'a> { } /// Settings that restrict the redemption of the promotion code. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePromotionCodeRestrictions<'a> { +pub struct CreatePromotionCodeBuilderRestrictions<'a> { /// Promotion codes defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] @@ -145,20 +124,89 @@ pub struct CreatePromotionCodeRestrictions<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub minimum_amount_currency: Option, } -impl<'a> CreatePromotionCodeRestrictions<'a> { +impl<'a> CreatePromotionCodeBuilderRestrictions<'a> { pub fn new() -> Self { Self::default() } } +/// A promotion code points to a coupon. +/// You can optionally restrict the code to a specific customer, redemption limit, and expiration date. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreatePromotionCode<'a> { + inner: CreatePromotionCodeBuilder<'a>, +} impl<'a> CreatePromotionCode<'a> { - /// A promotion code points to a coupon. - /// You can optionally restrict the code to a specific customer, redemption limit, and expiration date. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/promotion_codes", self, http_types::Method::Post) + pub fn new(coupon: &'a str) -> Self { + Self { inner: CreatePromotionCodeBuilder::new(coupon) } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn code(mut self, code: &'a str) -> Self { + self.inner.code = Some(code); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn expires_at(mut self, expires_at: stripe_types::Timestamp) -> Self { + self.inner.expires_at = Some(expires_at); + self + } + + pub fn max_redemptions(mut self, max_redemptions: i64) -> Self { + self.inner.max_redemptions = Some(max_redemptions); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn restrictions( + mut self, + restrictions: CreatePromotionCodeBuilderRestrictions<'a>, + ) -> Self { + self.inner.restrictions = Some(restrictions); + self + } +} +impl CreatePromotionCode<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreatePromotionCode<'_> { + type Output = stripe_shared::PromotionCode; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/promotion_codes").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePromotionCode<'a> { +pub struct UpdatePromotionCodeBuilder<'a> { /// Whether the promotion code is currently active. /// A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable. #[serde(skip_serializing_if = "Option::is_none")] @@ -174,42 +222,205 @@ pub struct UpdatePromotionCode<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Settings that restrict the redemption of the promotion code. #[serde(skip_serializing_if = "Option::is_none")] - pub restrictions: Option>, + pub restrictions: Option>, } -impl<'a> UpdatePromotionCode<'a> { +impl<'a> UpdatePromotionCodeBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Settings that restrict the redemption of the promotion code. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePromotionCodeRestrictions<'a> { +pub struct UpdatePromotionCodeBuilderRestrictions<'a> { /// Promotion codes defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] pub currency_options: Option<&'a std::collections::HashMap>, } -impl<'a> UpdatePromotionCodeRestrictions<'a> { +impl<'a> UpdatePromotionCodeBuilderRestrictions<'a> { pub fn new() -> Self { Self::default() } } +/// Updates the specified promotion code by setting the values of the parameters passed. +/// Most fields are, by design, not editable. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdatePromotionCode<'a> { + inner: UpdatePromotionCodeBuilder<'a>, + promotion_code: &'a stripe_shared::PromotionCodeId, +} impl<'a> UpdatePromotionCode<'a> { - /// Updates the specified promotion code by setting the values of the parameters passed. - /// Most fields are, by design, not editable. - pub fn send( + pub fn new(promotion_code: &'a stripe_shared::PromotionCodeId) -> Self { + Self { promotion_code, inner: UpdatePromotionCodeBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn restrictions( + mut self, + restrictions: UpdatePromotionCodeBuilderRestrictions<'a>, + ) -> Self { + self.inner.restrictions = Some(restrictions); + self + } +} +impl UpdatePromotionCode<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdatePromotionCode<'_> { + type Output = stripe_shared::PromotionCode; + + fn build(&self) -> RequestBuilder { + let promotion_code = self.promotion_code; + RequestBuilder::new(StripeMethod::Post, format!("/promotion_codes/{promotion_code}")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListPromotionCodeBuilder<'a> { + /// Filter promotion codes by whether they are active. + #[serde(skip_serializing_if = "Option::is_none")] + pub active: Option, + /// Only return promotion codes that have this case-insensitive code. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option<&'a str>, + /// Only return promotion codes for this coupon. + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// A filter on the list, based on the object `created` field. + /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// Only return promotion codes that are restricted to this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListPromotionCodeBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of your promotion codes. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListPromotionCode<'a> { + inner: ListPromotionCodeBuilder<'a>, +} +impl<'a> ListPromotionCode<'a> { + pub fn new() -> Self { + Self { inner: ListPromotionCodeBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn code(mut self, code: &'a str) -> Self { + self.inner.code = Some(code); + self + } + + pub fn coupon(mut self, coupon: &'a str) -> Self { + self.inner.coupon = Some(coupon); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListPromotionCode<'_> { + pub async fn send( &self, - client: &stripe::Client, - promotion_code: &stripe_shared::PromotionCodeId, - ) -> stripe::Response { - client.send_form( - &format!("/promotion_codes/{promotion_code}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListPromotionCode<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/promotion_codes").query(&self.inner) } } + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CurrencyOption { /// Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). diff --git a/generated/stripe_product/src/shipping_rate/requests.rs b/generated/stripe_product/src/shipping_rate/requests.rs index c785de5c1..5edd2b57b 100644 --- a/generated/stripe_product/src/shipping_rate/requests.rs +++ b/generated/stripe_product/src/shipping_rate/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListShippingRate<'a> { +pub struct ListShippingRateBuilder<'a> { /// Only return shipping rates that are active or inactive. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -28,52 +32,135 @@ pub struct ListShippingRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListShippingRate<'a> { +impl<'a> ListShippingRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your shipping rates. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListShippingRate<'a> { + inner: ListShippingRateBuilder<'a>, +} impl<'a> ListShippingRate<'a> { - /// Returns a list of your shipping rates. - pub fn send( + pub fn new() -> Self { + Self { inner: ListShippingRateBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn currency(mut self, currency: stripe_types::Currency) -> Self { + self.inner.currency = Some(currency); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListShippingRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/shipping_rates", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/shipping_rates", self) +} + +impl StripeRequest for ListShippingRate<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/shipping_rates").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveShippingRate<'a> { +pub struct RetrieveShippingRateBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveShippingRate<'a> { +impl<'a> RetrieveShippingRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns the shipping rate object with the given ID. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveShippingRate<'a> { + inner: RetrieveShippingRateBuilder<'a>, + shipping_rate_token: &'a stripe_shared::ShippingRateId, +} impl<'a> RetrieveShippingRate<'a> { - /// Returns the shipping rate object with the given ID. - pub fn send( + pub fn new(shipping_rate_token: &'a stripe_shared::ShippingRateId) -> Self { + Self { shipping_rate_token, inner: RetrieveShippingRateBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveShippingRate<'_> { + pub async fn send( &self, - client: &stripe::Client, - shipping_rate_token: &stripe_shared::ShippingRateId, - ) -> stripe::Response { - client.get_query(&format!("/shipping_rates/{shipping_rate_token}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveShippingRate<'_> { + type Output = stripe_shared::ShippingRate; + + fn build(&self) -> RequestBuilder { + let shipping_rate_token = self.shipping_rate_token; + RequestBuilder::new(StripeMethod::Get, format!("/shipping_rates/{shipping_rate_token}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateShippingRate<'a> { +pub struct CreateShippingRateBuilder<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[serde(skip_serializing_if = "Option::is_none")] - pub delivery_estimate: Option, + pub delivery_estimate: Option, /// The name of the shipping rate, meant to be displayable to the customer. /// This will appear on CheckoutSessions. pub display_name: &'a str, @@ -82,7 +169,7 @@ pub struct CreateShippingRate<'a> { pub expand: Option<&'a [&'a str]>, /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amount: Option>, + pub fixed_amount: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -102,7 +189,7 @@ pub struct CreateShippingRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, } -impl<'a> CreateShippingRate<'a> { +impl<'a> CreateShippingRateBuilder<'a> { pub fn new(display_name: &'a str) -> Self { Self { delivery_estimate: None, @@ -119,44 +206,44 @@ impl<'a> CreateShippingRate<'a> { /// The estimated range for how long shipping will take, meant to be displayable to the customer. /// This will appear on CheckoutSessions. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateShippingRateDeliveryEstimate { +pub struct CreateShippingRateBuilderDeliveryEstimate { /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, + pub maximum: Option, /// The lower bound of the estimated range. If empty, represents no lower bound. #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, + pub minimum: Option, } -impl CreateShippingRateDeliveryEstimate { +impl CreateShippingRateBuilderDeliveryEstimate { pub fn new() -> Self { Self::default() } } /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateShippingRateDeliveryEstimateMaximum { +pub struct CreateShippingRateBuilderDeliveryEstimateMaximum { /// A unit of time. - pub unit: CreateShippingRateDeliveryEstimateMaximumUnit, + pub unit: CreateShippingRateBuilderDeliveryEstimateMaximumUnit, /// Must be greater than 0. pub value: i64, } -impl CreateShippingRateDeliveryEstimateMaximum { - pub fn new(unit: CreateShippingRateDeliveryEstimateMaximumUnit, value: i64) -> Self { +impl CreateShippingRateBuilderDeliveryEstimateMaximum { + pub fn new(unit: CreateShippingRateBuilderDeliveryEstimateMaximumUnit, value: i64) -> Self { Self { unit, value } } } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateShippingRateDeliveryEstimateMaximumUnit { +pub enum CreateShippingRateBuilderDeliveryEstimateMaximumUnit { BusinessDay, Day, Hour, Month, Week, } -impl CreateShippingRateDeliveryEstimateMaximumUnit { +impl CreateShippingRateBuilderDeliveryEstimateMaximumUnit { pub fn as_str(self) -> &'static str { - use CreateShippingRateDeliveryEstimateMaximumUnit::*; + use CreateShippingRateBuilderDeliveryEstimateMaximumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -167,10 +254,10 @@ impl CreateShippingRateDeliveryEstimateMaximumUnit { } } -impl std::str::FromStr for CreateShippingRateDeliveryEstimateMaximumUnit { +impl std::str::FromStr for CreateShippingRateBuilderDeliveryEstimateMaximumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateShippingRateDeliveryEstimateMaximumUnit::*; + use CreateShippingRateBuilderDeliveryEstimateMaximumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -181,18 +268,18 @@ impl std::str::FromStr for CreateShippingRateDeliveryEstimateMaximumUnit { } } } -impl std::fmt::Display for CreateShippingRateDeliveryEstimateMaximumUnit { +impl std::fmt::Display for CreateShippingRateBuilderDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateShippingRateDeliveryEstimateMaximumUnit { +impl std::fmt::Debug for CreateShippingRateBuilderDeliveryEstimateMaximumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateShippingRateDeliveryEstimateMaximumUnit { +impl serde::Serialize for CreateShippingRateBuilderDeliveryEstimateMaximumUnit { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -202,29 +289,29 @@ impl serde::Serialize for CreateShippingRateDeliveryEstimateMaximumUnit { } /// The lower bound of the estimated range. If empty, represents no lower bound. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateShippingRateDeliveryEstimateMinimum { +pub struct CreateShippingRateBuilderDeliveryEstimateMinimum { /// A unit of time. - pub unit: CreateShippingRateDeliveryEstimateMinimumUnit, + pub unit: CreateShippingRateBuilderDeliveryEstimateMinimumUnit, /// Must be greater than 0. pub value: i64, } -impl CreateShippingRateDeliveryEstimateMinimum { - pub fn new(unit: CreateShippingRateDeliveryEstimateMinimumUnit, value: i64) -> Self { +impl CreateShippingRateBuilderDeliveryEstimateMinimum { + pub fn new(unit: CreateShippingRateBuilderDeliveryEstimateMinimumUnit, value: i64) -> Self { Self { unit, value } } } /// A unit of time. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateShippingRateDeliveryEstimateMinimumUnit { +pub enum CreateShippingRateBuilderDeliveryEstimateMinimumUnit { BusinessDay, Day, Hour, Month, Week, } -impl CreateShippingRateDeliveryEstimateMinimumUnit { +impl CreateShippingRateBuilderDeliveryEstimateMinimumUnit { pub fn as_str(self) -> &'static str { - use CreateShippingRateDeliveryEstimateMinimumUnit::*; + use CreateShippingRateBuilderDeliveryEstimateMinimumUnit::*; match self { BusinessDay => "business_day", Day => "day", @@ -235,10 +322,10 @@ impl CreateShippingRateDeliveryEstimateMinimumUnit { } } -impl std::str::FromStr for CreateShippingRateDeliveryEstimateMinimumUnit { +impl std::str::FromStr for CreateShippingRateBuilderDeliveryEstimateMinimumUnit { type Err = (); fn from_str(s: &str) -> Result { - use CreateShippingRateDeliveryEstimateMinimumUnit::*; + use CreateShippingRateBuilderDeliveryEstimateMinimumUnit::*; match s { "business_day" => Ok(BusinessDay), "day" => Ok(Day), @@ -249,18 +336,18 @@ impl std::str::FromStr for CreateShippingRateDeliveryEstimateMinimumUnit { } } } -impl std::fmt::Display for CreateShippingRateDeliveryEstimateMinimumUnit { +impl std::fmt::Display for CreateShippingRateBuilderDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateShippingRateDeliveryEstimateMinimumUnit { +impl std::fmt::Debug for CreateShippingRateBuilderDeliveryEstimateMinimumUnit { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateShippingRateDeliveryEstimateMinimumUnit { +impl serde::Serialize for CreateShippingRateBuilderDeliveryEstimateMinimumUnit { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -270,7 +357,7 @@ impl serde::Serialize for CreateShippingRateDeliveryEstimateMinimumUnit { } /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateShippingRateFixedAmount<'a> { +pub struct CreateShippingRateBuilderFixedAmount<'a> { /// A non-negative integer in cents representing how much to charge. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -282,11 +369,11 @@ pub struct CreateShippingRateFixedAmount<'a> { pub currency_options: Option< &'a std::collections::HashMap< stripe_types::Currency, - CreateShippingRateFixedAmountCurrencyOptions, + CreateShippingRateBuilderFixedAmountCurrencyOptions, >, >, } -impl<'a> CreateShippingRateFixedAmount<'a> { +impl<'a> CreateShippingRateBuilderFixedAmount<'a> { pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { Self { amount, currency, currency_options: None } } @@ -294,7 +381,7 @@ impl<'a> CreateShippingRateFixedAmount<'a> { /// Shipping rates defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateShippingRateFixedAmountCurrencyOptions { +pub struct CreateShippingRateBuilderFixedAmountCurrencyOptions { /// A non-negative integer in cents representing how much to charge. pub amount: i64, /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. @@ -302,19 +389,83 @@ pub struct CreateShippingRateFixedAmountCurrencyOptions { #[serde(skip_serializing_if = "Option::is_none")] pub tax_behavior: Option, } -impl CreateShippingRateFixedAmountCurrencyOptions { +impl CreateShippingRateBuilderFixedAmountCurrencyOptions { pub fn new(amount: i64) -> Self { Self { amount, tax_behavior: None } } } +/// Creates a new shipping rate object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateShippingRate<'a> { + inner: CreateShippingRateBuilder<'a>, +} impl<'a> CreateShippingRate<'a> { - /// Creates a new shipping rate object. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/shipping_rates", self, http_types::Method::Post) + pub fn new(display_name: &'a str) -> Self { + Self { inner: CreateShippingRateBuilder::new(display_name) } + } + pub fn delivery_estimate( + mut self, + delivery_estimate: CreateShippingRateBuilderDeliveryEstimate, + ) -> Self { + self.inner.delivery_estimate = Some(delivery_estimate); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fixed_amount(mut self, fixed_amount: CreateShippingRateBuilderFixedAmount<'a>) -> Self { + self.inner.fixed_amount = Some(fixed_amount); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn tax_behavior(mut self, tax_behavior: stripe_shared::ShippingRateTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } + + pub fn tax_code(mut self, tax_code: &'a str) -> Self { + self.inner.tax_code = Some(tax_code); + self + } + + pub fn type_(mut self, type_: stripe_shared::ShippingRateType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl CreateShippingRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateShippingRate<'_> { + type Output = stripe_shared::ShippingRate; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/shipping_rates").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateShippingRate<'a> { +pub struct UpdateShippingRateBuilder<'a> { /// Whether the shipping rate can be used for new purchases. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -323,7 +474,7 @@ pub struct UpdateShippingRate<'a> { pub expand: Option<&'a [&'a str]>, /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amount: Option>, + pub fixed_amount: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -335,25 +486,25 @@ pub struct UpdateShippingRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_behavior: Option, } -impl<'a> UpdateShippingRate<'a> { +impl<'a> UpdateShippingRateBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateShippingRateFixedAmount<'a> { +pub struct UpdateShippingRateBuilderFixedAmount<'a> { /// Shipping rates defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] pub currency_options: Option< &'a std::collections::HashMap< stripe_types::Currency, - UpdateShippingRateFixedAmountCurrencyOptions, + UpdateShippingRateBuilderFixedAmountCurrencyOptions, >, >, } -impl<'a> UpdateShippingRateFixedAmount<'a> { +impl<'a> UpdateShippingRateBuilderFixedAmount<'a> { pub fn new() -> Self { Self::default() } @@ -361,7 +512,7 @@ impl<'a> UpdateShippingRateFixedAmount<'a> { /// Shipping rates defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateShippingRateFixedAmountCurrencyOptions { +pub struct UpdateShippingRateBuilderFixedAmountCurrencyOptions { /// A non-negative integer in cents representing how much to charge. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -370,22 +521,68 @@ pub struct UpdateShippingRateFixedAmountCurrencyOptions { #[serde(skip_serializing_if = "Option::is_none")] pub tax_behavior: Option, } -impl UpdateShippingRateFixedAmountCurrencyOptions { +impl UpdateShippingRateBuilderFixedAmountCurrencyOptions { pub fn new() -> Self { Self::default() } } +/// Updates an existing shipping rate object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateShippingRate<'a> { + inner: UpdateShippingRateBuilder<'a>, + shipping_rate_token: &'a stripe_shared::ShippingRateId, +} impl<'a> UpdateShippingRate<'a> { - /// Updates an existing shipping rate object. - pub fn send( + pub fn new(shipping_rate_token: &'a stripe_shared::ShippingRateId) -> Self { + Self { shipping_rate_token, inner: UpdateShippingRateBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn fixed_amount(mut self, fixed_amount: UpdateShippingRateBuilderFixedAmount<'a>) -> Self { + self.inner.fixed_amount = Some(fixed_amount); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn tax_behavior(mut self, tax_behavior: stripe_shared::ShippingRateTaxBehavior) -> Self { + self.inner.tax_behavior = Some(tax_behavior); + self + } +} +impl UpdateShippingRate<'_> { + pub async fn send( &self, - client: &stripe::Client, - shipping_rate_token: &stripe_shared::ShippingRateId, - ) -> stripe::Response { - client.send_form( - &format!("/shipping_rates/{shipping_rate_token}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateShippingRate<'_> { + type Output = stripe_shared::ShippingRate; + + fn build(&self) -> RequestBuilder { + let shipping_rate_token = self.shipping_rate_token; + RequestBuilder::new(StripeMethod::Post, format!("/shipping_rates/{shipping_rate_token}")) + .form(&self.inner) } } diff --git a/generated/stripe_product/src/tax_code/requests.rs b/generated/stripe_product/src/tax_code/requests.rs index ee21268c9..5e225ae67 100644 --- a/generated/stripe_product/src/tax_code/requests.rs +++ b/generated/stripe_product/src/tax_code/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTaxCode<'a> { +pub struct ListTaxCodeBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -18,42 +22,111 @@ pub struct ListTaxCode<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListTaxCode<'a> { +impl<'a> ListTaxCodeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// A list of [all tax codes available](https://stripe.com/docs/tax/tax-categories) to add to Products in order to allow specific tax calculations. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTaxCode<'a> { + inner: ListTaxCodeBuilder<'a>, +} impl<'a> ListTaxCode<'a> { - /// A list of [all tax codes available](https://stripe.com/docs/tax/tax-categories) to add to Products in order to allow specific tax calculations. - pub fn send( + pub fn new() -> Self { + Self { inner: ListTaxCodeBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTaxCode<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/tax_codes", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/tax_codes", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTaxCode<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/tax_codes").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTaxCode<'a> { +pub struct RetrieveTaxCodeBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTaxCode<'a> { +impl<'a> RetrieveTaxCodeBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing tax code. +/// Supply the unique tax code ID and Stripe will return the corresponding tax code information. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTaxCode<'a> { + inner: RetrieveTaxCodeBuilder<'a>, + id: &'a stripe_shared::TaxCodeId, +} impl<'a> RetrieveTaxCode<'a> { - /// Retrieves the details of an existing tax code. - /// Supply the unique tax code ID and Stripe will return the corresponding tax code information. - pub fn send( + pub fn new(id: &'a stripe_shared::TaxCodeId) -> Self { + Self { id, inner: RetrieveTaxCodeBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTaxCode<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_shared::TaxCodeId, - ) -> stripe::Response { - client.get_query(&format!("/tax_codes/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTaxCode<'_> { + type Output = stripe_shared::TaxCode; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/tax_codes/{id}")).query(&self.inner) } } diff --git a/generated/stripe_product/src/tax_rate/requests.rs b/generated/stripe_product/src/tax_rate/requests.rs index fa943d8d6..26e61a849 100644 --- a/generated/stripe_product/src/tax_rate/requests.rs +++ b/generated/stripe_product/src/tax_rate/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTaxRate<'a> { +pub struct ListTaxRateBuilder<'a> { /// Optional flag to filter by tax rates that are either active or inactive (archived). #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -27,47 +31,131 @@ pub struct ListTaxRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListTaxRate<'a> { +impl<'a> ListTaxRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of your tax rates. +/// Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTaxRate<'a> { + inner: ListTaxRateBuilder<'a>, +} impl<'a> ListTaxRate<'a> { - /// Returns a list of your tax rates. - /// Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first. - pub fn send( + pub fn new() -> Self { + Self { inner: ListTaxRateBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn inclusive(mut self, inclusive: bool) -> Self { + self.inner.inclusive = Some(inclusive); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTaxRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/tax_rates", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/tax_rates", self) +} + +impl StripeRequest for ListTaxRate<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/tax_rates").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTaxRate<'a> { +pub struct RetrieveTaxRateBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTaxRate<'a> { +impl<'a> RetrieveTaxRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a tax rate with the given ID +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTaxRate<'a> { + inner: RetrieveTaxRateBuilder<'a>, + tax_rate: &'a stripe_shared::TaxRateId, +} impl<'a> RetrieveTaxRate<'a> { - /// Retrieves a tax rate with the given ID - pub fn send( + pub fn new(tax_rate: &'a stripe_shared::TaxRateId) -> Self { + Self { tax_rate, inner: RetrieveTaxRateBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTaxRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - tax_rate: &stripe_shared::TaxRateId, - ) -> stripe::Response { - client.get_query(&format!("/tax_rates/{tax_rate}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTaxRate<'_> { + type Output = stripe_shared::TaxRate; + + fn build(&self) -> RequestBuilder { + let tax_rate = self.tax_rate; + RequestBuilder::new(StripeMethod::Get, format!("/tax_rates/{tax_rate}")).query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTaxRate<'a> { +pub struct CreateTaxRateBuilder<'a> { /// Flag determining whether the tax rate is active or inactive (archived). /// Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. #[serde(skip_serializing_if = "Option::is_none")] @@ -107,7 +195,7 @@ pub struct CreateTaxRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_type: Option, } -impl<'a> CreateTaxRate<'a> { +impl<'a> CreateTaxRateBuilder<'a> { pub fn new(display_name: &'a str, inclusive: bool, percentage: f64) -> Self { Self { active: None, @@ -124,14 +212,80 @@ impl<'a> CreateTaxRate<'a> { } } } +/// Creates a new tax rate. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTaxRate<'a> { + inner: CreateTaxRateBuilder<'a>, +} impl<'a> CreateTaxRate<'a> { - /// Creates a new tax rate. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tax_rates", self, http_types::Method::Post) + pub fn new(display_name: &'a str, inclusive: bool, percentage: f64) -> Self { + Self { inner: CreateTaxRateBuilder::new(display_name, inclusive, percentage) } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn country(mut self, country: &'a str) -> Self { + self.inner.country = Some(country); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn jurisdiction(mut self, jurisdiction: &'a str) -> Self { + self.inner.jurisdiction = Some(jurisdiction); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn state(mut self, state: &'a str) -> Self { + self.inner.state = Some(state); + self + } + + pub fn tax_type(mut self, tax_type: stripe_shared::TaxRateTaxType) -> Self { + self.inner.tax_type = Some(tax_type); + self + } +} +impl CreateTaxRate<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTaxRate<'_> { + type Output = stripe_shared::TaxRate; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/tax_rates").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTaxRate<'a> { +pub struct UpdateTaxRateBuilder<'a> { /// Flag determining whether the tax rate is active or inactive (archived). /// Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. #[serde(skip_serializing_if = "Option::is_none")] @@ -168,18 +322,87 @@ pub struct UpdateTaxRate<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub tax_type: Option, } -impl<'a> UpdateTaxRate<'a> { +impl<'a> UpdateTaxRateBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Updates an existing tax rate. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTaxRate<'a> { + inner: UpdateTaxRateBuilder<'a>, + tax_rate: &'a stripe_shared::TaxRateId, +} impl<'a> UpdateTaxRate<'a> { - /// Updates an existing tax rate. - pub fn send( + pub fn new(tax_rate: &'a stripe_shared::TaxRateId) -> Self { + Self { tax_rate, inner: UpdateTaxRateBuilder::new() } + } + pub fn active(mut self, active: bool) -> Self { + self.inner.active = Some(active); + self + } + + pub fn country(mut self, country: &'a str) -> Self { + self.inner.country = Some(country); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn display_name(mut self, display_name: &'a str) -> Self { + self.inner.display_name = Some(display_name); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn jurisdiction(mut self, jurisdiction: &'a str) -> Self { + self.inner.jurisdiction = Some(jurisdiction); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn state(mut self, state: &'a str) -> Self { + self.inner.state = Some(state); + self + } + + pub fn tax_type(mut self, tax_type: stripe_shared::TaxRateTaxType) -> Self { + self.inner.tax_type = Some(tax_type); + self + } +} +impl UpdateTaxRate<'_> { + pub async fn send( &self, - client: &stripe::Client, - tax_rate: &stripe_shared::TaxRateId, - ) -> stripe::Response { - client.send_form(&format!("/tax_rates/{tax_rate}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTaxRate<'_> { + type Output = stripe_shared::TaxRate; + + fn build(&self) -> RequestBuilder { + let tax_rate = self.tax_rate; + RequestBuilder::new(StripeMethod::Post, format!("/tax_rates/{tax_rate}")).form(&self.inner) } } diff --git a/generated/stripe_shared/Cargo.toml b/generated/stripe_shared/Cargo.toml index abaa68367..0d5efbb93 100644 --- a/generated/stripe_shared/Cargo.toml +++ b/generated/stripe_shared/Cargo.toml @@ -24,4 +24,3 @@ stripe_types = {path = "../../stripe_types"} - diff --git a/generated/stripe_shared/src/account.rs b/generated/stripe_shared/src/account.rs index c34d82a4d..4a0d6ae52 100644 --- a/generated/stripe_shared/src/account.rs +++ b/generated/stripe_shared/src/account.rs @@ -5,9 +5,10 @@ /// For Custom accounts, the properties below are always returned. /// For other accounts, some properties are returned until that. /// account has started to go through Connect Onboarding. -/// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions),. -/// some properties are only returned for Custom accounts. -/// Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts). +/// Once you create an [Account Link](https://stripe.com/docs/api/account_links). +/// for a Standard or Express account, some parameters are no longer returned. +/// These are marked as **Custom Only** or **Custom and Express**. +/// below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts). /// /// For more details see <>. #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -16,7 +17,6 @@ pub struct Account { #[serde(skip_serializing_if = "Option::is_none")] pub business_profile: Option, /// The business type. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), this property is only returned for Custom accounts. #[serde(skip_serializing_if = "Option::is_none")] pub business_type: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -46,8 +46,7 @@ pub struct Account { /// It's not used for authentication and Stripe doesn't market to this field without explicit approval from the platform. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option, - /// External accounts (bank accounts and debit cards) currently attached to this account. - /// External accounts are only returned for requests where `controller[is_controller]` is true. + /// External accounts (bank accounts and debit cards) currently attached to this account #[serde(skip_serializing_if = "Option::is_none")] pub external_accounts: Option>, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/stripe_shared/src/account_annual_revenue.rs b/generated/stripe_shared/src/account_annual_revenue.rs deleted file mode 100644 index 7f3366455..000000000 --- a/generated/stripe_shared/src/account_annual_revenue.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct AccountAnnualRevenue { - /// A non-negative integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - pub amount: Option, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: Option, - /// The close-out date of the preceding fiscal year in ISO 8601 format. - /// E.g. - /// 2023-12-31 for the 31st of December, 2023. - pub fiscal_year_end: Option, -} diff --git a/generated/stripe_shared/src/account_business_profile.rs b/generated/stripe_shared/src/account_business_profile.rs index 50c276b7b..5e485c9d3 100644 --- a/generated/stripe_shared/src/account_business_profile.rs +++ b/generated/stripe_shared/src/account_business_profile.rs @@ -1,10 +1,5 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct AccountBusinessProfile { - /// The applicant's gross annual revenue for its preceding fiscal year. - pub annual_revenue: Option, - /// An estimated upper bound of employees, contractors, vendors, etc. - /// currently working for the business. - pub estimated_worker_count: Option, /// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). /// MCCs are used to classify businesses based on the goods or services they provide. pub mcc: Option, diff --git a/generated/stripe_shared/src/account_capabilities.rs b/generated/stripe_shared/src/account_capabilities.rs index ba6b0b499..d59459d9d 100644 --- a/generated/stripe_shared/src/account_capabilities.rs +++ b/generated/stripe_shared/src/account_capabilities.rs @@ -93,9 +93,6 @@ pub struct AccountCapabilities { /// The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. #[serde(skip_serializing_if = "Option::is_none")] pub sofort_payments: Option, - /// The status of the Swish capability of the account, or whether the account can directly process Swish payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub swish_payments: Option, /// The status of the tax reporting 1099-K (US) capability of the account. #[serde(skip_serializing_if = "Option::is_none")] pub tax_reporting_us_1099_k: Option, diff --git a/generated/stripe_shared/src/account_invoices_settings.rs b/generated/stripe_shared/src/account_invoices_settings.rs deleted file mode 100644 index f493594a8..000000000 --- a/generated/stripe_shared/src/account_invoices_settings.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct AccountInvoicesSettings { - /// The list of default Account Tax IDs to automatically include on invoices. - /// Account Tax IDs get added when an invoice is finalized. - pub default_account_tax_ids: Option>>, -} diff --git a/generated/stripe_shared/src/account_settings.rs b/generated/stripe_shared/src/account_settings.rs index 6fd008740..607918ca1 100644 --- a/generated/stripe_shared/src/account_settings.rs +++ b/generated/stripe_shared/src/account_settings.rs @@ -7,8 +7,6 @@ pub struct AccountSettings { pub card_issuing: Option, pub card_payments: stripe_shared::AccountCardPaymentsSettings, pub dashboard: stripe_shared::AccountDashboardSettings, - #[serde(skip_serializing_if = "Option::is_none")] - pub invoices: Option, pub payments: stripe_shared::AccountPaymentsSettings, #[serde(skip_serializing_if = "Option::is_none")] pub payouts: Option, diff --git a/generated/stripe_shared/src/api_errors.rs b/generated/stripe_shared/src/api_errors.rs index 9cbf161e2..a8ea486f2 100644 --- a/generated/stripe_shared/src/api_errors.rs +++ b/generated/stripe_shared/src/api_errors.rs @@ -86,12 +86,9 @@ pub enum ApiErrorsCode { CouponExpired, CustomerMaxPaymentMethods, CustomerMaxSubscriptions, - CustomerTaxLocationInvalid, DebitNotAuthorized, EmailInvalid, ExpiredCard, - FinancialConnectionsAccountInactive, - FinancialConnectionsNoSuccessfulTransactionRefresh, IdempotencyKeyInUse, IncorrectAddress, IncorrectCvc, @@ -258,14 +255,9 @@ impl ApiErrorsCode { CouponExpired => "coupon_expired", CustomerMaxPaymentMethods => "customer_max_payment_methods", CustomerMaxSubscriptions => "customer_max_subscriptions", - CustomerTaxLocationInvalid => "customer_tax_location_invalid", DebitNotAuthorized => "debit_not_authorized", EmailInvalid => "email_invalid", ExpiredCard => "expired_card", - FinancialConnectionsAccountInactive => "financial_connections_account_inactive", - FinancialConnectionsNoSuccessfulTransactionRefresh => { - "financial_connections_no_successful_transaction_refresh" - } IdempotencyKeyInUse => "idempotency_key_in_use", IncorrectAddress => "incorrect_address", IncorrectCvc => "incorrect_cvc", @@ -453,14 +445,9 @@ impl std::str::FromStr for ApiErrorsCode { "coupon_expired" => Ok(CouponExpired), "customer_max_payment_methods" => Ok(CustomerMaxPaymentMethods), "customer_max_subscriptions" => Ok(CustomerMaxSubscriptions), - "customer_tax_location_invalid" => Ok(CustomerTaxLocationInvalid), "debit_not_authorized" => Ok(DebitNotAuthorized), "email_invalid" => Ok(EmailInvalid), "expired_card" => Ok(ExpiredCard), - "financial_connections_account_inactive" => Ok(FinancialConnectionsAccountInactive), - "financial_connections_no_successful_transaction_refresh" => { - Ok(FinancialConnectionsNoSuccessfulTransactionRefresh) - } "idempotency_key_in_use" => Ok(IdempotencyKeyInUse), "incorrect_address" => Ok(IncorrectAddress), "incorrect_cvc" => Ok(IncorrectCvc), diff --git a/generated/stripe_shared/src/automatic_tax.rs b/generated/stripe_shared/src/automatic_tax.rs index 8afb53aba..4f224b26e 100644 --- a/generated/stripe_shared/src/automatic_tax.rs +++ b/generated/stripe_shared/src/automatic_tax.rs @@ -1,12 +1,8 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct AutomaticTax { /// Whether Stripe automatically computes tax on this invoice. /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, /// The status of the most recent automated tax calculation for this invoice. pub status: Option, } diff --git a/generated/stripe_shared/src/balance_transaction.rs b/generated/stripe_shared/src/balance_transaction.rs index ad8b77726..63f7bc784 100644 --- a/generated/stripe_shared/src/balance_transaction.rs +++ b/generated/stripe_shared/src/balance_transaction.rs @@ -40,13 +40,13 @@ pub struct BalanceTransaction { pub source: Option>, /// The transaction's net funds status in the Stripe balance, which are either `available` or `pending`. pub status: String, - /// 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`. + /// 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`, `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. #[serde(rename = "type")] pub type_: BalanceTransactionType, } -/// 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`. +/// 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`, `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. #[derive(Copy, Clone, Eq, PartialEq)] @@ -59,20 +59,20 @@ pub enum BalanceTransactionType { ApplicationFee, ApplicationFeeRefund, Charge, - ClimateOrderPurchase, - ClimateOrderRefund, ConnectCollectionTransfer, Contribution, IssuingAuthorizationHold, IssuingAuthorizationRelease, IssuingDispute, IssuingTransaction, + ObligationInbound, ObligationOutbound, + ObligationPayout, + ObligationPayoutFailure, ObligationReversalInbound, + ObligationReversalOutbound, Payment, PaymentFailureRefund, - PaymentNetworkReserveHold, - PaymentNetworkReserveRelease, PaymentRefund, PaymentReversal, PaymentUnreconciled, @@ -106,20 +106,20 @@ impl BalanceTransactionType { ApplicationFee => "application_fee", ApplicationFeeRefund => "application_fee_refund", Charge => "charge", - ClimateOrderPurchase => "climate_order_purchase", - ClimateOrderRefund => "climate_order_refund", ConnectCollectionTransfer => "connect_collection_transfer", Contribution => "contribution", IssuingAuthorizationHold => "issuing_authorization_hold", IssuingAuthorizationRelease => "issuing_authorization_release", IssuingDispute => "issuing_dispute", IssuingTransaction => "issuing_transaction", + ObligationInbound => "obligation_inbound", ObligationOutbound => "obligation_outbound", + ObligationPayout => "obligation_payout", + ObligationPayoutFailure => "obligation_payout_failure", ObligationReversalInbound => "obligation_reversal_inbound", + ObligationReversalOutbound => "obligation_reversal_outbound", Payment => "payment", PaymentFailureRefund => "payment_failure_refund", - PaymentNetworkReserveHold => "payment_network_reserve_hold", - PaymentNetworkReserveRelease => "payment_network_reserve_release", PaymentRefund => "payment_refund", PaymentReversal => "payment_reversal", PaymentUnreconciled => "payment_unreconciled", @@ -156,20 +156,20 @@ impl std::str::FromStr for BalanceTransactionType { "application_fee" => Ok(ApplicationFee), "application_fee_refund" => Ok(ApplicationFeeRefund), "charge" => Ok(Charge), - "climate_order_purchase" => Ok(ClimateOrderPurchase), - "climate_order_refund" => Ok(ClimateOrderRefund), "connect_collection_transfer" => Ok(ConnectCollectionTransfer), "contribution" => Ok(Contribution), "issuing_authorization_hold" => Ok(IssuingAuthorizationHold), "issuing_authorization_release" => Ok(IssuingAuthorizationRelease), "issuing_dispute" => Ok(IssuingDispute), "issuing_transaction" => Ok(IssuingTransaction), + "obligation_inbound" => Ok(ObligationInbound), "obligation_outbound" => Ok(ObligationOutbound), + "obligation_payout" => Ok(ObligationPayout), + "obligation_payout_failure" => Ok(ObligationPayoutFailure), "obligation_reversal_inbound" => Ok(ObligationReversalInbound), + "obligation_reversal_outbound" => Ok(ObligationReversalOutbound), "payment" => Ok(Payment), "payment_failure_refund" => Ok(PaymentFailureRefund), - "payment_network_reserve_hold" => Ok(PaymentNetworkReserveHold), - "payment_network_reserve_release" => Ok(PaymentNetworkReserveRelease), "payment_refund" => Ok(PaymentRefund), "payment_reversal" => Ok(PaymentReversal), "payment_unreconciled" => Ok(PaymentUnreconciled), diff --git a/generated/stripe_shared/src/connect_account_reference.rs b/generated/stripe_shared/src/connect_account_reference.rs deleted file mode 100644 index 672d07b2c..000000000 --- a/generated/stripe_shared/src/connect_account_reference.rs +++ /dev/null @@ -1,63 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct ConnectAccountReference { - /// The connected account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, - /// Type of the account referenced. - #[serde(rename = "type")] - pub type_: ConnectAccountReferenceType, -} -/// Type of the account referenced. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConnectAccountReferenceType { - Account, - Self_, -} -impl ConnectAccountReferenceType { - pub fn as_str(self) -> &'static str { - use ConnectAccountReferenceType::*; - match self { - Account => "account", - Self_ => "self", - } - } -} - -impl std::str::FromStr for ConnectAccountReferenceType { - type Err = (); - fn from_str(s: &str) -> Result { - use ConnectAccountReferenceType::*; - match s { - "account" => Ok(Account), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for ConnectAccountReferenceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConnectAccountReferenceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConnectAccountReferenceType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ConnectAccountReferenceType { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for ConnectAccountReferenceType")) - } -} diff --git a/generated/stripe_shared/src/customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance.rs b/generated/stripe_shared/src/customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance.rs deleted file mode 100644 index e18d761cb..000000000 --- a/generated/stripe_shared/src/customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct CustomerBalanceResourceCashBalanceTransactionResourceTransferredToBalance { - /// The [Balance Transaction](https://stripe.com/docs/api/balance_transactions/object) that corresponds to funds transferred to your Stripe balance. - pub balance_transaction: stripe_types::Expandable, -} diff --git a/generated/stripe_shared/src/customer_cash_balance_transaction.rs b/generated/stripe_shared/src/customer_cash_balance_transaction.rs index e65cf7add..cb0865bff 100644 --- a/generated/stripe_shared/src/customer_cash_balance_transaction.rs +++ b/generated/stripe_shared/src/customer_cash_balance_transaction.rs @@ -33,8 +33,6 @@ pub livemode: bool, pub net_amount: i64, #[serde(skip_serializing_if = "Option::is_none")] pub refunded_from_payment: Option, -#[serde(skip_serializing_if = "Option::is_none")] -pub transferred_to_balance: Option, /// The type of the cash balance transaction. /// New types may be added in future. /// See [Customer Balance](https://stripe.com/docs/payments/customer-balance#types) to learn more about these types. diff --git a/generated/stripe_shared/src/destination_details_unimplemented.rs b/generated/stripe_shared/src/destination_details_unimplemented.rs deleted file mode 100644 index 0c49c86d1..000000000 --- a/generated/stripe_shared/src/destination_details_unimplemented.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct DestinationDetailsUnimplemented {} diff --git a/generated/stripe_shared/src/event.rs b/generated/stripe_shared/src/event.rs index 492f51a52..c60cbfbf1 100644 --- a/generated/stripe_shared/src/event.rs +++ b/generated/stripe_shared/src/event.rs @@ -89,13 +89,6 @@ pub enum EventType { CheckoutSessionAsyncPaymentSucceeded, CheckoutSessionCompleted, CheckoutSessionExpired, - ClimateOrderCanceled, - ClimateOrderCreated, - ClimateOrderDelayed, - ClimateOrderDelivered, - ClimateOrderProductSubstituted, - ClimateProductCreated, - ClimateProductPricingUpdated, CouponCreated, CouponDeleted, CouponUpdated, @@ -130,7 +123,6 @@ pub enum EventType { FinancialConnectionsAccountDisconnected, FinancialConnectionsAccountReactivated, FinancialConnectionsAccountRefreshedBalance, - FinancialConnectionsAccountRefreshedTransactions, IdentityVerificationSessionCanceled, IdentityVerificationSessionCreated, IdentityVerificationSessionProcessing, @@ -321,13 +313,6 @@ impl EventType { CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded", CheckoutSessionCompleted => "checkout.session.completed", CheckoutSessionExpired => "checkout.session.expired", - ClimateOrderCanceled => "climate.order.canceled", - ClimateOrderCreated => "climate.order.created", - ClimateOrderDelayed => "climate.order.delayed", - ClimateOrderDelivered => "climate.order.delivered", - ClimateOrderProductSubstituted => "climate.order.product_substituted", - ClimateProductCreated => "climate.product.created", - ClimateProductPricingUpdated => "climate.product.pricing_updated", CouponCreated => "coupon.created", CouponDeleted => "coupon.deleted", CouponUpdated => "coupon.updated", @@ -368,9 +353,6 @@ impl EventType { FinancialConnectionsAccountRefreshedBalance => { "financial_connections.account.refreshed_balance" } - FinancialConnectionsAccountRefreshedTransactions => { - "financial_connections.account.refreshed_transactions" - } IdentityVerificationSessionCanceled => "identity.verification_session.canceled", IdentityVerificationSessionCreated => "identity.verification_session.created", IdentityVerificationSessionProcessing => "identity.verification_session.processing", @@ -574,13 +556,6 @@ impl std::str::FromStr for EventType { "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded), "checkout.session.completed" => Ok(CheckoutSessionCompleted), "checkout.session.expired" => Ok(CheckoutSessionExpired), - "climate.order.canceled" => Ok(ClimateOrderCanceled), - "climate.order.created" => Ok(ClimateOrderCreated), - "climate.order.delayed" => Ok(ClimateOrderDelayed), - "climate.order.delivered" => Ok(ClimateOrderDelivered), - "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted), - "climate.product.created" => Ok(ClimateProductCreated), - "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated), "coupon.created" => Ok(CouponCreated), "coupon.deleted" => Ok(CouponDeleted), "coupon.updated" => Ok(CouponUpdated), @@ -629,9 +604,6 @@ impl std::str::FromStr for EventType { "financial_connections.account.refreshed_balance" => { Ok(FinancialConnectionsAccountRefreshedBalance) } - "financial_connections.account.refreshed_transactions" => { - Ok(FinancialConnectionsAccountRefreshedTransactions) - } "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled), "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated), "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing), diff --git a/generated/stripe_shared/src/file.rs b/generated/stripe_shared/src/file.rs index 316ea89bb..502822d22 100644 --- a/generated/stripe_shared/src/file.rs +++ b/generated/stripe_shared/src/file.rs @@ -1,7 +1,7 @@ /// This object represents files hosted on Stripe's servers. You can upload /// files with the [create file](https://stripe.com/docs/api#create_file) request /// (for example, when uploading dispute evidence). Stripe also -/// creates files independently (for example, the results of a [Sigma scheduled +/// creates files independetly (for example, the results of a [Sigma scheduled /// query](#scheduled_queries)). /// /// Related guide: [File upload guide](https://stripe.com/docs/file-upload) diff --git a/generated/stripe_shared/src/invoice.rs b/generated/stripe_shared/src/invoice.rs index 05578f764..c544b99d8 100644 --- a/generated/stripe_shared/src/invoice.rs +++ b/generated/stripe_shared/src/invoice.rs @@ -172,7 +172,6 @@ pub struct Invoice { /// If the invoice has not been finalized yet, this will be null. #[serde(skip_serializing_if = "Option::is_none")] pub invoice_pdf: Option, - pub issuer: stripe_shared::ConnectAccountReference, /// The error encountered during the previous attempt to finalize the invoice. /// This field is cleared when the invoice is successfully finalized. pub last_finalization_error: Option>, diff --git a/generated/stripe_shared/src/invoice_payment_method_options_card.rs b/generated/stripe_shared/src/invoice_payment_method_options_card.rs index 39c32a89a..1fa5ef9a0 100644 --- a/generated/stripe_shared/src/invoice_payment_method_options_card.rs +++ b/generated/stripe_shared/src/invoice_payment_method_options_card.rs @@ -14,7 +14,6 @@ pub struct InvoicePaymentMethodOptionsCard { pub enum InvoicePaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } impl InvoicePaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { @@ -22,7 +21,6 @@ impl InvoicePaymentMethodOptionsCardRequestThreeDSecure { match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } @@ -34,7 +32,6 @@ impl std::str::FromStr for InvoicePaymentMethodOptionsCardRequestThreeDSecure { match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } diff --git a/generated/stripe_shared/src/invoice_payment_method_options_us_bank_account_linked_account_options.rs b/generated/stripe_shared/src/invoice_payment_method_options_us_bank_account_linked_account_options.rs index 5d6060734..201857a94 100644 --- a/generated/stripe_shared/src/invoice_payment_method_options_us_bank_account_linked_account_options.rs +++ b/generated/stripe_shared/src/invoice_payment_method_options_us_bank_account_linked_account_options.rs @@ -69,14 +69,12 @@ impl<'de> serde::Deserialize<'de> #[derive(Copy, Clone, Eq, PartialEq)] pub enum InvoicePaymentMethodOptionsUsBankAccountLinkedAccountOptionsPrefetch { Balances, - Transactions, } impl InvoicePaymentMethodOptionsUsBankAccountLinkedAccountOptionsPrefetch { pub fn as_str(self) -> &'static str { use InvoicePaymentMethodOptionsUsBankAccountLinkedAccountOptionsPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } @@ -87,7 +85,6 @@ impl std::str::FromStr for InvoicePaymentMethodOptionsUsBankAccountLinkedAccount use InvoicePaymentMethodOptionsUsBankAccountLinkedAccountOptionsPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), _ => Err(()), } } diff --git a/generated/stripe_shared/src/invoice_setting_quote_setting.rs b/generated/stripe_shared/src/invoice_setting_quote_setting.rs index 079a33825..86123d9b1 100644 --- a/generated/stripe_shared/src/invoice_setting_quote_setting.rs +++ b/generated/stripe_shared/src/invoice_setting_quote_setting.rs @@ -1,7 +1,6 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct InvoiceSettingQuoteSetting { /// Number of days within which a customer must pay invoices generated by this quote. /// This value will be `null` for quotes where `collection_method=charge_automatically`. pub days_until_due: Option, - pub issuer: stripe_shared::ConnectAccountReference, } diff --git a/generated/stripe_shared/src/invoice_setting_subscription_schedule_phase_setting.rs b/generated/stripe_shared/src/invoice_setting_subscription_schedule_phase_setting.rs index 9263d736a..b33d06c39 100644 --- a/generated/stripe_shared/src/invoice_setting_subscription_schedule_phase_setting.rs +++ b/generated/stripe_shared/src/invoice_setting_subscription_schedule_phase_setting.rs @@ -1,13 +1,6 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct InvoiceSettingSubscriptionSchedulePhaseSetting { - /// The account tax IDs associated with this phase of the subscription schedule. - /// Will be set on invoices generated by this phase of the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option>>, /// Number of days within which a customer must pay invoices generated by this subscription schedule. /// This value will be `null` for subscription schedules where `billing=charge_automatically`. pub days_until_due: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - pub issuer: Option, } diff --git a/generated/stripe_shared/src/invoice_setting_subscription_schedule_setting.rs b/generated/stripe_shared/src/invoice_setting_subscription_schedule_setting.rs index 1d85917fd..60b97ac43 100644 --- a/generated/stripe_shared/src/invoice_setting_subscription_schedule_setting.rs +++ b/generated/stripe_shared/src/invoice_setting_subscription_schedule_setting.rs @@ -1,11 +1,6 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct InvoiceSettingSubscriptionScheduleSetting { - /// The account tax IDs associated with the subscription schedule. - /// Will be set on invoices generated by the subscription schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_tax_ids: Option>>, /// Number of days within which a customer must pay invoices generated by this subscription schedule. /// This value will be `null` for subscription schedules where `billing=charge_automatically`. pub days_until_due: Option, - pub issuer: stripe_shared::ConnectAccountReference, } diff --git a/generated/stripe_shared/src/invoices_payment_settings.rs b/generated/stripe_shared/src/invoices_payment_settings.rs index e0137a6da..848654db7 100644 --- a/generated/stripe_shared/src/invoices_payment_settings.rs +++ b/generated/stripe_shared/src/invoices_payment_settings.rs @@ -26,14 +26,12 @@ pub enum InvoicesPaymentSettingsPaymentMethodTypes { Card, Cashapp, CustomerBalance, - Eps, Fpx, Giropay, Grabpay, Ideal, Konbini, Link, - P24, Paynow, Paypal, Promptpay, @@ -59,14 +57,12 @@ impl InvoicesPaymentSettingsPaymentMethodTypes { Card => "card", Cashapp => "cashapp", CustomerBalance => "customer_balance", - Eps => "eps", Fpx => "fpx", Giropay => "giropay", Grabpay => "grabpay", Ideal => "ideal", Konbini => "konbini", Link => "link", - P24 => "p24", Paynow => "paynow", Paypal => "paypal", Promptpay => "promptpay", @@ -95,14 +91,12 @@ impl std::str::FromStr for InvoicesPaymentSettingsPaymentMethodTypes { "card" => Ok(Card), "cashapp" => Ok(Cashapp), "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), "fpx" => Ok(Fpx), "giropay" => Ok(Giropay), "grabpay" => Ok(Grabpay), "ideal" => Ok(Ideal), "konbini" => Ok(Konbini), "link" => Ok(Link), - "p24" => Ok(P24), "paynow" => Ok(Paynow), "paypal" => Ok(Paypal), "promptpay" => Ok(Promptpay), diff --git a/generated/stripe_shared/src/issuing_authorization_authentication_exemption.rs b/generated/stripe_shared/src/issuing_authorization_authentication_exemption.rs index b359c3008..54afa46aa 100644 --- a/generated/stripe_shared/src/issuing_authorization_authentication_exemption.rs +++ b/generated/stripe_shared/src/issuing_authorization_authentication_exemption.rs @@ -68,7 +68,6 @@ impl<'de> serde::Deserialize<'de> for IssuingAuthorizationAuthenticationExemptio pub enum IssuingAuthorizationAuthenticationExemptionType { LowValueTransaction, TransactionRiskAnalysis, - Unknown, } impl IssuingAuthorizationAuthenticationExemptionType { pub fn as_str(self) -> &'static str { @@ -76,7 +75,6 @@ impl IssuingAuthorizationAuthenticationExemptionType { match self { LowValueTransaction => "low_value_transaction", TransactionRiskAnalysis => "transaction_risk_analysis", - Unknown => "unknown", } } } @@ -88,7 +86,6 @@ impl std::str::FromStr for IssuingAuthorizationAuthenticationExemptionType { match s { "low_value_transaction" => Ok(LowValueTransaction), "transaction_risk_analysis" => Ok(TransactionRiskAnalysis), - "unknown" => Ok(Unknown), _ => Err(()), } } diff --git a/generated/stripe_shared/src/issuing_cardholder_card_issuing.rs b/generated/stripe_shared/src/issuing_cardholder_card_issuing.rs index bd905a1c8..ffea23dca 100644 --- a/generated/stripe_shared/src/issuing_cardholder_card_issuing.rs +++ b/generated/stripe_shared/src/issuing_cardholder_card_issuing.rs @@ -1,6 +1,5 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct IssuingCardholderCardIssuing { - /// Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). - /// Required for cards backed by a Celtic program. + /// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). pub user_terms_acceptance: Option, } diff --git a/generated/stripe_shared/src/issuing_cardholder_user_terms_acceptance.rs b/generated/stripe_shared/src/issuing_cardholder_user_terms_acceptance.rs index b86c849fe..7bcad9ecd 100644 --- a/generated/stripe_shared/src/issuing_cardholder_user_terms_acceptance.rs +++ b/generated/stripe_shared/src/issuing_cardholder_user_terms_acceptance.rs @@ -1,8 +1,10 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct IssuingCardholderUserTermsAcceptance { /// The Unix timestamp marking when the cardholder accepted the Authorized User Terms. + /// Required for Celtic Spend Card users. pub date: Option, /// The IP address from which the cardholder accepted the Authorized User Terms. + /// Required for Celtic Spend Card users. pub ip: Option, /// The user agent of the browser from which the cardholder accepted the Authorized User Terms. pub user_agent: Option, diff --git a/generated/stripe_shared/src/legal_entity_company.rs b/generated/stripe_shared/src/legal_entity_company.rs index 34f2221c1..5790e7253 100644 --- a/generated/stripe_shared/src/legal_entity_company.rs +++ b/generated/stripe_shared/src/legal_entity_company.rs @@ -79,7 +79,6 @@ pub enum LegalEntityCompanyStructure { PublicCompany, PublicCorporation, PublicPartnership, - RegisteredCharity, SingleMemberLlc, SoleEstablishment, SoleProprietorship, @@ -109,7 +108,6 @@ impl LegalEntityCompanyStructure { PublicCompany => "public_company", PublicCorporation => "public_corporation", PublicPartnership => "public_partnership", - RegisteredCharity => "registered_charity", SingleMemberLlc => "single_member_llc", SoleEstablishment => "sole_establishment", SoleProprietorship => "sole_proprietorship", @@ -142,7 +140,6 @@ impl std::str::FromStr for LegalEntityCompanyStructure { "public_company" => Ok(PublicCompany), "public_corporation" => Ok(PublicCorporation), "public_partnership" => Ok(PublicPartnership), - "registered_charity" => Ok(RegisteredCharity), "single_member_llc" => Ok(SingleMemberLlc), "sole_establishment" => Ok(SoleEstablishment), "sole_proprietorship" => Ok(SoleProprietorship), diff --git a/generated/stripe_shared/src/linked_account_options_us_bank_account.rs b/generated/stripe_shared/src/linked_account_options_us_bank_account.rs index e768eec63..a1dd03857 100644 --- a/generated/stripe_shared/src/linked_account_options_us_bank_account.rs +++ b/generated/stripe_shared/src/linked_account_options_us_bank_account.rs @@ -77,14 +77,12 @@ impl<'de> serde::Deserialize<'de> for LinkedAccountOptionsUsBankAccountPermissio #[derive(Copy, Clone, Eq, PartialEq)] pub enum LinkedAccountOptionsUsBankAccountPrefetch { Balances, - Transactions, } impl LinkedAccountOptionsUsBankAccountPrefetch { pub fn as_str(self) -> &'static str { use LinkedAccountOptionsUsBankAccountPrefetch::*; match self { Balances => "balances", - Transactions => "transactions", } } } @@ -95,7 +93,6 @@ impl std::str::FromStr for LinkedAccountOptionsUsBankAccountPrefetch { use LinkedAccountOptionsUsBankAccountPrefetch::*; match s { "balances" => Ok(Balances), - "transactions" => Ok(Transactions), _ => Err(()), } } diff --git a/generated/stripe_shared/src/mandate_bacs_debit.rs b/generated/stripe_shared/src/mandate_bacs_debit.rs index b1fda1130..ff1d1d3e3 100644 --- a/generated/stripe_shared/src/mandate_bacs_debit.rs +++ b/generated/stripe_shared/src/mandate_bacs_debit.rs @@ -5,8 +5,6 @@ pub struct MandateBacsDebit { pub network_status: MandateBacsDebitNetworkStatus, /// The unique reference identifying the mandate on the Bacs network. pub reference: String, - /// When the mandate is revoked on the Bacs network this field displays the reason for the revocation. - pub revocation_reason: Option, /// The URL that will contain the mandate that the customer has signed. pub url: String, } @@ -72,67 +70,3 @@ impl<'de> serde::Deserialize<'de> for MandateBacsDebitNetworkStatus { }) } } -/// When the mandate is revoked on the Bacs network this field displays the reason for the revocation. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum MandateBacsDebitRevocationReason { - AccountClosed, - BankAccountRestricted, - BankOwnershipChanged, - CouldNotProcess, - DebitNotAuthorized, -} -impl MandateBacsDebitRevocationReason { - pub fn as_str(self) -> &'static str { - use MandateBacsDebitRevocationReason::*; - match self { - AccountClosed => "account_closed", - BankAccountRestricted => "bank_account_restricted", - BankOwnershipChanged => "bank_ownership_changed", - CouldNotProcess => "could_not_process", - DebitNotAuthorized => "debit_not_authorized", - } - } -} - -impl std::str::FromStr for MandateBacsDebitRevocationReason { - type Err = (); - fn from_str(s: &str) -> Result { - use MandateBacsDebitRevocationReason::*; - match s { - "account_closed" => Ok(AccountClosed), - "bank_account_restricted" => Ok(BankAccountRestricted), - "bank_ownership_changed" => Ok(BankOwnershipChanged), - "could_not_process" => Ok(CouldNotProcess), - "debit_not_authorized" => Ok(DebitNotAuthorized), - _ => Err(()), - } - } -} -impl std::fmt::Display for MandateBacsDebitRevocationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for MandateBacsDebitRevocationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for MandateBacsDebitRevocationReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for MandateBacsDebitRevocationReason { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for MandateBacsDebitRevocationReason") - }) - } -} diff --git a/generated/stripe_shared/src/mandate_us_bank_account.rs b/generated/stripe_shared/src/mandate_us_bank_account.rs index 7616c7013..97864d49b 100644 --- a/generated/stripe_shared/src/mandate_us_bank_account.rs +++ b/generated/stripe_shared/src/mandate_us_bank_account.rs @@ -1,58 +1,2 @@ #[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct MandateUsBankAccount { - /// Mandate collection method - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, -} -/// Mandate collection method -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum MandateUsBankAccountCollectionMethod { - Paper, -} -impl MandateUsBankAccountCollectionMethod { - pub fn as_str(self) -> &'static str { - use MandateUsBankAccountCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr for MandateUsBankAccountCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use MandateUsBankAccountCollectionMethod::*; - match s { - "paper" => Ok(Paper), - _ => Err(()), - } - } -} -impl std::fmt::Display for MandateUsBankAccountCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for MandateUsBankAccountCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for MandateUsBankAccountCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for MandateUsBankAccountCollectionMethod { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for MandateUsBankAccountCollectionMethod") - }) - } -} +pub struct MandateUsBankAccount {} diff --git a/generated/stripe_shared/src/mod.rs b/generated/stripe_shared/src/mod.rs index 5f938b9c6..fddb9eb7f 100644 --- a/generated/stripe_shared/src/mod.rs +++ b/generated/stripe_shared/src/mod.rs @@ -13,10 +13,6 @@ pub mod account; #[doc(inline)] pub use account::*; #[doc(hidden)] -pub mod account_annual_revenue; -#[doc(inline)] -pub use account_annual_revenue::*; -#[doc(hidden)] pub mod account_bacs_debit_payments_settings; #[doc(inline)] pub use account_bacs_debit_payments_settings::*; @@ -61,10 +57,6 @@ pub mod account_future_requirements; #[doc(inline)] pub use account_future_requirements::*; #[doc(hidden)] -pub mod account_invoices_settings; -#[doc(inline)] -pub use account_invoices_settings::*; -#[doc(hidden)] pub mod account_monthly_estimated_revenue; #[doc(inline)] pub use account_monthly_estimated_revenue::*; @@ -189,10 +181,6 @@ pub mod charge_transfer_data; #[doc(inline)] pub use charge_transfer_data::*; #[doc(hidden)] -pub mod connect_account_reference; -#[doc(inline)] -pub use connect_account_reference::*; -#[doc(hidden)] pub mod connect_collection_transfer; #[doc(inline)] pub use connect_collection_transfer::*; @@ -277,10 +265,6 @@ pub mod customer_balance_resource_cash_balance_transaction_resource_refunded_fro #[doc(inline)] pub use customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction::*; #[doc(hidden)] -pub mod customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance; -#[doc(inline)] -pub use customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance::*; -#[doc(hidden)] pub mod customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction; #[doc(inline)] pub use customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction::*; @@ -365,10 +349,6 @@ pub mod deleted_test_helpers_test_clock; #[doc(inline)] pub use deleted_test_helpers_test_clock::*; #[doc(hidden)] -pub mod destination_details_unimplemented; -#[doc(inline)] -pub use destination_details_unimplemented::*; -#[doc(hidden)] pub mod discount; #[doc(inline)] pub use discount::*; @@ -1093,14 +1073,6 @@ pub mod payment_intent_next_action_redirect_to_url; #[doc(inline)] pub use payment_intent_next_action_redirect_to_url::*; #[doc(hidden)] -pub mod payment_intent_next_action_swish_handle_redirect_or_display_qr_code; -#[doc(inline)] -pub use payment_intent_next_action_swish_handle_redirect_or_display_qr_code::*; -#[doc(hidden)] -pub mod payment_intent_next_action_swish_qr_code; -#[doc(inline)] -pub use payment_intent_next_action_swish_qr_code::*; -#[doc(hidden)] pub mod payment_intent_next_action_verify_with_microdeposits; #[doc(inline)] pub use payment_intent_next_action_verify_with_microdeposits::*; @@ -1157,10 +1129,6 @@ pub mod payment_intent_payment_method_options_sepa_debit; #[doc(inline)] pub use payment_intent_payment_method_options_sepa_debit::*; #[doc(hidden)] -pub mod payment_intent_payment_method_options_swish; -#[doc(inline)] -pub use payment_intent_payment_method_options_swish::*; -#[doc(hidden)] pub mod payment_intent_payment_method_options_us_bank_account; #[doc(inline)] pub use payment_intent_payment_method_options_us_bank_account::*; @@ -1185,10 +1153,6 @@ pub mod payment_links_resource_automatic_tax; #[doc(inline)] pub use payment_links_resource_automatic_tax::*; #[doc(hidden)] -pub mod payment_links_resource_completed_sessions; -#[doc(inline)] -pub use payment_links_resource_completed_sessions::*; -#[doc(hidden)] pub mod payment_links_resource_completion_behavior_confirmation_page; #[doc(inline)] pub use payment_links_resource_completion_behavior_confirmation_page::*; @@ -1245,18 +1209,10 @@ pub mod payment_links_resource_payment_intent_data; #[doc(inline)] pub use payment_links_resource_payment_intent_data::*; #[doc(hidden)] -pub mod payment_links_resource_payment_method_reuse_agreement; -#[doc(inline)] -pub use payment_links_resource_payment_method_reuse_agreement::*; -#[doc(hidden)] pub mod payment_links_resource_phone_number_collection; #[doc(inline)] pub use payment_links_resource_phone_number_collection::*; #[doc(hidden)] -pub mod payment_links_resource_restrictions; -#[doc(inline)] -pub use payment_links_resource_restrictions::*; -#[doc(hidden)] pub mod payment_links_resource_shipping_address_collection; #[doc(inline)] pub use payment_links_resource_shipping_address_collection::*; @@ -1269,10 +1225,6 @@ pub mod payment_links_resource_subscription_data; #[doc(inline)] pub use payment_links_resource_subscription_data::*; #[doc(hidden)] -pub mod payment_links_resource_subscription_data_invoice_settings; -#[doc(inline)] -pub use payment_links_resource_subscription_data_invoice_settings::*; -#[doc(hidden)] pub mod payment_links_resource_tax_id_collection; #[doc(inline)] pub use payment_links_resource_tax_id_collection::*; @@ -1585,10 +1537,6 @@ pub mod payment_method_details_stripe_account; #[doc(inline)] pub use payment_method_details_stripe_account::*; #[doc(hidden)] -pub mod payment_method_details_swish; -#[doc(inline)] -pub use payment_method_details_swish::*; -#[doc(hidden)] pub mod payment_method_details_us_bank_account; #[doc(inline)] pub use payment_method_details_us_bank_account::*; @@ -1753,10 +1701,6 @@ pub mod payment_method_options_sofort; #[doc(inline)] pub use payment_method_options_sofort::*; #[doc(hidden)] -pub mod payment_method_options_us_bank_account_mandate_options; -#[doc(inline)] -pub use payment_method_options_us_bank_account_mandate_options::*; -#[doc(hidden)] pub mod payment_method_options_wechat_pay; #[doc(inline)] pub use payment_method_options_wechat_pay::*; @@ -1801,10 +1745,6 @@ pub mod payment_method_sofort; #[doc(inline)] pub use payment_method_sofort::*; #[doc(hidden)] -pub mod payment_method_swish; -#[doc(inline)] -pub use payment_method_swish::*; -#[doc(hidden)] pub mod payment_method_us_bank_account; #[doc(inline)] pub use payment_method_us_bank_account::*; @@ -1969,18 +1909,6 @@ pub mod refund; #[doc(inline)] pub use refund::*; #[doc(hidden)] -pub mod refund_destination_details; -#[doc(inline)] -pub use refund_destination_details::*; -#[doc(hidden)] -pub mod refund_destination_details_card; -#[doc(inline)] -pub use refund_destination_details_card::*; -#[doc(hidden)] -pub mod refund_destination_details_generic; -#[doc(inline)] -pub use refund_destination_details_generic::*; -#[doc(hidden)] pub mod refund_next_action; #[doc(inline)] pub use refund_next_action::*; @@ -2357,10 +2285,6 @@ pub mod subscription_transfer_data; #[doc(inline)] pub use subscription_transfer_data::*; #[doc(hidden)] -pub mod subscriptions_resource_billing_cycle_anchor_config; -#[doc(inline)] -pub use subscriptions_resource_billing_cycle_anchor_config::*; -#[doc(hidden)] pub mod subscriptions_resource_pause_collection; #[doc(inline)] pub use subscriptions_resource_pause_collection::*; @@ -2393,10 +2317,6 @@ pub mod tax_deducted_at_source; #[doc(inline)] pub use tax_deducted_at_source::*; #[doc(hidden)] -pub mod tax_i_ds_owner; -#[doc(inline)] -pub use tax_i_ds_owner::*; -#[doc(hidden)] pub mod tax_id; #[doc(inline)] pub use tax_id::*; diff --git a/generated/stripe_shared/src/networks.rs b/generated/stripe_shared/src/networks.rs index 2e272069d..abd668913 100644 --- a/generated/stripe_shared/src/networks.rs +++ b/generated/stripe_shared/src/networks.rs @@ -2,7 +2,6 @@ pub struct Networks { /// All available networks for the card. pub available: Vec, - /// The preferred network for co-branded cards. - /// Can be `cartes_bancaires`, `mastercard`, `visa` or `invalid_preference` if requested network is not valid for the card. + /// The preferred network for the card. pub preferred: Option, } diff --git a/generated/stripe_shared/src/payment_intent.rs b/generated/stripe_shared/src/payment_intent.rs index b89f4ae14..9362ab971 100644 --- a/generated/stripe_shared/src/payment_intent.rs +++ b/generated/stripe_shared/src/payment_intent.rs @@ -48,7 +48,6 @@ pub struct PaymentIntent { /// /// Refer to our docs to [accept a payment](https://stripe.com/docs/payments/accept-a-payment?ui=elements) and learn about how `client_secret` should be handled. pub client_secret: Option, - /// Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment. pub confirmation_method: stripe_shared::PaymentIntentConfirmationMethod, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, @@ -111,9 +110,8 @@ pub struct PaymentIntent { /// This is a legacy field that will be removed in the future. /// It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. pub source: Option>, - /// For card charges, use [statement_descriptor_suffix](https://stripe.com/docs/payments/account/statement-descriptors#dynamic). - /// Otherwise, you can use this value as the complete description of a charge on your customers' statements. - /// It must contain at least one letter and be 1–22 characters long. + /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. + /// Must contain at least one letter, maximum 22 characters. pub statement_descriptor: Option, /// Provides information about a card payment that customers see on their statements. /// Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. diff --git a/generated/stripe_shared/src/payment_intent_next_action.rs b/generated/stripe_shared/src/payment_intent_next_action.rs index d9c5c4112..cc0871a18 100644 --- a/generated/stripe_shared/src/payment_intent_next_action.rs +++ b/generated/stripe_shared/src/payment_intent_next_action.rs @@ -26,9 +26,6 @@ pub struct PaymentIntentNextAction { Option, #[serde(skip_serializing_if = "Option::is_none")] pub redirect_to_url: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub swish_handle_redirect_or_display_qr_code: - Option, /// Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. #[serde(rename = "type")] pub type_: String, diff --git a/generated/stripe_shared/src/payment_intent_next_action_swish_handle_redirect_or_display_qr_code.rs b/generated/stripe_shared/src/payment_intent_next_action_swish_handle_redirect_or_display_qr_code.rs deleted file mode 100644 index 0a4692b1a..000000000 --- a/generated/stripe_shared/src/payment_intent_next_action_swish_handle_redirect_or_display_qr_code.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentIntentNextActionSwishHandleRedirectOrDisplayQrCode { - /// The URL to the hosted Swish instructions page, which allows customers to view the QR code. - #[serde(skip_serializing_if = "Option::is_none")] - pub hosted_instructions_url: Option, - /// The url for mobile redirect based auth - #[serde(skip_serializing_if = "Option::is_none")] - pub mobile_auth_url: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub qr_code: Option, -} diff --git a/generated/stripe_shared/src/payment_intent_next_action_swish_qr_code.rs b/generated/stripe_shared/src/payment_intent_next_action_swish_qr_code.rs deleted file mode 100644 index 410c69da5..000000000 --- a/generated/stripe_shared/src/payment_intent_next_action_swish_qr_code.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentIntentNextActionSwishQrCode { - /// The raw data string used to generate QR code, it should be used together with QR code library. - #[serde(skip_serializing_if = "Option::is_none")] - pub data: Option, - /// The image_url_png string used to render QR code - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url_png: Option, - /// The image_url_svg string used to render QR code - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url_svg: Option, -} diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options.rs b/generated/stripe_shared/src/payment_intent_payment_method_options.rs index 0cf03635b..ac66d4008 100644 --- a/generated/stripe_shared/src/payment_intent_payment_method_options.rs +++ b/generated/stripe_shared/src/payment_intent_payment_method_options.rs @@ -63,8 +63,6 @@ pub struct PaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: Option, #[serde(skip_serializing_if = "Option::is_none")] pub wechat_pay: Option, diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options_blik.rs b/generated/stripe_shared/src/payment_intent_payment_method_options_blik.rs index 2e09c304f..13284bb18 100644 --- a/generated/stripe_shared/src/payment_intent_payment_method_options_blik.rs +++ b/generated/stripe_shared/src/payment_intent_payment_method_options_blik.rs @@ -1,70 +1,2 @@ #[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentIntentPaymentMethodOptionsBlik { - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - None, -} -impl PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for PaymentIntentPaymentMethodOptionsBlikSetupFutureUsage", - ) - }) - } -} +pub struct PaymentIntentPaymentMethodOptionsBlik {} diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options_card.rs b/generated/stripe_shared/src/payment_intent_payment_method_options_card.rs index 983e53363..80d7df686 100644 --- a/generated/stripe_shared/src/payment_intent_payment_method_options_card.rs +++ b/generated/stripe_shared/src/payment_intent_payment_method_options_card.rs @@ -17,7 +17,7 @@ pub struct PaymentIntentPaymentMethodOptionsCard { #[serde(skip_serializing_if = "Option::is_none")] pub request_extended_authorization: Option, - /// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. + /// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub request_incremental_authorization: Option, @@ -29,13 +29,10 @@ pub struct PaymentIntentPaymentMethodOptionsCard { pub request_overcapture: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. pub request_three_d_secure: Option, - /// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e. - /// using the cvc_token parameter). - #[serde(skip_serializing_if = "Option::is_none")] - pub require_cvc_recollection: Option, /// Indicates that you intend to make future payments with this PaymentIntent's payment method. /// /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. @@ -252,7 +249,7 @@ impl<'de> serde::Deserialize<'de> Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization")) } } -/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. +/// Request ability to [increment](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization { IfAvailable, @@ -423,13 +420,14 @@ impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardReque } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, + ChallengeOnly, } impl PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { @@ -437,7 +435,7 @@ impl PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure { match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", + ChallengeOnly => "challenge_only", } } } @@ -449,7 +447,7 @@ impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestThreeDSec match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), + "challenge_only" => Ok(ChallengeOnly), _ => Err(()), } } diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options_swish.rs b/generated/stripe_shared/src/payment_intent_payment_method_options_swish.rs deleted file mode 100644 index f535e0d86..000000000 --- a/generated/stripe_shared/src/payment_intent_payment_method_options_swish.rs +++ /dev/null @@ -1,73 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentIntentPaymentMethodOptionsSwish { - /// The order ID displayed in the Swish app after the payment is authorized. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, -} -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - None, -} -impl PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match self { - None => "none", - } - } -} - -impl std::str::FromStr for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*; - match s { - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for PaymentIntentPaymentMethodOptionsSwishSetupFutureUsage", - ) - }) - } -} diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options_us_bank_account.rs b/generated/stripe_shared/src/payment_intent_payment_method_options_us_bank_account.rs index 46e4a054b..3e09d315c 100644 --- a/generated/stripe_shared/src/payment_intent_payment_method_options_us_bank_account.rs +++ b/generated/stripe_shared/src/payment_intent_payment_method_options_us_bank_account.rs @@ -2,8 +2,6 @@ pub struct PaymentIntentPaymentMethodOptionsUsBankAccount { #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, /// Preferred transaction settlement speed #[serde(skip_serializing_if = "Option::is_none")] pub preferred_settlement_speed: diff --git a/generated/stripe_shared/src/payment_link.rs b/generated/stripe_shared/src/payment_link.rs index 2b1b5a6dc..1058c4505 100644 --- a/generated/stripe_shared/src/payment_link.rs +++ b/generated/stripe_shared/src/payment_link.rs @@ -30,15 +30,13 @@ pub struct PaymentLink { /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// Collect additional information from your customer using custom fields. - /// Up to 3 fields are supported. + /// Up to 2 fields are supported. pub custom_fields: Vec, pub custom_text: stripe_shared::PaymentLinksResourceCustomText, /// Configuration for Customer creation during checkout. pub customer_creation: PaymentLinkCustomerCreation, /// Unique identifier for the object. pub id: stripe_shared::PaymentLinkId, - /// The custom message to be displayed to a customer when a payment link is no longer active. - pub inactive_message: Option, /// Configuration for creating invoice for payment mode payment links. pub invoice_creation: Option, /// The line items representing what is being sold. @@ -60,8 +58,6 @@ pub struct PaymentLink { /// When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). pub payment_method_types: Option>, pub phone_number_collection: stripe_shared::PaymentLinksResourcePhoneNumberCollection, - /// Settings that restrict the usage of a payment link. - pub restrictions: Option, /// Configuration for collecting the customer's shipping address. pub shipping_address_collection: Option, @@ -277,7 +273,6 @@ pub enum PaymentLinkPaymentMethodTypes { Promptpay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, /// An unrecognized value from Stripe. Should not be used as a request parameter. @@ -313,7 +308,6 @@ impl PaymentLinkPaymentMethodTypes { Promptpay => "promptpay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Unknown => "unknown", @@ -352,7 +346,6 @@ impl std::str::FromStr for PaymentLinkPaymentMethodTypes { "promptpay" => Ok(Promptpay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), _ => Err(()), diff --git a/generated/stripe_shared/src/payment_links_resource_automatic_tax.rs b/generated/stripe_shared/src/payment_links_resource_automatic_tax.rs index 9996bae28..9d7545cea 100644 --- a/generated/stripe_shared/src/payment_links_resource_automatic_tax.rs +++ b/generated/stripe_shared/src/payment_links_resource_automatic_tax.rs @@ -1,9 +1,5 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct PaymentLinksResourceAutomaticTax { /// If `true`, tax will be calculated automatically using the customer's location. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, } diff --git a/generated/stripe_shared/src/payment_links_resource_completed_sessions.rs b/generated/stripe_shared/src/payment_links_resource_completed_sessions.rs deleted file mode 100644 index 5459c9fd9..000000000 --- a/generated/stripe_shared/src/payment_links_resource_completed_sessions.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct PaymentLinksResourceCompletedSessions { - /// The current number of checkout sessions that have been completed on the payment link which count towards the `completed_sessions` restriction to be met. - pub count: u64, - /// The maximum number of checkout sessions that can be completed for the `completed_sessions` restriction to be met. - pub limit: i64, -} diff --git a/generated/stripe_shared/src/payment_links_resource_consent_collection.rs b/generated/stripe_shared/src/payment_links_resource_consent_collection.rs index 7096a9f9f..e881f9942 100644 --- a/generated/stripe_shared/src/payment_links_resource_consent_collection.rs +++ b/generated/stripe_shared/src/payment_links_resource_consent_collection.rs @@ -1,8 +1,5 @@ #[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentLinksResourceConsentCollection { - /// Settings related to the payment method reuse text shown in the Checkout UI. - pub payment_method_reuse_agreement: - Option, /// If set to `auto`, enables the collection of customer consent for promotional communications. pub promotions: Option, /// If set to `required`, it requires cutomers to accept the terms of service before being able to pay. diff --git a/generated/stripe_shared/src/payment_links_resource_custom_text.rs b/generated/stripe_shared/src/payment_links_resource_custom_text.rs index e92effe8a..39640bd69 100644 --- a/generated/stripe_shared/src/payment_links_resource_custom_text.rs +++ b/generated/stripe_shared/src/payment_links_resource_custom_text.rs @@ -1,7 +1,5 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentLinksResourceCustomText { - /// Custom text that should be displayed after the payment confirmation button. - pub after_submit: Option, /// Custom text that should be displayed alongside shipping address collection. pub shipping_address: Option, /// Custom text that should be displayed alongside the payment confirmation button. diff --git a/generated/stripe_shared/src/payment_links_resource_invoice_settings.rs b/generated/stripe_shared/src/payment_links_resource_invoice_settings.rs index 23eb97d2d..b8a2170fd 100644 --- a/generated/stripe_shared/src/payment_links_resource_invoice_settings.rs +++ b/generated/stripe_shared/src/payment_links_resource_invoice_settings.rs @@ -8,9 +8,6 @@ pub struct PaymentLinksResourceInvoiceSettings { pub description: Option, /// Footer to be displayed on the invoice. pub footer: Option, - /// The connected account that issues the invoice. - /// The invoice is presented with the branding and support information of the specified account. - pub issuer: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. pub metadata: Option>, diff --git a/generated/stripe_shared/src/payment_links_resource_payment_intent_data.rs b/generated/stripe_shared/src/payment_links_resource_payment_intent_data.rs index c7b9602bc..35484671d 100644 --- a/generated/stripe_shared/src/payment_links_resource_payment_intent_data.rs +++ b/generated/stripe_shared/src/payment_links_resource_payment_intent_data.rs @@ -15,9 +15,6 @@ pub struct PaymentLinksResourcePaymentIntentData { /// Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. /// Maximum 22 characters for the concatenated descriptor. pub statement_descriptor_suffix: Option, - /// A string that identifies the resulting payment as part of a group. - /// See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. - pub transfer_group: Option, } /// Indicates when the funds will be captured from the customer's account. #[derive(Copy, Clone, Eq, PartialEq)] diff --git a/generated/stripe_shared/src/payment_links_resource_payment_method_reuse_agreement.rs b/generated/stripe_shared/src/payment_links_resource_payment_method_reuse_agreement.rs deleted file mode 100644 index dff5dd838..000000000 --- a/generated/stripe_shared/src/payment_links_resource_payment_method_reuse_agreement.rs +++ /dev/null @@ -1,68 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct PaymentLinksResourcePaymentMethodReuseAgreement { - /// Determines the position and visibility of the payment method reuse agreement in the UI. - /// When set to `auto`, Stripe's defaults will be used. - /// - /// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. - pub position: PaymentLinksResourcePaymentMethodReuseAgreementPosition, -} -/// Determines the position and visibility of the payment method reuse agreement in the UI. -/// When set to `auto`, Stripe's defaults will be used. -/// -/// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentLinksResourcePaymentMethodReuseAgreementPosition { - Auto, - Hidden, -} -impl PaymentLinksResourcePaymentMethodReuseAgreementPosition { - pub fn as_str(self) -> &'static str { - use PaymentLinksResourcePaymentMethodReuseAgreementPosition::*; - match self { - Auto => "auto", - Hidden => "hidden", - } - } -} - -impl std::str::FromStr for PaymentLinksResourcePaymentMethodReuseAgreementPosition { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentLinksResourcePaymentMethodReuseAgreementPosition::*; - match s { - "auto" => Ok(Auto), - "hidden" => Ok(Hidden), - _ => Err(()), - } - } -} -impl std::fmt::Display for PaymentLinksResourcePaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentLinksResourcePaymentMethodReuseAgreementPosition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentLinksResourcePaymentMethodReuseAgreementPosition { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for PaymentLinksResourcePaymentMethodReuseAgreementPosition { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for PaymentLinksResourcePaymentMethodReuseAgreementPosition", - ) - }) - } -} diff --git a/generated/stripe_shared/src/payment_links_resource_restrictions.rs b/generated/stripe_shared/src/payment_links_resource_restrictions.rs deleted file mode 100644 index 697c4612a..000000000 --- a/generated/stripe_shared/src/payment_links_resource_restrictions.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct PaymentLinksResourceRestrictions { - pub completed_sessions: stripe_shared::PaymentLinksResourceCompletedSessions, -} diff --git a/generated/stripe_shared/src/payment_links_resource_subscription_data.rs b/generated/stripe_shared/src/payment_links_resource_subscription_data.rs index a176b9ff8..a68c69690 100644 --- a/generated/stripe_shared/src/payment_links_resource_subscription_data.rs +++ b/generated/stripe_shared/src/payment_links_resource_subscription_data.rs @@ -3,11 +3,8 @@ pub struct PaymentLinksResourceSubscriptionData { /// The subscription's description, meant to be displayable to the customer. /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. pub description: Option, - pub invoice_settings: stripe_shared::PaymentLinksResourceSubscriptionDataInvoiceSettings, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link. pub metadata: std::collections::HashMap, /// Integer representing the number of trial period days before the customer is charged for the first time. pub trial_period_days: Option, - /// Settings related to subscription trials. - pub trial_settings: Option, } diff --git a/generated/stripe_shared/src/payment_links_resource_subscription_data_invoice_settings.rs b/generated/stripe_shared/src/payment_links_resource_subscription_data_invoice_settings.rs deleted file mode 100644 index 67c6c7750..000000000 --- a/generated/stripe_shared/src/payment_links_resource_subscription_data_invoice_settings.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct PaymentLinksResourceSubscriptionDataInvoiceSettings { - pub issuer: stripe_shared::ConnectAccountReference, -} diff --git a/generated/stripe_shared/src/payment_method.rs b/generated/stripe_shared/src/payment_method.rs index aa8017d45..be91cd46e 100644 --- a/generated/stripe_shared/src/payment_method.rs +++ b/generated/stripe_shared/src/payment_method.rs @@ -84,8 +84,6 @@ pub struct PaymentMethod { pub sepa_debit: Option, #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option, /// The type of the PaymentMethod. /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. @@ -135,7 +133,6 @@ pub enum PaymentMethodType { RevolutPay, SepaDebit, Sofort, - Swish, UsBankAccount, WechatPay, Zip, @@ -177,7 +174,6 @@ impl PaymentMethodType { RevolutPay => "revolut_pay", SepaDebit => "sepa_debit", Sofort => "sofort", - Swish => "swish", UsBankAccount => "us_bank_account", WechatPay => "wechat_pay", Zip => "zip", @@ -222,7 +218,6 @@ impl std::str::FromStr for PaymentMethodType { "revolut_pay" => Ok(RevolutPay), "sepa_debit" => Ok(SepaDebit), "sofort" => Ok(Sofort), - "swish" => Ok(Swish), "us_bank_account" => Ok(UsBankAccount), "wechat_pay" => Ok(WechatPay), "zip" => Ok(Zip), diff --git a/generated/stripe_shared/src/payment_method_details.rs b/generated/stripe_shared/src/payment_method_details.rs index bcb6ce6ba..491bfc4cd 100644 --- a/generated/stripe_shared/src/payment_method_details.rs +++ b/generated/stripe_shared/src/payment_method_details.rs @@ -72,8 +72,6 @@ pub struct PaymentMethodDetails { pub sofort: Option, #[serde(skip_serializing_if = "Option::is_none")] pub stripe_account: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option, /// The type of transaction-specific details of the payment method used in the payment, one of `ach_credit_transfer`, `ach_debit`, `acss_debit`, `alipay`, `au_becs_debit`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `klarna`, `multibanco`, `p24`, `sepa_debit`, `sofort`, `stripe_account`, or `wechat`. /// An additional hash is included on `payment_method_details` with a name matching this value. /// It contains information specific to the payment method. diff --git a/generated/stripe_shared/src/payment_method_details_ideal.rs b/generated/stripe_shared/src/payment_method_details_ideal.rs index 139b7a1f8..9c116f4cf 100644 --- a/generated/stripe_shared/src/payment_method_details_ideal.rs +++ b/generated/stripe_shared/src/payment_method_details_ideal.rs @@ -1,7 +1,7 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodDetailsIdeal { /// The customer's bank. - /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. pub bank: Option, /// The Bank Identifier Code of the customer's bank. pub bic: Option, @@ -16,7 +16,7 @@ pub struct PaymentMethodDetailsIdeal { pub verified_name: Option, } /// The customer's bank. -/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. +/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum PaymentMethodDetailsIdealBank { @@ -28,7 +28,6 @@ pub enum PaymentMethodDetailsIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -51,7 +50,6 @@ impl PaymentMethodDetailsIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -77,7 +75,6 @@ impl std::str::FromStr for PaymentMethodDetailsIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -128,7 +125,6 @@ pub enum PaymentMethodDetailsIdealBic { Ingbnl2a, Knabnl2h, Moyonl21, - Nnbanl2g, Ntsbdeb1, Rabonl2u, Rbrbnl21, @@ -152,7 +148,6 @@ impl PaymentMethodDetailsIdealBic { Ingbnl2a => "INGBNL2A", Knabnl2h => "KNABNL2H", Moyonl21 => "MOYONL21", - Nnbanl2g => "NNBANL2G", Ntsbdeb1 => "NTSBDEB1", Rabonl2u => "RABONL2U", Rbrbnl21 => "RBRBNL21", @@ -179,7 +174,6 @@ impl std::str::FromStr for PaymentMethodDetailsIdealBic { "INGBNL2A" => Ok(Ingbnl2a), "KNABNL2H" => Ok(Knabnl2h), "MOYONL21" => Ok(Moyonl21), - "NNBANL2G" => Ok(Nnbanl2g), "NTSBDEB1" => Ok(Ntsbdeb1), "RABONL2U" => Ok(Rabonl2u), "RBRBNL21" => Ok(Rbrbnl21), diff --git a/generated/stripe_shared/src/payment_method_details_p24.rs b/generated/stripe_shared/src/payment_method_details_p24.rs index 5a69b86ef..b105ebf3a 100644 --- a/generated/stripe_shared/src/payment_method_details_p24.rs +++ b/generated/stripe_shared/src/payment_method_details_p24.rs @@ -1,7 +1,7 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodDetailsP24 { /// The customer's bank. - /// Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `bank_nowy_bfg_sa`, `getin_bank`, `velobank`, `blik`, `noble_pay`, `ideabank`, `envelobank`, `santander_przelew24`, `nest_przelew`, `mbank_mtransfer`, `inteligo`, `pbac_z_ipko`, `bnp_paribas`, `credit_agricole`, `toyota_bank`, `bank_pekao_sa`, `volkswagen_bank`, `bank_millennium`, `alior_bank`, or `boz`. + /// Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `bank_nowy_bfg_sa`, `getin_bank`, `blik`, `noble_pay`, `ideabank`, `envelobank`, `santander_przelew24`, `nest_przelew`, `mbank_mtransfer`, `inteligo`, `pbac_z_ipko`, `bnp_paribas`, `credit_agricole`, `toyota_bank`, `bank_pekao_sa`, `volkswagen_bank`, `bank_millennium`, `alior_bank`, or `boz`. pub bank: Option, /// Unique reference for this Przelewy24 payment. pub reference: Option, @@ -11,7 +11,7 @@ pub struct PaymentMethodDetailsP24 { pub verified_name: Option, } /// The customer's bank. -/// Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `bank_nowy_bfg_sa`, `getin_bank`, `velobank`, `blik`, `noble_pay`, `ideabank`, `envelobank`, `santander_przelew24`, `nest_przelew`, `mbank_mtransfer`, `inteligo`, `pbac_z_ipko`, `bnp_paribas`, `credit_agricole`, `toyota_bank`, `bank_pekao_sa`, `volkswagen_bank`, `bank_millennium`, `alior_bank`, or `boz`. +/// Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `bank_nowy_bfg_sa`, `getin_bank`, `blik`, `noble_pay`, `ideabank`, `envelobank`, `santander_przelew24`, `nest_przelew`, `mbank_mtransfer`, `inteligo`, `pbac_z_ipko`, `bnp_paribas`, `credit_agricole`, `toyota_bank`, `bank_pekao_sa`, `volkswagen_bank`, `bank_millennium`, `alior_bank`, or `boz`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum PaymentMethodDetailsP24Bank { @@ -39,7 +39,6 @@ pub enum PaymentMethodDetailsP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, @@ -72,7 +71,6 @@ impl PaymentMethodDetailsP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } @@ -108,7 +106,6 @@ impl std::str::FromStr for PaymentMethodDetailsP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } diff --git a/generated/stripe_shared/src/payment_method_details_swish.rs b/generated/stripe_shared/src/payment_method_details_swish.rs deleted file mode 100644 index 26525604f..000000000 --- a/generated/stripe_shared/src/payment_method_details_swish.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentMethodDetailsSwish { - /// Uniquely identifies the payer's Swish account. - /// You can use this attribute to check whether two Swish transactions were paid for by the same payer. - pub fingerprint: Option, - /// Payer bank reference number for the payment - pub payment_reference: Option, - /// The last four digits of the Swish account phone number - pub verified_phone_last4: Option, -} diff --git a/generated/stripe_shared/src/payment_method_ideal.rs b/generated/stripe_shared/src/payment_method_ideal.rs index e5c8d7092..b8a7fc874 100644 --- a/generated/stripe_shared/src/payment_method_ideal.rs +++ b/generated/stripe_shared/src/payment_method_ideal.rs @@ -1,13 +1,13 @@ #[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodIdeal { /// The customer's bank, if provided. - /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. pub bank: Option, /// The Bank Identifier Code of the customer's bank, if the bank was provided. pub bic: Option, } /// The customer's bank, if provided. -/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. +/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum PaymentMethodIdealBank { @@ -19,7 +19,6 @@ pub enum PaymentMethodIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -42,7 +41,6 @@ impl PaymentMethodIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -68,7 +66,6 @@ impl std::str::FromStr for PaymentMethodIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -119,7 +116,6 @@ pub enum PaymentMethodIdealBic { Ingbnl2a, Knabnl2h, Moyonl21, - Nnbanl2g, Ntsbdeb1, Rabonl2u, Rbrbnl21, @@ -143,7 +139,6 @@ impl PaymentMethodIdealBic { Ingbnl2a => "INGBNL2A", Knabnl2h => "KNABNL2H", Moyonl21 => "MOYONL21", - Nnbanl2g => "NNBANL2G", Ntsbdeb1 => "NTSBDEB1", Rabonl2u => "RABONL2U", Rbrbnl21 => "RBRBNL21", @@ -170,7 +165,6 @@ impl std::str::FromStr for PaymentMethodIdealBic { "INGBNL2A" => Ok(Ingbnl2a), "KNABNL2H" => Ok(Knabnl2h), "MOYONL21" => Ok(Moyonl21), - "NNBANL2G" => Ok(Nnbanl2g), "NTSBDEB1" => Ok(Ntsbdeb1), "RABONL2U" => Ok(Rabonl2u), "RBRBNL21" => Ok(Rbrbnl21), diff --git a/generated/stripe_shared/src/payment_method_options_us_bank_account_mandate_options.rs b/generated/stripe_shared/src/payment_method_options_us_bank_account_mandate_options.rs deleted file mode 100644 index f7b0781c8..000000000 --- a/generated/stripe_shared/src/payment_method_options_us_bank_account_mandate_options.rs +++ /dev/null @@ -1,62 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentMethodOptionsUsBankAccountMandateOptions { - /// Mandate collection method - #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, -} -/// Mandate collection method -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - Paper, -} -impl PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - pub fn as_str(self) -> &'static str { - use PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match self { - Paper => "paper", - } - } -} - -impl std::str::FromStr for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*; - match s { - "paper" => Ok(Paper), - _ => Err(()), - } - } -} -impl std::fmt::Display for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> - for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod -{ - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for PaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod", - ) - }) - } -} diff --git a/generated/stripe_shared/src/payment_method_p24.rs b/generated/stripe_shared/src/payment_method_p24.rs index 733b760de..dbe667e24 100644 --- a/generated/stripe_shared/src/payment_method_p24.rs +++ b/generated/stripe_shared/src/payment_method_p24.rs @@ -31,7 +31,6 @@ pub enum PaymentMethodP24Bank { SantanderPrzelew24, TmobileUsbugiBankowe, ToyotaBank, - Velobank, VolkswagenBank, /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, @@ -64,7 +63,6 @@ impl PaymentMethodP24Bank { SantanderPrzelew24 => "santander_przelew24", TmobileUsbugiBankowe => "tmobile_usbugi_bankowe", ToyotaBank => "toyota_bank", - Velobank => "velobank", VolkswagenBank => "volkswagen_bank", Unknown => "unknown", } @@ -100,7 +98,6 @@ impl std::str::FromStr for PaymentMethodP24Bank { "santander_przelew24" => Ok(SantanderPrzelew24), "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe), "toyota_bank" => Ok(ToyotaBank), - "velobank" => Ok(Velobank), "volkswagen_bank" => Ok(VolkswagenBank), _ => Err(()), } diff --git a/generated/stripe_shared/src/payment_method_swish.rs b/generated/stripe_shared/src/payment_method_swish.rs deleted file mode 100644 index e47969890..000000000 --- a/generated/stripe_shared/src/payment_method_swish.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct PaymentMethodSwish {} diff --git a/generated/stripe_shared/src/quote.rs b/generated/stripe_shared/src/quote.rs index 2ce2d8397..fc9a7167d 100644 --- a/generated/stripe_shared/src/quote.rs +++ b/generated/stripe_shared/src/quote.rs @@ -54,7 +54,8 @@ pub struct Quote { pub id: stripe_shared::QuoteId, /// The invoice that was created from this quote. pub invoice: Option>, - pub invoice_settings: stripe_shared::InvoiceSettingQuoteSetting, + /// All invoices will be billed using the specified settings. + pub invoice_settings: Option, /// A list of items the customer is being quoted for. #[serde(skip_serializing_if = "Option::is_none")] pub line_items: Option>, diff --git a/generated/stripe_shared/src/quotes_resource_automatic_tax.rs b/generated/stripe_shared/src/quotes_resource_automatic_tax.rs index 4b16b7111..7ee35616f 100644 --- a/generated/stripe_shared/src/quotes_resource_automatic_tax.rs +++ b/generated/stripe_shared/src/quotes_resource_automatic_tax.rs @@ -1,11 +1,7 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct QuotesResourceAutomaticTax { /// Automatically calculate taxes pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, /// The status of the most recent automated tax calculation for this quote. pub status: Option, } diff --git a/generated/stripe_shared/src/recurring.rs b/generated/stripe_shared/src/recurring.rs index 8cbc330d2..f7336e2e9 100644 --- a/generated/stripe_shared/src/recurring.rs +++ b/generated/stripe_shared/src/recurring.rs @@ -1,6 +1,8 @@ #[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct Recurring { - /// Specifies a usage aggregation strategy for prices of `usage_type=metered`. Defaults to `sum`. + /// Specifies a usage aggregation strategy for prices of `usage_type=metered`. + /// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. + /// Defaults to `sum`. pub aggregate_usage: Option, /// The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. pub interval: RecurringInterval, @@ -16,7 +18,9 @@ pub struct Recurring { /// Defaults to `licensed`. pub usage_type: RecurringUsageType, } -/// Specifies a usage aggregation strategy for prices of `usage_type=metered`. Defaults to `sum`. +/// Specifies a usage aggregation strategy for prices of `usage_type=metered`. +/// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. +/// Defaults to `sum`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum RecurringAggregateUsage { LastDuringPeriod, diff --git a/generated/stripe_shared/src/refund.rs b/generated/stripe_shared/src/refund.rs index c48c33369..1bf4415f3 100644 --- a/generated/stripe_shared/src/refund.rs +++ b/generated/stripe_shared/src/refund.rs @@ -22,8 +22,6 @@ pub struct Refund { /// You can use this for displaying to users (available on non-card refunds only). #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub destination_details: Option, /// After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. #[serde(skip_serializing_if = "Option::is_none")] pub failure_balance_transaction: @@ -52,7 +50,8 @@ pub struct Refund { /// Only present if the charge came from another Stripe account. pub source_transfer_reversal: Option>, /// Status of the refund. - /// This can be `pending`, `requires_action`, `succeeded`, `failed`, or `canceled`. + /// For credit card refunds, this can be `pending`, `succeeded`, or `failed`. + /// For other types of refunds, it can be `pending`, `requires_action`, `succeeded`, `failed`, or `canceled`. /// Learn more about [failed refunds](https://stripe.com/docs/refunds#failed-refunds). pub status: Option, /// This refers to the transfer reversal object if the accompanying transfer reverses. diff --git a/generated/stripe_shared/src/refund_destination_details.rs b/generated/stripe_shared/src/refund_destination_details.rs deleted file mode 100644 index a64f2802e..000000000 --- a/generated/stripe_shared/src/refund_destination_details.rs +++ /dev/null @@ -1,64 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct RefundDestinationDetails { - #[serde(skip_serializing_if = "Option::is_none")] - pub affirm: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub alipay: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub au_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub br_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub customer_cash_balance: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub eps: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub eu_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub gb_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub giropay: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub jp_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub klarna: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub mx_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub p24: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub paynow: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub pix: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub revolut: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub sofort: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub swish: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub th_bank_transfer: Option, - /// The type of transaction-specific details of the payment method used in the refund (e.g., `card`). - /// An additional hash is included on `destination_details` with a name matching this value. - /// It contains information specific to the refund transaction. - #[serde(rename = "type")] - pub type_: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_transfer: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub wechat_pay: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub zip: Option, -} diff --git a/generated/stripe_shared/src/refund_destination_details_card.rs b/generated/stripe_shared/src/refund_destination_details_card.rs deleted file mode 100644 index a3531e4d2..000000000 --- a/generated/stripe_shared/src/refund_destination_details_card.rs +++ /dev/null @@ -1,73 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct RefundDestinationDetailsCard { - /// Value of the reference number assigned to the refund. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference: Option, - /// Status of the reference number on the refund. This can be `pending`, `available` or `unavailable`. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference_status: Option, - /// Type of the reference number assigned to the refund. - #[serde(skip_serializing_if = "Option::is_none")] - pub reference_type: Option, - /// The type of refund. This can be `refund`, `reversal`, or `pending`. - #[serde(rename = "type")] - pub type_: RefundDestinationDetailsCardType, -} -/// The type of refund. This can be `refund`, `reversal`, or `pending`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum RefundDestinationDetailsCardType { - Pending, - Refund, - Reversal, -} -impl RefundDestinationDetailsCardType { - pub fn as_str(self) -> &'static str { - use RefundDestinationDetailsCardType::*; - match self { - Pending => "pending", - Refund => "refund", - Reversal => "reversal", - } - } -} - -impl std::str::FromStr for RefundDestinationDetailsCardType { - type Err = (); - fn from_str(s: &str) -> Result { - use RefundDestinationDetailsCardType::*; - match s { - "pending" => Ok(Pending), - "refund" => Ok(Refund), - "reversal" => Ok(Reversal), - _ => Err(()), - } - } -} -impl std::fmt::Display for RefundDestinationDetailsCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for RefundDestinationDetailsCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for RefundDestinationDetailsCardType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for RefundDestinationDetailsCardType { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for RefundDestinationDetailsCardType") - }) - } -} diff --git a/generated/stripe_shared/src/refund_destination_details_generic.rs b/generated/stripe_shared/src/refund_destination_details_generic.rs deleted file mode 100644 index 38af924b3..000000000 --- a/generated/stripe_shared/src/refund_destination_details_generic.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] -pub struct RefundDestinationDetailsGeneric { - /// The reference assigned to the refund. - pub reference: Option, - /// Status of the reference on the refund. This can be `pending`, `available` or `unavailable`. - pub reference_status: Option, -} diff --git a/generated/stripe_shared/src/schedules_phase_automatic_tax.rs b/generated/stripe_shared/src/schedules_phase_automatic_tax.rs index e0f4228ae..b1c913da7 100644 --- a/generated/stripe_shared/src/schedules_phase_automatic_tax.rs +++ b/generated/stripe_shared/src/schedules_phase_automatic_tax.rs @@ -1,9 +1,5 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct SchedulesPhaseAutomaticTax { /// Whether Stripe automatically computes tax on invoices created during this phase. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, } diff --git a/generated/stripe_shared/src/setup_attempt_payment_method_details_ideal.rs b/generated/stripe_shared/src/setup_attempt_payment_method_details_ideal.rs index f7379c164..89d107520 100644 --- a/generated/stripe_shared/src/setup_attempt_payment_method_details_ideal.rs +++ b/generated/stripe_shared/src/setup_attempt_payment_method_details_ideal.rs @@ -1,7 +1,7 @@ #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct SetupAttemptPaymentMethodDetailsIdeal { /// The customer's bank. - /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. + /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. pub bank: Option, /// The Bank Identifier Code of the customer's bank. pub bic: Option, @@ -16,7 +16,7 @@ pub struct SetupAttemptPaymentMethodDetailsIdeal { pub verified_name: Option, } /// The customer's bank. -/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. +/// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum SetupAttemptPaymentMethodDetailsIdealBank { @@ -28,7 +28,6 @@ pub enum SetupAttemptPaymentMethodDetailsIdealBank { Knab, Moneyou, N26, - Nn, Rabobank, Regiobank, Revolut, @@ -51,7 +50,6 @@ impl SetupAttemptPaymentMethodDetailsIdealBank { Knab => "knab", Moneyou => "moneyou", N26 => "n26", - Nn => "nn", Rabobank => "rabobank", Regiobank => "regiobank", Revolut => "revolut", @@ -77,7 +75,6 @@ impl std::str::FromStr for SetupAttemptPaymentMethodDetailsIdealBank { "knab" => Ok(Knab), "moneyou" => Ok(Moneyou), "n26" => Ok(N26), - "nn" => Ok(Nn), "rabobank" => Ok(Rabobank), "regiobank" => Ok(Regiobank), "revolut" => Ok(Revolut), @@ -128,7 +125,6 @@ pub enum SetupAttemptPaymentMethodDetailsIdealBic { Ingbnl2a, Knabnl2h, Moyonl21, - Nnbanl2g, Ntsbdeb1, Rabonl2u, Rbrbnl21, @@ -152,7 +148,6 @@ impl SetupAttemptPaymentMethodDetailsIdealBic { Ingbnl2a => "INGBNL2A", Knabnl2h => "KNABNL2H", Moyonl21 => "MOYONL21", - Nnbanl2g => "NNBANL2G", Ntsbdeb1 => "NTSBDEB1", Rabonl2u => "RABONL2U", Rbrbnl21 => "RBRBNL21", @@ -179,7 +174,6 @@ impl std::str::FromStr for SetupAttemptPaymentMethodDetailsIdealBic { "INGBNL2A" => Ok(Ingbnl2a), "KNABNL2H" => Ok(Knabnl2h), "MOYONL21" => Ok(Moyonl21), - "NNBANL2G" => Ok(Nnbanl2g), "NTSBDEB1" => Ok(Ntsbdeb1), "RABONL2U" => Ok(Rabonl2u), "RBRBNL21" => Ok(Rbrbnl21), diff --git a/generated/stripe_shared/src/setup_intent_payment_method_options_card.rs b/generated/stripe_shared/src/setup_intent_payment_method_options_card.rs index 189f64e33..50fc06aa5 100644 --- a/generated/stripe_shared/src/setup_intent_payment_method_options_card.rs +++ b/generated/stripe_shared/src/setup_intent_payment_method_options_card.rs @@ -8,7 +8,8 @@ pub struct SetupIntentPaymentMethodOptionsCard { pub network: Option, /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// If not provided, this value defaults to `automatic`. + /// Permitted values include: `automatic` or `any`. + /// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. pub request_three_d_secure: Option, } @@ -98,13 +99,14 @@ impl<'de> serde::Deserialize<'de> for SetupIntentPaymentMethodOptionsCardNetwork } /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. -/// If not provided, this value defaults to `automatic`. +/// Permitted values include: `automatic` or `any`. +/// If not provided, defaults to `automatic`. /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. #[derive(Copy, Clone, Eq, PartialEq)] pub enum SetupIntentPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, + ChallengeOnly, } impl SetupIntentPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { @@ -112,7 +114,7 @@ impl SetupIntentPaymentMethodOptionsCardRequestThreeDSecure { match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", + ChallengeOnly => "challenge_only", } } } @@ -124,7 +126,7 @@ impl std::str::FromStr for SetupIntentPaymentMethodOptionsCardRequestThreeDSecur match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), + "challenge_only" => Ok(ChallengeOnly), _ => Err(()), } } diff --git a/generated/stripe_shared/src/setup_intent_payment_method_options_us_bank_account.rs b/generated/stripe_shared/src/setup_intent_payment_method_options_us_bank_account.rs index da3226828..ae68a4a04 100644 --- a/generated/stripe_shared/src/setup_intent_payment_method_options_us_bank_account.rs +++ b/generated/stripe_shared/src/setup_intent_payment_method_options_us_bank_account.rs @@ -2,8 +2,6 @@ pub struct SetupIntentPaymentMethodOptionsUsBankAccount { #[serde(skip_serializing_if = "Option::is_none")] pub financial_connections: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub mandate_options: Option, /// Bank account verification method. #[serde(skip_serializing_if = "Option::is_none")] pub verification_method: Option, diff --git a/generated/stripe_shared/src/subscription.rs b/generated/stripe_shared/src/subscription.rs index 587fcf24a..5e01cbb81 100644 --- a/generated/stripe_shared/src/subscription.rs +++ b/generated/stripe_shared/src/subscription.rs @@ -11,13 +11,9 @@ pub struct Subscription { /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. pub application_fee_percent: Option, pub automatic_tax: stripe_shared::SubscriptionAutomaticTax, - /// The reference point that aligns future [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle) dates. - /// It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. + /// Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. /// The timestamp is in UTC format. pub billing_cycle_anchor: stripe_types::Timestamp, - /// The fixed values used to calculate the `billing_cycle_anchor`. - pub billing_cycle_anchor_config: - Option, /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. pub billing_thresholds: Option, /// A date in the future at which the subscription will automatically get canceled diff --git a/generated/stripe_shared/src/subscription_automatic_tax.rs b/generated/stripe_shared/src/subscription_automatic_tax.rs index 4328f2c5f..2ebd2ec98 100644 --- a/generated/stripe_shared/src/subscription_automatic_tax.rs +++ b/generated/stripe_shared/src/subscription_automatic_tax.rs @@ -1,9 +1,5 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct SubscriptionAutomaticTax { /// Whether Stripe automatically computes tax on this subscription. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, } diff --git a/generated/stripe_shared/src/subscription_payment_method_options_card.rs b/generated/stripe_shared/src/subscription_payment_method_options_card.rs index eea74be21..be1d21dc6 100644 --- a/generated/stripe_shared/src/subscription_payment_method_options_card.rs +++ b/generated/stripe_shared/src/subscription_payment_method_options_card.rs @@ -104,7 +104,6 @@ impl<'de> serde::Deserialize<'de> for SubscriptionPaymentMethodOptionsCardNetwor pub enum SubscriptionPaymentMethodOptionsCardRequestThreeDSecure { Any, Automatic, - Challenge, } impl SubscriptionPaymentMethodOptionsCardRequestThreeDSecure { pub fn as_str(self) -> &'static str { @@ -112,7 +111,6 @@ impl SubscriptionPaymentMethodOptionsCardRequestThreeDSecure { match self { Any => "any", Automatic => "automatic", - Challenge => "challenge", } } } @@ -124,7 +122,6 @@ impl std::str::FromStr for SubscriptionPaymentMethodOptionsCardRequestThreeDSecu match s { "any" => Ok(Any), "automatic" => Ok(Automatic), - "challenge" => Ok(Challenge), _ => Err(()), } } diff --git a/generated/stripe_shared/src/subscription_schedule.rs b/generated/stripe_shared/src/subscription_schedule.rs index 7672ad33d..b0d4b6f2c 100644 --- a/generated/stripe_shared/src/subscription_schedule.rs +++ b/generated/stripe_shared/src/subscription_schedule.rs @@ -20,8 +20,7 @@ pub struct SubscriptionSchedule { pub default_settings: stripe_shared::SubscriptionSchedulesResourceDefaultSettings, /// Behavior of the subscription schedule and underlying subscription when it ends. /// Possible values are `release` or `cancel` with the default being `release`. - /// `release` will end the subscription schedule and keep the underlying subscription running. - /// `cancel` will end the subscription schedule and cancel the underlying subscription. + /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. pub end_behavior: stripe_shared::SubscriptionScheduleEndBehavior, /// Unique identifier for the object. pub id: stripe_shared::SubscriptionScheduleId, diff --git a/generated/stripe_shared/src/subscription_schedules_resource_default_settings.rs b/generated/stripe_shared/src/subscription_schedules_resource_default_settings.rs index c83761673..5d1abd6d7 100644 --- a/generated/stripe_shared/src/subscription_schedules_resource_default_settings.rs +++ b/generated/stripe_shared/src/subscription_schedules_resource_default_settings.rs @@ -23,7 +23,8 @@ pub struct SubscriptionSchedulesResourceDefaultSettings { /// Subscription description, meant to be displayable to the customer. /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. pub description: Option, - pub invoice_settings: stripe_shared::InvoiceSettingSubscriptionScheduleSetting, + /// The subscription schedule's default invoice settings. + pub invoice_settings: Option, /// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. /// See the Connect documentation for details. pub on_behalf_of: Option>, diff --git a/generated/stripe_shared/src/subscription_schedules_resource_default_settings_automatic_tax.rs b/generated/stripe_shared/src/subscription_schedules_resource_default_settings_automatic_tax.rs index 78b1fd762..5dd4d8386 100644 --- a/generated/stripe_shared/src/subscription_schedules_resource_default_settings_automatic_tax.rs +++ b/generated/stripe_shared/src/subscription_schedules_resource_default_settings_automatic_tax.rs @@ -1,9 +1,5 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct SubscriptionSchedulesResourceDefaultSettingsAutomaticTax { /// Whether Stripe automatically computes tax on invoices created during this phase. pub enabled: bool, - /// The account that's liable for tax. - /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. - /// The tax transaction is returned in the report of the connected account. - pub liability: Option, } diff --git a/generated/stripe_shared/src/subscriptions_resource_billing_cycle_anchor_config.rs b/generated/stripe_shared/src/subscriptions_resource_billing_cycle_anchor_config.rs deleted file mode 100644 index f1b2614f9..000000000 --- a/generated/stripe_shared/src/subscriptions_resource_billing_cycle_anchor_config.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct SubscriptionsResourceBillingCycleAnchorConfig { - /// The day of the month of the billing_cycle_anchor. - pub day_of_month: i64, - /// The hour of the day of the billing_cycle_anchor. - pub hour: Option, - /// The minute of the hour of the billing_cycle_anchor. - pub minute: Option, - /// The month to start full cycle billing periods. - pub month: Option, - /// The second of the minute of the billing_cycle_anchor. - pub second: Option, -} diff --git a/generated/stripe_shared/src/subscriptions_resource_payment_settings.rs b/generated/stripe_shared/src/subscriptions_resource_payment_settings.rs index 2f53272f5..d3c57803d 100644 --- a/generated/stripe_shared/src/subscriptions_resource_payment_settings.rs +++ b/generated/stripe_shared/src/subscriptions_resource_payment_settings.rs @@ -25,14 +25,12 @@ pub enum SubscriptionsResourcePaymentSettingsPaymentMethodTypes { Card, Cashapp, CustomerBalance, - Eps, Fpx, Giropay, Grabpay, Ideal, Konbini, Link, - P24, Paynow, Paypal, Promptpay, @@ -58,14 +56,12 @@ impl SubscriptionsResourcePaymentSettingsPaymentMethodTypes { Card => "card", Cashapp => "cashapp", CustomerBalance => "customer_balance", - Eps => "eps", Fpx => "fpx", Giropay => "giropay", Grabpay => "grabpay", Ideal => "ideal", Konbini => "konbini", Link => "link", - P24 => "p24", Paynow => "paynow", Paypal => "paypal", Promptpay => "promptpay", @@ -94,14 +90,12 @@ impl std::str::FromStr for SubscriptionsResourcePaymentSettingsPaymentMethodType "card" => Ok(Card), "cashapp" => Ok(Cashapp), "customer_balance" => Ok(CustomerBalance), - "eps" => Ok(Eps), "fpx" => Ok(Fpx), "giropay" => Ok(Giropay), "grabpay" => Ok(Grabpay), "ideal" => Ok(Ideal), "konbini" => Ok(Konbini), "link" => Ok(Link), - "p24" => Ok(P24), "paynow" => Ok(Paynow), "paypal" => Ok(Paypal), "promptpay" => Ok(Promptpay), diff --git a/generated/stripe_shared/src/tax_i_ds_owner.rs b/generated/stripe_shared/src/tax_i_ds_owner.rs deleted file mode 100644 index 79a1ffa55..000000000 --- a/generated/stripe_shared/src/tax_i_ds_owner.rs +++ /dev/null @@ -1,75 +0,0 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -pub struct TaxIDsOwner { - /// The account being referenced when `type` is `account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, - /// The Connect Application being referenced when `type` is `application`. - #[serde(skip_serializing_if = "Option::is_none")] - pub application: Option>, - /// The customer being referenced when `type` is `customer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option>, - /// Type of owner referenced. - #[serde(rename = "type")] - pub type_: TaxIDsOwnerType, -} -/// Type of owner referenced. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum TaxIDsOwnerType { - Account, - Application, - Customer, - Self_, -} -impl TaxIDsOwnerType { - pub fn as_str(self) -> &'static str { - use TaxIDsOwnerType::*; - match self { - Account => "account", - Application => "application", - Customer => "customer", - Self_ => "self", - } - } -} - -impl std::str::FromStr for TaxIDsOwnerType { - type Err = (); - fn from_str(s: &str) -> Result { - use TaxIDsOwnerType::*; - match s { - "account" => Ok(Account), - "application" => Ok(Application), - "customer" => Ok(Customer), - "self" => Ok(Self_), - _ => Err(()), - } - } -} -impl std::fmt::Display for TaxIDsOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for TaxIDsOwnerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for TaxIDsOwnerType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for TaxIDsOwnerType { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for TaxIDsOwnerType")) - } -} diff --git a/generated/stripe_shared/src/tax_id.rs b/generated/stripe_shared/src/tax_id.rs index d8bceb5c0..8f04c5c58 100644 --- a/generated/stripe_shared/src/tax_id.rs +++ b/generated/stripe_shared/src/tax_id.rs @@ -16,9 +16,6 @@ pub struct TaxId { pub id: stripe_shared::TaxIdId, /// 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 account or customer the tax ID belongs to. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. /// Note that some legacy tax IDs have type `unknown`. #[serde(rename = "type")] diff --git a/generated/stripe_shared/src/tax_rate.rs b/generated/stripe_shared/src/tax_rate.rs index d45339be6..d5ff55127 100644 --- a/generated/stripe_shared/src/tax_rate.rs +++ b/generated/stripe_shared/src/tax_rate.rs @@ -30,9 +30,6 @@ pub struct TaxRate { /// You can use this label field for tax reporting purposes. /// It also appears on your customer’s invoice. pub jurisdiction: Option, - /// The level of the jurisdiction that imposes this tax rate. - /// Will be `null` for manually defined tax rates. - pub jurisdiction_level: Option, /// 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, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. @@ -47,73 +44,6 @@ pub struct TaxRate { /// The high-level tax type, such as `vat` or `sales_tax`. pub tax_type: Option, } -/// The level of the jurisdiction that imposes this tax rate. -/// Will be `null` for manually defined tax rates. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum TaxRateJurisdictionLevel { - City, - Country, - County, - District, - Multiple, - State, -} -impl TaxRateJurisdictionLevel { - pub fn as_str(self) -> &'static str { - use TaxRateJurisdictionLevel::*; - match self { - City => "city", - Country => "country", - County => "county", - District => "district", - Multiple => "multiple", - State => "state", - } - } -} - -impl std::str::FromStr for TaxRateJurisdictionLevel { - type Err = (); - fn from_str(s: &str) -> Result { - use TaxRateJurisdictionLevel::*; - match s { - "city" => Ok(City), - "country" => Ok(Country), - "county" => Ok(County), - "district" => Ok(District), - "multiple" => Ok(Multiple), - "state" => Ok(State), - _ => Err(()), - } - } -} -impl std::fmt::Display for TaxRateJurisdictionLevel { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for TaxRateJurisdictionLevel { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for TaxRateJurisdictionLevel { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for TaxRateJurisdictionLevel { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for TaxRateJurisdictionLevel")) - } -} impl stripe_types::Object for TaxRate { type Id = stripe_shared::TaxRateId; fn id(&self) -> &Self::Id { diff --git a/generated/stripe_shared/src/three_d_secure_details.rs b/generated/stripe_shared/src/three_d_secure_details.rs index b61bbeab4..53129350d 100644 --- a/generated/stripe_shared/src/three_d_secure_details.rs +++ b/generated/stripe_shared/src/three_d_secure_details.rs @@ -1,19 +1,13 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct ThreeDSecureDetails { /// For authenticated transactions: how the customer was authenticated by /// the issuing bank. pub authentication_flow: Option, - /// The Electronic Commerce Indicator (ECI). A protocol-level field - /// indicating what degree of authentication was performed. - pub electronic_commerce_indicator: Option, /// Indicates the outcome of 3D Secure authentication. pub result: Option, /// Additional information about why 3D Secure succeeded or failed based /// on the `result`. pub result_reason: Option, - /// The 3D Secure 1 XID or 3D Secure 2 Directory Server Transaction ID - /// (dsTransId) for this payment. - pub transaction_id: Option, /// The version of 3D Secure that was used. pub version: Option, } @@ -73,73 +67,6 @@ impl<'de> serde::Deserialize<'de> for ThreeDSecureDetailsAuthenticationFlow { }) } } -/// The Electronic Commerce Indicator (ECI). A protocol-level field -/// indicating what degree of authentication was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ThreeDSecureDetailsElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl ThreeDSecureDetailsElectronicCommerceIndicator { - pub fn as_str(self) -> &'static str { - use ThreeDSecureDetailsElectronicCommerceIndicator::*; - match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", - } - } -} - -impl std::str::FromStr for ThreeDSecureDetailsElectronicCommerceIndicator { - type Err = (); - fn from_str(s: &str) -> Result { - use ThreeDSecureDetailsElectronicCommerceIndicator::*; - match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), - _ => Err(()), - } - } -} -impl std::fmt::Display for ThreeDSecureDetailsElectronicCommerceIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ThreeDSecureDetailsElectronicCommerceIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ThreeDSecureDetailsElectronicCommerceIndicator { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ThreeDSecureDetailsElectronicCommerceIndicator { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for ThreeDSecureDetailsElectronicCommerceIndicator", - ) - }) - } -} /// Indicates the outcome of 3D Secure authentication. #[derive(Copy, Clone, Eq, PartialEq)] pub enum ThreeDSecureDetailsResult { diff --git a/generated/stripe_shared/src/three_d_secure_details_charge.rs b/generated/stripe_shared/src/three_d_secure_details_charge.rs index 39a51b6ca..40a7f11ee 100644 --- a/generated/stripe_shared/src/three_d_secure_details_charge.rs +++ b/generated/stripe_shared/src/three_d_secure_details_charge.rs @@ -1,25 +1,13 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct ThreeDSecureDetailsCharge { /// For authenticated transactions: how the customer was authenticated by /// the issuing bank. pub authentication_flow: Option, - /// The Electronic Commerce Indicator (ECI). A protocol-level field - /// indicating what degree of authentication was performed. - pub electronic_commerce_indicator: Option, - /// The exemption requested via 3DS and accepted by the issuer at authentication time. - pub exemption_indicator: Option, - /// Whether Stripe requested the value of `exemption_indicator` in the transaction. This will depend on - /// the outcome of Stripe's internal risk assessment. - #[serde(skip_serializing_if = "Option::is_none")] - pub exemption_indicator_applied: Option, /// Indicates the outcome of 3D Secure authentication. pub result: Option, /// Additional information about why 3D Secure succeeded or failed based /// on the `result`. pub result_reason: Option, - /// The 3D Secure 1 XID or 3D Secure 2 Directory Server Transaction ID - /// (dsTransId) for this payment. - pub transaction_id: Option, /// The version of 3D Secure that was used. pub version: Option, } @@ -81,130 +69,6 @@ impl<'de> serde::Deserialize<'de> for ThreeDSecureDetailsChargeAuthenticationFlo }) } } -/// The Electronic Commerce Indicator (ECI). A protocol-level field -/// indicating what degree of authentication was performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ThreeDSecureDetailsChargeElectronicCommerceIndicator { - V01, - V02, - V05, - V06, - V07, -} -impl ThreeDSecureDetailsChargeElectronicCommerceIndicator { - pub fn as_str(self) -> &'static str { - use ThreeDSecureDetailsChargeElectronicCommerceIndicator::*; - match self { - V01 => "01", - V02 => "02", - V05 => "05", - V06 => "06", - V07 => "07", - } - } -} - -impl std::str::FromStr for ThreeDSecureDetailsChargeElectronicCommerceIndicator { - type Err = (); - fn from_str(s: &str) -> Result { - use ThreeDSecureDetailsChargeElectronicCommerceIndicator::*; - match s { - "01" => Ok(V01), - "02" => Ok(V02), - "05" => Ok(V05), - "06" => Ok(V06), - "07" => Ok(V07), - _ => Err(()), - } - } -} -impl std::fmt::Display for ThreeDSecureDetailsChargeElectronicCommerceIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ThreeDSecureDetailsChargeElectronicCommerceIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ThreeDSecureDetailsChargeElectronicCommerceIndicator { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ThreeDSecureDetailsChargeElectronicCommerceIndicator { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for ThreeDSecureDetailsChargeElectronicCommerceIndicator", - ) - }) - } -} -/// The exemption requested via 3DS and accepted by the issuer at authentication time. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ThreeDSecureDetailsChargeExemptionIndicator { - LowRisk, - None, -} -impl ThreeDSecureDetailsChargeExemptionIndicator { - pub fn as_str(self) -> &'static str { - use ThreeDSecureDetailsChargeExemptionIndicator::*; - match self { - LowRisk => "low_risk", - None => "none", - } - } -} - -impl std::str::FromStr for ThreeDSecureDetailsChargeExemptionIndicator { - type Err = (); - fn from_str(s: &str) -> Result { - use ThreeDSecureDetailsChargeExemptionIndicator::*; - match s { - "low_risk" => Ok(LowRisk), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl std::fmt::Display for ThreeDSecureDetailsChargeExemptionIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ThreeDSecureDetailsChargeExemptionIndicator { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ThreeDSecureDetailsChargeExemptionIndicator { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for ThreeDSecureDetailsChargeExemptionIndicator { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for ThreeDSecureDetailsChargeExemptionIndicator", - ) - }) - } -} /// Indicates the outcome of 3D Secure authentication. #[derive(Copy, Clone, Eq, PartialEq)] pub enum ThreeDSecureDetailsChargeResult { diff --git a/generated/stripe_terminal/Cargo.toml b/generated/stripe_terminal/Cargo.toml index 04def9be3..9d6ac5aae 100644 --- a/generated/stripe_terminal/Cargo.toml +++ b/generated/stripe_terminal/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - terminal_configuration = [] terminal_connection_token = [] terminal_location = [] @@ -48,5 +37,5 @@ full = ["terminal_configuration", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_terminal/src/terminal_configuration/requests.rs b/generated/stripe_terminal/src/terminal_configuration/requests.rs index 25cbf531c..6e3ee0c06 100644 --- a/generated/stripe_terminal/src/terminal_configuration/requests.rs +++ b/generated/stripe_terminal/src/terminal_configuration/requests.rs @@ -1,26 +1,119 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteTerminalConfiguration {} -impl DeleteTerminalConfiguration { +pub struct CreateTerminalConfigurationBuilder<'a> { + /// An object containing device type specific settings for BBPOS WisePOS E readers + #[serde(skip_serializing_if = "Option::is_none")] + pub bbpos_wisepos_e: Option>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Configurations for collecting transactions offline. + #[serde(skip_serializing_if = "Option::is_none")] + pub offline: Option, + /// Tipping configurations for readers supporting on-reader tips + #[serde(skip_serializing_if = "Option::is_none")] + pub tipping: Option>, + /// An object containing device type specific settings for Verifone P400 readers + #[serde(skip_serializing_if = "Option::is_none")] + pub verifone_p400: Option>, +} +impl<'a> CreateTerminalConfigurationBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// An object containing device type specific settings for BBPOS WisePOS E readers +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateTerminalConfigurationBuilderBbposWiseposE<'a> { + /// A File ID representing an image you would like displayed on the reader. + #[serde(skip_serializing_if = "Option::is_none")] + pub splashscreen: Option<&'a str>, +} +impl<'a> CreateTerminalConfigurationBuilderBbposWiseposE<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// An object containing device type specific settings for Verifone P400 readers +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateTerminalConfigurationBuilderVerifoneP400<'a> { + /// A File ID representing an image you would like displayed on the reader. + #[serde(skip_serializing_if = "Option::is_none")] + pub splashscreen: Option<&'a str>, +} +impl<'a> CreateTerminalConfigurationBuilderVerifoneP400<'a> { pub fn new() -> Self { Self::default() } } -impl DeleteTerminalConfiguration { - /// Deletes a `Configuration` object. - pub fn send( +/// Creates a new `Configuration` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTerminalConfiguration<'a> { + inner: CreateTerminalConfigurationBuilder<'a>, +} +impl<'a> CreateTerminalConfiguration<'a> { + pub fn new() -> Self { + Self { inner: CreateTerminalConfigurationBuilder::new() } + } + pub fn bbpos_wisepos_e( + mut self, + bbpos_wisepos_e: CreateTerminalConfigurationBuilderBbposWiseposE<'a>, + ) -> Self { + self.inner.bbpos_wisepos_e = Some(bbpos_wisepos_e); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn offline(mut self, offline: Offline) -> Self { + self.inner.offline = Some(offline); + self + } + + pub fn tipping(mut self, tipping: Tipping<'a>) -> Self { + self.inner.tipping = Some(tipping); + self + } + + pub fn verifone_p400( + mut self, + verifone_p400: CreateTerminalConfigurationBuilderVerifoneP400<'a>, + ) -> Self { + self.inner.verifone_p400 = Some(verifone_p400); + self + } +} +impl CreateTerminalConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_terminal::TerminalConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/configurations/{configuration}"), - self, - http_types::Method::Delete, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTerminalConfiguration<'_> { + type Output = stripe_terminal::TerminalConfiguration; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/terminal/configurations").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTerminalConfiguration<'a> { +pub struct ListTerminalConfigurationBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -42,44 +135,117 @@ pub struct ListTerminalConfiguration<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub starting_after: Option<&'a str>, } -impl<'a> ListTerminalConfiguration<'a> { +impl<'a> ListTerminalConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Returns a list of `Configuration` objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTerminalConfiguration<'a> { + inner: ListTerminalConfigurationBuilder<'a>, +} impl<'a> ListTerminalConfiguration<'a> { - /// Returns a list of `Configuration` objects. - pub fn send( + pub fn new() -> Self { + Self { inner: ListTerminalConfigurationBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn is_account_default(mut self, is_account_default: bool) -> Self { + self.inner.is_account_default = Some(is_account_default); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTerminalConfiguration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/terminal/configurations", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/terminal/configurations", self) +} + +impl StripeRequest for ListTerminalConfiguration<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/terminal/configurations").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTerminalConfiguration<'a> { +pub struct RetrieveTerminalConfigurationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTerminalConfiguration<'a> { +impl<'a> RetrieveTerminalConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a `Configuration` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTerminalConfiguration<'a> { + inner: RetrieveTerminalConfigurationBuilder<'a>, + configuration: &'a stripe_terminal::TerminalConfigurationId, +} impl<'a> RetrieveTerminalConfiguration<'a> { - /// Retrieves a `Configuration` object. - pub fn send( + pub fn new(configuration: &'a stripe_terminal::TerminalConfigurationId) -> Self { + Self { configuration, inner: RetrieveTerminalConfigurationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTerminalConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_terminal::TerminalConfigurationId, - ) -> stripe::Response { - client.get_query(&format!("/terminal/configurations/{configuration}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTerminalConfiguration<'_> { + type Output = RetrieveTerminalConfigurationReturned; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new(StripeMethod::Get, format!("/terminal/configurations/{configuration}")) + .query(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -89,10 +255,10 @@ pub enum RetrieveTerminalConfigurationReturned { DeletedTerminalConfiguration(stripe_terminal::DeletedTerminalConfiguration), } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfiguration<'a> { +pub struct UpdateTerminalConfigurationBuilder<'a> { /// An object containing device type specific settings for BBPOS WisePOS E readers #[serde(skip_serializing_if = "Option::is_none")] - pub bbpos_wisepos_e: Option>, + pub bbpos_wisepos_e: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -104,105 +270,101 @@ pub struct CreateTerminalConfiguration<'a> { pub tipping: Option>, /// An object containing device type specific settings for Verifone P400 readers #[serde(skip_serializing_if = "Option::is_none")] - pub verifone_p400: Option>, + pub verifone_p400: Option>, } -impl<'a> CreateTerminalConfiguration<'a> { +impl<'a> UpdateTerminalConfigurationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// An object containing device type specific settings for BBPOS WisePOS E readers #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationBbposWiseposE<'a> { +pub struct UpdateTerminalConfigurationBuilderBbposWiseposE<'a> { /// A File ID representing an image you would like displayed on the reader. #[serde(skip_serializing_if = "Option::is_none")] pub splashscreen: Option<&'a str>, } -impl<'a> CreateTerminalConfigurationBbposWiseposE<'a> { +impl<'a> UpdateTerminalConfigurationBuilderBbposWiseposE<'a> { pub fn new() -> Self { Self::default() } } /// An object containing device type specific settings for Verifone P400 readers #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationVerifoneP400<'a> { +pub struct UpdateTerminalConfigurationBuilderVerifoneP400<'a> { /// A File ID representing an image you would like displayed on the reader. #[serde(skip_serializing_if = "Option::is_none")] pub splashscreen: Option<&'a str>, } -impl<'a> CreateTerminalConfigurationVerifoneP400<'a> { +impl<'a> UpdateTerminalConfigurationBuilderVerifoneP400<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CreateTerminalConfiguration<'a> { - /// Creates a new `Configuration` object. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/terminal/configurations", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Updates a new `Configuration` object. +#[derive(Clone, Debug, serde::Serialize)] pub struct UpdateTerminalConfiguration<'a> { - /// An object containing device type specific settings for BBPOS WisePOS E readers - #[serde(skip_serializing_if = "Option::is_none")] - pub bbpos_wisepos_e: Option>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Configurations for collecting transactions offline. - #[serde(skip_serializing_if = "Option::is_none")] - pub offline: Option, - /// Tipping configurations for readers supporting on-reader tips - #[serde(skip_serializing_if = "Option::is_none")] - pub tipping: Option>, - /// An object containing device type specific settings for Verifone P400 readers - #[serde(skip_serializing_if = "Option::is_none")] - pub verifone_p400: Option>, + inner: UpdateTerminalConfigurationBuilder<'a>, + configuration: &'a stripe_terminal::TerminalConfigurationId, } impl<'a> UpdateTerminalConfiguration<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(configuration: &'a stripe_terminal::TerminalConfigurationId) -> Self { + Self { configuration, inner: UpdateTerminalConfigurationBuilder::new() } } -} -/// An object containing device type specific settings for BBPOS WisePOS E readers -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationBbposWiseposE<'a> { - /// A File ID representing an image you would like displayed on the reader. - #[serde(skip_serializing_if = "Option::is_none")] - pub splashscreen: Option<&'a str>, -} -impl<'a> UpdateTerminalConfigurationBbposWiseposE<'a> { - pub fn new() -> Self { - Self::default() + pub fn bbpos_wisepos_e( + mut self, + bbpos_wisepos_e: UpdateTerminalConfigurationBuilderBbposWiseposE<'a>, + ) -> Self { + self.inner.bbpos_wisepos_e = Some(bbpos_wisepos_e); + self } -} -/// An object containing device type specific settings for Verifone P400 readers -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationVerifoneP400<'a> { - /// A File ID representing an image you would like displayed on the reader. - #[serde(skip_serializing_if = "Option::is_none")] - pub splashscreen: Option<&'a str>, -} -impl<'a> UpdateTerminalConfigurationVerifoneP400<'a> { - pub fn new() -> Self { - Self::default() + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn offline(mut self, offline: Offline) -> Self { + self.inner.offline = Some(offline); + self + } + + pub fn tipping(mut self, tipping: Tipping<'a>) -> Self { + self.inner.tipping = Some(tipping); + self + } + + pub fn verifone_p400( + mut self, + verifone_p400: UpdateTerminalConfigurationBuilderVerifoneP400<'a>, + ) -> Self { + self.inner.verifone_p400 = Some(verifone_p400); + self } } -impl<'a> UpdateTerminalConfiguration<'a> { - /// Updates a new `Configuration` object. - pub fn send( +impl UpdateTerminalConfiguration<'_> { + pub async fn send( &self, - client: &stripe::Client, - configuration: &stripe_terminal::TerminalConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/configurations/{configuration}"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTerminalConfiguration<'_> { + type Output = UpdateTerminalConfigurationReturned; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new(StripeMethod::Post, format!("/terminal/configurations/{configuration}")) + .form(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -211,6 +373,44 @@ pub enum UpdateTerminalConfigurationReturned { TerminalConfiguration(stripe_terminal::TerminalConfiguration), DeletedTerminalConfiguration(stripe_terminal::DeletedTerminalConfiguration), } +/// Deletes a `Configuration` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteTerminalConfiguration<'a> { + configuration: &'a stripe_terminal::TerminalConfigurationId, +} +impl<'a> DeleteTerminalConfiguration<'a> { + pub fn new(configuration: &'a stripe_terminal::TerminalConfigurationId) -> Self { + Self { configuration } + } +} +impl DeleteTerminalConfiguration<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteTerminalConfiguration<'_> { + type Output = stripe_terminal::DeletedTerminalConfiguration; + + fn build(&self) -> RequestBuilder { + let configuration = self.configuration; + RequestBuilder::new( + StripeMethod::Delete, + format!("/terminal/configurations/{configuration}"), + ) + } +} + #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct Offline { /// Determines whether to allow transactions to be collected while reader is offline. diff --git a/generated/stripe_terminal/src/terminal_connection_token/requests.rs b/generated/stripe_terminal/src/terminal_connection_token/requests.rs index f3e002140..651b69eb6 100644 --- a/generated/stripe_terminal/src/terminal_connection_token/requests.rs +++ b/generated/stripe_terminal/src/terminal_connection_token/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConnectionToken<'a> { +pub struct CreateTerminalConnectionTokenBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -10,18 +14,51 @@ pub struct CreateTerminalConnectionToken<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub location: Option<&'a str>, } -impl<'a> CreateTerminalConnectionToken<'a> { +impl<'a> CreateTerminalConnectionTokenBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. +/// On your backend, add an endpoint that creates and returns a connection token. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTerminalConnectionToken<'a> { + inner: CreateTerminalConnectionTokenBuilder<'a>, +} impl<'a> CreateTerminalConnectionToken<'a> { - /// To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. - /// On your backend, add an endpoint that creates and returns a connection token. - pub fn send( + pub fn new() -> Self { + Self { inner: CreateTerminalConnectionTokenBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn location(mut self, location: &'a str) -> Self { + self.inner.location = Some(location); + self + } +} +impl CreateTerminalConnectionToken<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/terminal/connection_tokens", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTerminalConnectionToken<'_> { + type Output = stripe_terminal::TerminalConnectionToken; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/terminal/connection_tokens").form(&self.inner) } } diff --git a/generated/stripe_terminal/src/terminal_location/requests.rs b/generated/stripe_terminal/src/terminal_location/requests.rs index 137fb10ce..18866578e 100644 --- a/generated/stripe_terminal/src/terminal_location/requests.rs +++ b/generated/stripe_terminal/src/terminal_location/requests.rs @@ -1,82 +1,56 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteTerminalLocation {} -impl DeleteTerminalLocation { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteTerminalLocation { - /// Deletes a `Location` object. - pub fn send( - &self, - client: &stripe::Client, - location: &stripe_terminal::TerminalLocationId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/locations/{location}"), - self, - http_types::Method::Delete, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTerminalLocation<'a> { - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct RetrieveTerminalLocationBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, } -impl<'a> ListTerminalLocation<'a> { +impl<'a> RetrieveTerminalLocationBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListTerminalLocation<'a> { - /// Returns a list of `Location` objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/terminal/locations", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/terminal/locations", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +/// Retrieves a `Location` object. +#[derive(Clone, Debug, serde::Serialize)] pub struct RetrieveTerminalLocation<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + inner: RetrieveTerminalLocationBuilder<'a>, + location: &'a stripe_terminal::TerminalLocationId, } impl<'a> RetrieveTerminalLocation<'a> { - pub fn new() -> Self { - Self::default() + pub fn new(location: &'a stripe_terminal::TerminalLocationId) -> Self { + Self { location, inner: RetrieveTerminalLocationBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> RetrieveTerminalLocation<'a> { - /// Retrieves a `Location` object. - pub fn send( +impl RetrieveTerminalLocation<'_> { + pub async fn send( &self, - client: &stripe::Client, - location: &stripe_terminal::TerminalLocationId, - ) -> stripe::Response { - client.get_query(&format!("/terminal/locations/{location}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTerminalLocation<'_> { + type Output = RetrieveTerminalLocationReturned; + + fn build(&self) -> RequestBuilder { + let location = self.location; + RequestBuilder::new(StripeMethod::Get, format!("/terminal/locations/{location}")) + .query(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -86,9 +60,9 @@ pub enum RetrieveTerminalLocationReturned { DeletedTerminalLocation(stripe_terminal::DeletedTerminalLocation), } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTerminalLocation<'a> { +pub struct CreateTerminalLocationBuilder<'a> { /// The full address of the location. - pub address: CreateTerminalLocationAddress<'a>, + pub address: CreateTerminalLocationBuilderAddress<'a>, /// The ID of a configuration that will be used to customize all readers in this location. #[serde(skip_serializing_if = "Option::is_none")] pub configuration_overrides: Option<&'a str>, @@ -104,14 +78,14 @@ pub struct CreateTerminalLocation<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> CreateTerminalLocation<'a> { - pub fn new(address: CreateTerminalLocationAddress<'a>, display_name: &'a str) -> Self { +impl<'a> CreateTerminalLocationBuilder<'a> { + pub fn new(address: CreateTerminalLocationBuilderAddress<'a>, display_name: &'a str) -> Self { Self { address, configuration_overrides: None, display_name, expand: None, metadata: None } } } /// The full address of the location. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTerminalLocationAddress<'a> { +pub struct CreateTerminalLocationBuilderAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -130,26 +104,64 @@ pub struct CreateTerminalLocationAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateTerminalLocationAddress<'a> { +impl<'a> CreateTerminalLocationBuilderAddress<'a> { pub fn new(country: &'a str) -> Self { Self { city: None, country, line1: None, line2: None, postal_code: None, state: None } } } +/// Creates a new `Location` object. +/// For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTerminalLocation<'a> { + inner: CreateTerminalLocationBuilder<'a>, +} impl<'a> CreateTerminalLocation<'a> { - /// Creates a new `Location` object. - /// For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide. - pub fn send( + pub fn new(address: CreateTerminalLocationBuilderAddress<'a>, display_name: &'a str) -> Self { + Self { inner: CreateTerminalLocationBuilder::new(address, display_name) } + } + pub fn configuration_overrides(mut self, configuration_overrides: &'a str) -> Self { + self.inner.configuration_overrides = Some(configuration_overrides); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateTerminalLocation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/terminal/locations", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTerminalLocation<'_> { + type Output = stripe_terminal::TerminalLocation; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/terminal/locations").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalLocation<'a> { +pub struct UpdateTerminalLocationBuilder<'a> { /// The full address of the location. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The ID of a configuration that will be used to customize all readers in this location. #[serde(skip_serializing_if = "Option::is_none")] pub configuration_overrides: Option<&'a str>, @@ -166,14 +178,14 @@ pub struct UpdateTerminalLocation<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> UpdateTerminalLocation<'a> { +impl<'a> UpdateTerminalLocationBuilder<'a> { pub fn new() -> Self { Self::default() } } /// The full address of the location. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalLocationAddress<'a> { +pub struct UpdateTerminalLocationBuilderAddress<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -193,20 +205,70 @@ pub struct UpdateTerminalLocationAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> UpdateTerminalLocationAddress<'a> { +impl<'a> UpdateTerminalLocationBuilderAddress<'a> { pub fn new() -> Self { Self::default() } } +/// Updates a `Location` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTerminalLocation<'a> { + inner: UpdateTerminalLocationBuilder<'a>, + location: &'a stripe_terminal::TerminalLocationId, +} impl<'a> UpdateTerminalLocation<'a> { - /// Updates a `Location` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( + pub fn new(location: &'a stripe_terminal::TerminalLocationId) -> Self { + Self { location, inner: UpdateTerminalLocationBuilder::new() } + } + pub fn address(mut self, address: UpdateTerminalLocationBuilderAddress<'a>) -> Self { + self.inner.address = Some(address); + self + } + + pub fn configuration_overrides(mut self, configuration_overrides: &'a str) -> Self { + self.inner.configuration_overrides = Some(configuration_overrides); + self + } + + pub fn display_name(mut self, display_name: &'a str) -> Self { + self.inner.display_name = Some(display_name); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateTerminalLocation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - location: &stripe_terminal::TerminalLocationId, - ) -> stripe::Response { - client.send_form(&format!("/terminal/locations/{location}"), self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTerminalLocation<'_> { + type Output = UpdateTerminalLocationReturned; + + fn build(&self) -> RequestBuilder { + let location = self.location; + RequestBuilder::new(StripeMethod::Post, format!("/terminal/locations/{location}")) + .form(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -215,3 +277,114 @@ pub enum UpdateTerminalLocationReturned { TerminalLocation(stripe_terminal::TerminalLocation), DeletedTerminalLocation(stripe_terminal::DeletedTerminalLocation), } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListTerminalLocationBuilder<'a> { + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListTerminalLocationBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of `Location` objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTerminalLocation<'a> { + inner: ListTerminalLocationBuilder<'a>, +} +impl<'a> ListTerminalLocation<'a> { + pub fn new() -> Self { + Self { inner: ListTerminalLocationBuilder::new() } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTerminalLocation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTerminalLocation<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/terminal/locations").query(&self.inner) + } +} +/// Deletes a `Location` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteTerminalLocation<'a> { + location: &'a stripe_terminal::TerminalLocationId, +} +impl<'a> DeleteTerminalLocation<'a> { + pub fn new(location: &'a stripe_terminal::TerminalLocationId) -> Self { + Self { location } + } +} +impl DeleteTerminalLocation<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteTerminalLocation<'_> { + type Output = stripe_terminal::DeletedTerminalLocation; + + fn build(&self) -> RequestBuilder { + let location = self.location; + RequestBuilder::new(StripeMethod::Delete, format!("/terminal/locations/{location}")) + } +} diff --git a/generated/stripe_terminal/src/terminal_reader/requests.rs b/generated/stripe_terminal/src/terminal_reader/requests.rs index 97b961716..a1886751b 100644 --- a/generated/stripe_terminal/src/terminal_reader/requests.rs +++ b/generated/stripe_terminal/src/terminal_reader/requests.rs @@ -1,90 +1,133 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteTerminalReader {} -impl DeleteTerminalReader { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteTerminalReader { - /// Deletes a `Reader` object. - pub fn send( - &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form(&format!("/terminal/readers/{reader}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTerminalReader<'a> { - /// Filters readers by device type - #[serde(skip_serializing_if = "Option::is_none")] - pub device_type: Option, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, +pub struct UpdateTerminalReaderBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A location ID to filter the response list to only readers at the specific location - #[serde(skip_serializing_if = "Option::is_none")] - pub location: Option<&'a str>, - /// Filters readers by serial number - #[serde(skip_serializing_if = "Option::is_none")] - pub serial_number: Option<&'a str>, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + /// The new label of the reader. #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// A status filter to filter readers to only offline or online readers + pub label: Option<&'a str>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub metadata: Option<&'a std::collections::HashMap>, } -impl<'a> ListTerminalReader<'a> { +impl<'a> UpdateTerminalReaderBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> ListTerminalReader<'a> { - /// Returns a list of `Reader` objects. - pub fn send( +/// Updates a `Reader` object by setting the values of the parameters passed. +/// Any parameters not provided will be left unchanged. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTerminalReader<'a> { + inner: UpdateTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} +impl<'a> UpdateTerminalReader<'a> { + pub fn new(reader: &'a stripe_terminal::TerminalReaderId) -> Self { + Self { reader, inner: UpdateTerminalReaderBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn label(mut self, label: &'a str) -> Self { + self.inner.label = Some(label); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl UpdateTerminalReader<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/terminal/readers", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/terminal/readers", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } + +impl StripeRequest for UpdateTerminalReader<'_> { + type Output = UpdateTerminalReaderReturned; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new(StripeMethod::Post, format!("/terminal/readers/{reader}")) + .form(&self.inner) + } +} +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum UpdateTerminalReaderReturned { + TerminalReader(stripe_terminal::TerminalReader), + DeletedTerminalReader(stripe_terminal::DeletedTerminalReader), +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTerminalReader<'a> { +pub struct RetrieveTerminalReaderBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTerminalReader<'a> { +impl<'a> RetrieveTerminalReaderBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves a `Reader` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTerminalReader<'a> { + inner: RetrieveTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} impl<'a> RetrieveTerminalReader<'a> { - /// Retrieves a `Reader` object. - pub fn send( + pub fn new(reader: &'a stripe_terminal::TerminalReaderId) -> Self { + Self { reader, inner: RetrieveTerminalReaderBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.get_query(&format!("/terminal/readers/{reader}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTerminalReader<'_> { + type Output = RetrieveTerminalReaderReturned; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new(StripeMethod::Get, format!("/terminal/readers/{reader}")) + .query(&self.inner) } } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] @@ -94,7 +137,7 @@ pub enum RetrieveTerminalReaderReturned { DeletedTerminalReader(stripe_terminal::DeletedTerminalReader), } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTerminalReader<'a> { +pub struct CreateTerminalReaderBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -114,84 +157,254 @@ pub struct CreateTerminalReader<'a> { /// A code generated by the reader used for registering to an account. pub registration_code: &'a str, } -impl<'a> CreateTerminalReader<'a> { +impl<'a> CreateTerminalReaderBuilder<'a> { pub fn new(registration_code: &'a str) -> Self { Self { expand: None, label: None, location: None, metadata: None, registration_code } } } +/// Creates a new `Reader` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTerminalReader<'a> { + inner: CreateTerminalReaderBuilder<'a>, +} impl<'a> CreateTerminalReader<'a> { - /// Creates a new `Reader` object. - pub fn send( + pub fn new(registration_code: &'a str) -> Self { + Self { inner: CreateTerminalReaderBuilder::new(registration_code) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn label(mut self, label: &'a str) -> Self { + self.inner.label = Some(label); + self + } + + pub fn location(mut self, location: &'a str) -> Self { + self.inner.location = Some(location); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/terminal/readers", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/terminal/readers").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalReader<'a> { +pub struct ListTerminalReaderBuilder<'a> { + /// Filters readers by device type + #[serde(skip_serializing_if = "Option::is_none")] + pub device_type: Option, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// The new label of the reader. + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. #[serde(skip_serializing_if = "Option::is_none")] - pub label: Option<&'a str>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. + pub limit: Option, + /// A location ID to filter the response list to only readers at the specific location #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, + pub location: Option<&'a str>, + /// Filters readers by serial number + #[serde(skip_serializing_if = "Option::is_none")] + pub serial_number: Option<&'a str>, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// A status filter to filter readers to only offline or online readers + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, } -impl<'a> UpdateTerminalReader<'a> { +impl<'a> ListTerminalReaderBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdateTerminalReader<'a> { - /// Updates a `Reader` object by setting the values of the parameters passed. - /// Any parameters not provided will be left unchanged. - pub fn send( - &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form(&format!("/terminal/readers/{reader}"), self, http_types::Method::Post) +/// A status filter to filter readers to only offline or online readers +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum ListTerminalReaderBuilderStatus { + Offline, + Online, +} +impl ListTerminalReaderBuilderStatus { + pub fn as_str(self) -> &'static str { + use ListTerminalReaderBuilderStatus::*; + match self { + Offline => "offline", + Online => "online", + } } } -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(untagged)] -pub enum UpdateTerminalReaderReturned { - TerminalReader(stripe_terminal::TerminalReader), - DeletedTerminalReader(stripe_terminal::DeletedTerminalReader), + +impl std::str::FromStr for ListTerminalReaderBuilderStatus { + type Err = (); + fn from_str(s: &str) -> Result { + use ListTerminalReaderBuilderStatus::*; + match s { + "offline" => Ok(Offline), + "online" => Ok(Online), + _ => Err(()), + } + } } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelActionTerminalReader<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, +impl std::fmt::Display for ListTerminalReaderBuilderStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } } -impl<'a> CancelActionTerminalReader<'a> { + +impl std::fmt::Debug for ListTerminalReaderBuilderStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for ListTerminalReaderBuilderStatus { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Returns a list of `Reader` objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTerminalReader<'a> { + inner: ListTerminalReaderBuilder<'a>, +} +impl<'a> ListTerminalReader<'a> { pub fn new() -> Self { - Self::default() + Self { inner: ListTerminalReaderBuilder::new() } + } + pub fn device_type(mut self, device_type: stripe_terminal::TerminalReaderDeviceType) -> Self { + self.inner.device_type = Some(device_type); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn location(mut self, location: &'a str) -> Self { + self.inner.location = Some(location); + self + } + + pub fn serial_number(mut self, serial_number: &'a str) -> Self { + self.inner.serial_number = Some(serial_number); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: ListTerminalReaderBuilderStatus) -> Self { + self.inner.status = Some(status); + self } } -impl<'a> CancelActionTerminalReader<'a> { - /// Cancels the current reader action. - pub fn send( +impl ListTerminalReader<'_> { + pub async fn send( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/readers/{reader}/cancel_action"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTerminalReader<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/terminal/readers").query(&self.inner) + } +} +/// Deletes a `Reader` object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct DeleteTerminalReader<'a> { + reader: &'a stripe_terminal::TerminalReaderId, +} +impl<'a> DeleteTerminalReader<'a> { + pub fn new(reader: &'a stripe_terminal::TerminalReaderId) -> Self { + Self { reader } + } +} +impl DeleteTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for DeleteTerminalReader<'_> { + type Output = stripe_terminal::DeletedTerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new(StripeMethod::Delete, format!("/terminal/readers/{reader}")) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ProcessPaymentIntentTerminalReader<'a> { +pub struct ProcessPaymentIntentTerminalReaderBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -199,57 +412,94 @@ pub struct ProcessPaymentIntentTerminalReader<'a> { pub payment_intent: &'a str, /// Configuration overrides #[serde(skip_serializing_if = "Option::is_none")] - pub process_config: Option, + pub process_config: Option, } -impl<'a> ProcessPaymentIntentTerminalReader<'a> { +impl<'a> ProcessPaymentIntentTerminalReaderBuilder<'a> { pub fn new(payment_intent: &'a str) -> Self { Self { expand: None, payment_intent, process_config: None } } } /// Configuration overrides #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ProcessPaymentIntentTerminalReaderProcessConfig { +pub struct ProcessPaymentIntentTerminalReaderBuilderProcessConfig { /// Override showing a tipping selection screen on this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub skip_tipping: Option, /// Tipping configuration for this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub tipping: Option, + pub tipping: Option, } -impl ProcessPaymentIntentTerminalReaderProcessConfig { +impl ProcessPaymentIntentTerminalReaderBuilderProcessConfig { pub fn new() -> Self { Self::default() } } /// Tipping configuration for this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ProcessPaymentIntentTerminalReaderProcessConfigTipping { +pub struct ProcessPaymentIntentTerminalReaderBuilderProcessConfigTipping { /// Amount used to calculate tip suggestions on tipping selection screen for this transaction. /// Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency). #[serde(skip_serializing_if = "Option::is_none")] pub amount_eligible: Option, } -impl ProcessPaymentIntentTerminalReaderProcessConfigTipping { +impl ProcessPaymentIntentTerminalReaderBuilderProcessConfigTipping { pub fn new() -> Self { Self::default() } } +/// Initiates a payment flow on a Reader. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ProcessPaymentIntentTerminalReader<'a> { + inner: ProcessPaymentIntentTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} impl<'a> ProcessPaymentIntentTerminalReader<'a> { - /// Initiates a payment flow on a Reader. - pub fn send( + pub fn new(reader: &'a stripe_terminal::TerminalReaderId, payment_intent: &'a str) -> Self { + Self { reader, inner: ProcessPaymentIntentTerminalReaderBuilder::new(payment_intent) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn process_config( + mut self, + process_config: ProcessPaymentIntentTerminalReaderBuilderProcessConfig, + ) -> Self { + self.inner.process_config = Some(process_config); + self + } +} +impl ProcessPaymentIntentTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/readers/{reader}/process_payment_intent"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ProcessPaymentIntentTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new( + StripeMethod::Post, + format!("/terminal/readers/{reader}/process_payment_intent"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ProcessSetupIntentTerminalReader<'a> { +pub struct ProcessSetupIntentTerminalReaderBuilder<'a> { /// Customer Consent Collected pub customer_consent_collected: bool, /// Specifies which fields in the response should be expanded. @@ -261,111 +511,155 @@ pub struct ProcessSetupIntentTerminalReader<'a> { /// SetupIntent ID pub setup_intent: &'a str, } -impl<'a> ProcessSetupIntentTerminalReader<'a> { +impl<'a> ProcessSetupIntentTerminalReaderBuilder<'a> { pub fn new(customer_consent_collected: bool, setup_intent: &'a str) -> Self { Self { customer_consent_collected, expand: None, process_config: None, setup_intent } } } +/// Initiates a setup intent flow on a Reader. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ProcessSetupIntentTerminalReader<'a> { + inner: ProcessSetupIntentTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} impl<'a> ProcessSetupIntentTerminalReader<'a> { - /// Initiates a setup intent flow on a Reader. - pub fn send( + pub fn new( + reader: &'a stripe_terminal::TerminalReaderId, + customer_consent_collected: bool, + setup_intent: &'a str, + ) -> Self { + Self { + reader, + inner: ProcessSetupIntentTerminalReaderBuilder::new( + customer_consent_collected, + setup_intent, + ), + } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn process_config(mut self, process_config: &'a serde_json::Value) -> Self { + self.inner.process_config = Some(process_config); + self + } +} +impl ProcessSetupIntentTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/readers/{reader}/process_setup_intent"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ProcessSetupIntentTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new( + StripeMethod::Post, + format!("/terminal/readers/{reader}/process_setup_intent"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RefundPaymentTerminalReader<'a> { - /// A positive integer in __cents__ representing how much of this charge to refund. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// ID of the Charge to refund. - #[serde(skip_serializing_if = "Option::is_none")] - pub charge: Option<&'a str>, +pub struct CancelActionTerminalReaderBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// ID of the PaymentIntent to refund. - #[serde(skip_serializing_if = "Option::is_none")] - pub payment_intent: Option<&'a str>, - /// Boolean indicating whether the application fee should be refunded when refunding this charge. - /// If a full charge refund is given, the full application fee will be refunded. - /// Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. - /// An application fee can be refunded only by the application that created the charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub refund_application_fee: Option, - /// Boolean indicating whether the transfer should be reversed when refunding this charge. - /// The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount). - /// A transfer can be reversed only by the application that created the charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub reverse_transfer: Option, } -impl<'a> RefundPaymentTerminalReader<'a> { +impl<'a> CancelActionTerminalReaderBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RefundPaymentTerminalReader<'a> { - /// Initiates a refund on a Reader - pub fn send( +/// Cancels the current reader action. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelActionTerminalReader<'a> { + inner: CancelActionTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} +impl<'a> CancelActionTerminalReader<'a> { + pub fn new(reader: &'a stripe_terminal::TerminalReaderId) -> Self { + Self { reader, inner: CancelActionTerminalReaderBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelActionTerminalReader<'_> { + pub async fn send( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/readers/{reader}/refund_payment"), - self, - http_types::Method::Post, - ) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelActionTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new(StripeMethod::Post, format!("/terminal/readers/{reader}/cancel_action")) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SetReaderDisplayTerminalReader<'a> { +pub struct SetReaderDisplayTerminalReaderBuilder<'a> { /// Cart #[serde(skip_serializing_if = "Option::is_none")] - pub cart: Option>, + pub cart: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Type #[serde(rename = "type")] - pub type_: SetReaderDisplayTerminalReaderType, + pub type_: SetReaderDisplayTerminalReaderBuilderType, } -impl<'a> SetReaderDisplayTerminalReader<'a> { - pub fn new(type_: SetReaderDisplayTerminalReaderType) -> Self { +impl<'a> SetReaderDisplayTerminalReaderBuilder<'a> { + pub fn new(type_: SetReaderDisplayTerminalReaderBuilderType) -> Self { Self { cart: None, expand: None, type_ } } } /// Cart #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SetReaderDisplayTerminalReaderCart<'a> { +pub struct SetReaderDisplayTerminalReaderBuilderCart<'a> { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. /// Must be a [supported currency](https://stripe.com/docs/currencies). pub currency: stripe_types::Currency, /// Array of line items that were purchased. - pub line_items: &'a [SetReaderDisplayTerminalReaderCartLineItems<'a>], + pub line_items: &'a [SetReaderDisplayTerminalReaderBuilderCartLineItems<'a>], /// The amount of tax in cents. #[serde(skip_serializing_if = "Option::is_none")] pub tax: Option, /// Total balance of cart due in cents. pub total: i64, } -impl<'a> SetReaderDisplayTerminalReaderCart<'a> { +impl<'a> SetReaderDisplayTerminalReaderBuilderCart<'a> { pub fn new( currency: stripe_types::Currency, - line_items: &'a [SetReaderDisplayTerminalReaderCartLineItems<'a>], + line_items: &'a [SetReaderDisplayTerminalReaderBuilderCartLineItems<'a>], total: i64, ) -> Self { Self { currency, line_items, tax: None, total } @@ -373,7 +667,7 @@ impl<'a> SetReaderDisplayTerminalReaderCart<'a> { } /// Array of line items that were purchased. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct SetReaderDisplayTerminalReaderCartLineItems<'a> { +pub struct SetReaderDisplayTerminalReaderBuilderCartLineItems<'a> { /// The price of the item in cents. pub amount: i64, /// The description or name of the item. @@ -381,47 +675,47 @@ pub struct SetReaderDisplayTerminalReaderCartLineItems<'a> { /// The quantity of the line item being purchased. pub quantity: u64, } -impl<'a> SetReaderDisplayTerminalReaderCartLineItems<'a> { +impl<'a> SetReaderDisplayTerminalReaderBuilderCartLineItems<'a> { pub fn new(amount: i64, description: &'a str, quantity: u64) -> Self { Self { amount, description, quantity } } } /// Type #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SetReaderDisplayTerminalReaderType { +pub enum SetReaderDisplayTerminalReaderBuilderType { Cart, } -impl SetReaderDisplayTerminalReaderType { +impl SetReaderDisplayTerminalReaderBuilderType { pub fn as_str(self) -> &'static str { - use SetReaderDisplayTerminalReaderType::*; + use SetReaderDisplayTerminalReaderBuilderType::*; match self { Cart => "cart", } } } -impl std::str::FromStr for SetReaderDisplayTerminalReaderType { +impl std::str::FromStr for SetReaderDisplayTerminalReaderBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use SetReaderDisplayTerminalReaderType::*; + use SetReaderDisplayTerminalReaderBuilderType::*; match s { "cart" => Ok(Cart), _ => Err(()), } } } -impl std::fmt::Display for SetReaderDisplayTerminalReaderType { +impl std::fmt::Display for SetReaderDisplayTerminalReaderBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SetReaderDisplayTerminalReaderType { +impl std::fmt::Debug for SetReaderDisplayTerminalReaderBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SetReaderDisplayTerminalReaderType { +impl serde::Serialize for SetReaderDisplayTerminalReaderBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -429,77 +723,224 @@ impl serde::Serialize for SetReaderDisplayTerminalReaderType { serializer.serialize_str(self.as_str()) } } +/// Sets reader display to show cart details. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SetReaderDisplayTerminalReader<'a> { + inner: SetReaderDisplayTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} impl<'a> SetReaderDisplayTerminalReader<'a> { - /// Sets reader display to show cart details. - pub fn send( + pub fn new( + reader: &'a stripe_terminal::TerminalReaderId, + type_: SetReaderDisplayTerminalReaderBuilderType, + ) -> Self { + Self { reader, inner: SetReaderDisplayTerminalReaderBuilder::new(type_) } + } + pub fn cart(mut self, cart: SetReaderDisplayTerminalReaderBuilderCart<'a>) -> Self { + self.inner.cart = Some(cart); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl SetReaderDisplayTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - reader: &stripe_terminal::TerminalReaderId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/readers/{reader}/set_reader_display"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SetReaderDisplayTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new( + StripeMethod::Post, + format!("/terminal/readers/{reader}/set_reader_display"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PresentPaymentMethodTerminalReader<'a> { +pub struct RefundPaymentTerminalReaderBuilder<'a> { + /// A positive integer in __cents__ representing how much of this charge to refund. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// ID of the Charge to refund. + #[serde(skip_serializing_if = "Option::is_none")] + pub charge: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// ID of the PaymentIntent to refund. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_intent: Option<&'a str>, + /// Boolean indicating whether the application fee should be refunded when refunding this charge. + /// If a full charge refund is given, the full application fee will be refunded. + /// Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. + /// An application fee can be refunded only by the application that created the charge. + #[serde(skip_serializing_if = "Option::is_none")] + pub refund_application_fee: Option, + /// Boolean indicating whether the transfer should be reversed when refunding this charge. + /// The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount). + /// A transfer can be reversed only by the application that created the charge. + #[serde(skip_serializing_if = "Option::is_none")] + pub reverse_transfer: Option, +} +impl<'a> RefundPaymentTerminalReaderBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Initiates a refund on a Reader +#[derive(Clone, Debug, serde::Serialize)] +pub struct RefundPaymentTerminalReader<'a> { + inner: RefundPaymentTerminalReaderBuilder<'a>, + reader: &'a stripe_terminal::TerminalReaderId, +} +impl<'a> RefundPaymentTerminalReader<'a> { + pub fn new(reader: &'a stripe_terminal::TerminalReaderId) -> Self { + Self { reader, inner: RefundPaymentTerminalReaderBuilder::new() } + } + pub fn amount(mut self, amount: i64) -> Self { + self.inner.amount = Some(amount); + self + } + + pub fn charge(mut self, charge: &'a str) -> Self { + self.inner.charge = Some(charge); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn payment_intent(mut self, payment_intent: &'a str) -> Self { + self.inner.payment_intent = Some(payment_intent); + self + } + + pub fn refund_application_fee(mut self, refund_application_fee: bool) -> Self { + self.inner.refund_application_fee = Some(refund_application_fee); + self + } + + pub fn reverse_transfer(mut self, reverse_transfer: bool) -> Self { + self.inner.reverse_transfer = Some(reverse_transfer); + self + } +} +impl RefundPaymentTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RefundPaymentTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new( + StripeMethod::Post, + format!("/terminal/readers/{reader}/refund_payment"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PresentPaymentMethodTerminalReaderBuilder<'a> { /// Simulated on-reader tip amount. #[serde(skip_serializing_if = "Option::is_none")] pub amount_tip: Option, /// Simulated data for the card_present payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub card_present: Option>, + pub card_present: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Simulated data for the interac_present payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub interac_present: Option>, + pub interac_present: Option>, /// Simulated payment type. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -impl<'a> PresentPaymentMethodTerminalReader<'a> { +impl<'a> PresentPaymentMethodTerminalReaderBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Simulated data for the card_present payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PresentPaymentMethodTerminalReaderCardPresent<'a> { +pub struct PresentPaymentMethodTerminalReaderBuilderCardPresent<'a> { /// The card number, as a string without any separators. #[serde(skip_serializing_if = "Option::is_none")] pub number: Option<&'a str>, } -impl<'a> PresentPaymentMethodTerminalReaderCardPresent<'a> { +impl<'a> PresentPaymentMethodTerminalReaderBuilderCardPresent<'a> { pub fn new() -> Self { Self::default() } } /// Simulated data for the interac_present payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PresentPaymentMethodTerminalReaderInteracPresent<'a> { +pub struct PresentPaymentMethodTerminalReaderBuilderInteracPresent<'a> { /// Card Number #[serde(skip_serializing_if = "Option::is_none")] pub number: Option<&'a str>, } -impl<'a> PresentPaymentMethodTerminalReaderInteracPresent<'a> { +impl<'a> PresentPaymentMethodTerminalReaderBuilderInteracPresent<'a> { pub fn new() -> Self { Self::default() } } /// Simulated payment type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PresentPaymentMethodTerminalReaderType { +pub enum PresentPaymentMethodTerminalReaderBuilderType { CardPresent, InteracPresent, } -impl PresentPaymentMethodTerminalReaderType { +impl PresentPaymentMethodTerminalReaderBuilderType { pub fn as_str(self) -> &'static str { - use PresentPaymentMethodTerminalReaderType::*; + use PresentPaymentMethodTerminalReaderBuilderType::*; match self { CardPresent => "card_present", InteracPresent => "interac_present", @@ -507,10 +948,10 @@ impl PresentPaymentMethodTerminalReaderType { } } -impl std::str::FromStr for PresentPaymentMethodTerminalReaderType { +impl std::str::FromStr for PresentPaymentMethodTerminalReaderBuilderType { type Err = (); fn from_str(s: &str) -> Result { - use PresentPaymentMethodTerminalReaderType::*; + use PresentPaymentMethodTerminalReaderBuilderType::*; match s { "card_present" => Ok(CardPresent), "interac_present" => Ok(InteracPresent), @@ -518,18 +959,18 @@ impl std::str::FromStr for PresentPaymentMethodTerminalReaderType { } } } -impl std::fmt::Display for PresentPaymentMethodTerminalReaderType { +impl std::fmt::Display for PresentPaymentMethodTerminalReaderBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PresentPaymentMethodTerminalReaderType { +impl std::fmt::Debug for PresentPaymentMethodTerminalReaderBuilderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PresentPaymentMethodTerminalReaderType { +impl serde::Serialize for PresentPaymentMethodTerminalReaderBuilderType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -537,18 +978,73 @@ impl serde::Serialize for PresentPaymentMethodTerminalReaderType { serializer.serialize_str(self.as_str()) } } +/// Presents a payment method on a simulated reader. +/// Can be used to simulate accepting a payment, saving a card or refunding a transaction. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PresentPaymentMethodTerminalReader<'a> { + inner: PresentPaymentMethodTerminalReaderBuilder<'a>, + reader: &'a str, +} impl<'a> PresentPaymentMethodTerminalReader<'a> { - /// Presents a payment method on a simulated reader. - /// Can be used to simulate accepting a payment, saving a card or refunding a transaction. - pub fn send( + pub fn new(reader: &'a str) -> Self { + Self { reader, inner: PresentPaymentMethodTerminalReaderBuilder::new() } + } + pub fn amount_tip(mut self, amount_tip: i64) -> Self { + self.inner.amount_tip = Some(amount_tip); + self + } + + pub fn card_present( + mut self, + card_present: PresentPaymentMethodTerminalReaderBuilderCardPresent<'a>, + ) -> Self { + self.inner.card_present = Some(card_present); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn interac_present( + mut self, + interac_present: PresentPaymentMethodTerminalReaderBuilderInteracPresent<'a>, + ) -> Self { + self.inner.interac_present = Some(interac_present); + self + } + + pub fn type_(mut self, type_: PresentPaymentMethodTerminalReaderBuilderType) -> Self { + self.inner.type_ = Some(type_); + self + } +} +impl PresentPaymentMethodTerminalReader<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - reader: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/terminal/readers/{reader}/present_payment_method"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for PresentPaymentMethodTerminalReader<'_> { + type Output = stripe_terminal::TerminalReader; + + fn build(&self) -> RequestBuilder { + let reader = self.reader; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/terminal/readers/{reader}/present_payment_method"), ) + .form(&self.inner) } } diff --git a/generated/stripe_terminal/src/terminal_reader/types.rs b/generated/stripe_terminal/src/terminal_reader/types.rs index 8f2edbcd7..016f5ece8 100644 --- a/generated/stripe_terminal/src/terminal_reader/types.rs +++ b/generated/stripe_terminal/src/terminal_reader/types.rs @@ -27,7 +27,7 @@ pub struct TerminalReader { /// Serial number of the reader. pub serial_number: String, /// The networking status of the reader. - pub status: Option, + pub status: Option, } impl stripe_types::Object for TerminalReader { type Id = stripe_terminal::TerminalReaderId; @@ -101,56 +101,3 @@ impl<'de> serde::Deserialize<'de> for TerminalReaderDeviceType { .map_err(|_| serde::de::Error::custom("Unknown value for TerminalReaderDeviceType")) } } -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum TerminalReaderStatus { - Offline, - Online, -} -impl TerminalReaderStatus { - pub fn as_str(self) -> &'static str { - use TerminalReaderStatus::*; - match self { - Offline => "offline", - Online => "online", - } - } -} - -impl std::str::FromStr for TerminalReaderStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use TerminalReaderStatus::*; - match s { - "offline" => Ok(Offline), - "online" => Ok(Online), - _ => Err(()), - } - } -} -impl std::fmt::Display for TerminalReaderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for TerminalReaderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for TerminalReaderStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for TerminalReaderStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for TerminalReaderStatus")) - } -} diff --git a/generated/stripe_treasury/Cargo.toml b/generated/stripe_treasury/Cargo.toml index 7595a426f..081f30f47 100644 --- a/generated/stripe_treasury/Cargo.toml +++ b/generated/stripe_treasury/Cargo.toml @@ -19,23 +19,12 @@ serde.workspace = true smol_str.workspace = true serde_json.workspace = true stripe_types = {path = "../../stripe_types"} - -http-types.workspace = true -async-stripe = {path = "../../async-stripe"} - +stripe_client_core = {path = "../../stripe_client_core"} stripe_shared = {path = "../../generated/stripe_shared"} [features] -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki"] -runtime-blocking = ["async-stripe/runtime-blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf"] - treasury_credit_reversal = [] treasury_debit_reversal = [] treasury_financial_account = [] @@ -60,5 +49,5 @@ full = ["treasury_credit_reversal", [package.metadata.docs.rs] -features = ["runtime-tokio-hyper", "full"] +features = ["full"] diff --git a/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs b/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs index dd64da691..b25b5ceb5 100644 --- a/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs +++ b/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryCreditReversal<'a> { +pub struct ListTreasuryCreditReversalBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -26,7 +30,7 @@ pub struct ListTreasuryCreditReversal<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListTreasuryCreditReversal<'a> { +impl<'a> ListTreasuryCreditReversalBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -39,43 +43,124 @@ impl<'a> ListTreasuryCreditReversal<'a> { } } } +/// Returns a list of CreditReversals. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryCreditReversal<'a> { + inner: ListTreasuryCreditReversalBuilder<'a>, +} impl<'a> ListTreasuryCreditReversal<'a> { - /// Returns a list of CreditReversals. - pub fn send( + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryCreditReversalBuilder::new(financial_account) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn received_credit(mut self, received_credit: &'a str) -> Self { + self.inner.received_credit = Some(received_credit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryCreditReversalStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryCreditReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/credit_reversals", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/credit_reversals", self) +} + +impl StripeRequest for ListTreasuryCreditReversal<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/credit_reversals").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryCreditReversal<'a> { +pub struct RetrieveTreasuryCreditReversalBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTreasuryCreditReversal<'a> { +impl<'a> RetrieveTreasuryCreditReversalBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryCreditReversal<'a> { + inner: RetrieveTreasuryCreditReversalBuilder<'a>, + credit_reversal: &'a stripe_treasury::TreasuryCreditReversalId, +} impl<'a> RetrieveTreasuryCreditReversal<'a> { - /// Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list. - pub fn send( + pub fn new(credit_reversal: &'a stripe_treasury::TreasuryCreditReversalId) -> Self { + Self { credit_reversal, inner: RetrieveTreasuryCreditReversalBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryCreditReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - credit_reversal: &stripe_treasury::TreasuryCreditReversalId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/credit_reversals/{credit_reversal}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryCreditReversal<'_> { + type Output = stripe_treasury::TreasuryCreditReversal; + + fn build(&self) -> RequestBuilder { + let credit_reversal = self.credit_reversal; + RequestBuilder::new( + StripeMethod::Get, + format!("/treasury/credit_reversals/{credit_reversal}"), + ) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryCreditReversal<'a> { +pub struct CreateTreasuryCreditReversalBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -88,17 +173,50 @@ pub struct CreateTreasuryCreditReversal<'a> { /// The ReceivedCredit to reverse. pub received_credit: &'a str, } -impl<'a> CreateTreasuryCreditReversal<'a> { +impl<'a> CreateTreasuryCreditReversalBuilder<'a> { pub fn new(received_credit: &'a str) -> Self { Self { expand: None, metadata: None, received_credit } } } +/// Reverses a ReceivedCredit and creates a CreditReversal object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryCreditReversal<'a> { + inner: CreateTreasuryCreditReversalBuilder<'a>, +} impl<'a> CreateTreasuryCreditReversal<'a> { - /// Reverses a ReceivedCredit and creates a CreditReversal object. - pub fn send( + pub fn new(received_credit: &'a str) -> Self { + Self { inner: CreateTreasuryCreditReversalBuilder::new(received_credit) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateTreasuryCreditReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/credit_reversals", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryCreditReversal<'_> { + type Output = stripe_treasury::TreasuryCreditReversal; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/credit_reversals").form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_debit_reversal/requests.rs b/generated/stripe_treasury/src/treasury_debit_reversal/requests.rs index a02d734dd..bdafb3713 100644 --- a/generated/stripe_treasury/src/treasury_debit_reversal/requests.rs +++ b/generated/stripe_treasury/src/treasury_debit_reversal/requests.rs @@ -1,5 +1,124 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryDebitReversal<'a> { +pub struct CreateTreasuryDebitReversalBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The ReceivedDebit to reverse. + pub received_debit: &'a str, +} +impl<'a> CreateTreasuryDebitReversalBuilder<'a> { + pub fn new(received_debit: &'a str) -> Self { + Self { expand: None, metadata: None, received_debit } + } +} +/// Reverses a ReceivedDebit and creates a DebitReversal object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryDebitReversal<'a> { + inner: CreateTreasuryDebitReversalBuilder<'a>, +} +impl<'a> CreateTreasuryDebitReversal<'a> { + pub fn new(received_debit: &'a str) -> Self { + Self { inner: CreateTreasuryDebitReversalBuilder::new(received_debit) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } +} +impl CreateTreasuryDebitReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryDebitReversal<'_> { + type Output = stripe_treasury::TreasuryDebitReversal; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/debit_reversals").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryDebitReversalBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryDebitReversalBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves a DebitReversal object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryDebitReversal<'a> { + inner: RetrieveTreasuryDebitReversalBuilder<'a>, + debit_reversal: &'a stripe_treasury::TreasuryDebitReversalId, +} +impl<'a> RetrieveTreasuryDebitReversal<'a> { + pub fn new(debit_reversal: &'a stripe_treasury::TreasuryDebitReversalId) -> Self { + Self { debit_reversal, inner: RetrieveTreasuryDebitReversalBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryDebitReversal<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryDebitReversal<'_> { + type Output = stripe_treasury::TreasuryDebitReversal; + + fn build(&self) -> RequestBuilder { + let debit_reversal = self.debit_reversal; + RequestBuilder::new( + StripeMethod::Get, + format!("/treasury/debit_reversals/{debit_reversal}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ListTreasuryDebitReversalBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -19,7 +138,7 @@ pub struct ListTreasuryDebitReversal<'a> { pub received_debit: Option<&'a str>, /// Only return DebitReversals for a given resolution. #[serde(skip_serializing_if = "Option::is_none")] - pub resolution: Option, + pub resolution: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @@ -27,9 +146,9 @@ pub struct ListTreasuryDebitReversal<'a> { pub starting_after: Option<&'a str>, /// Only return DebitReversals for a given status. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } -impl<'a> ListTreasuryDebitReversal<'a> { +impl<'a> ListTreasuryDebitReversalBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -45,13 +164,13 @@ impl<'a> ListTreasuryDebitReversal<'a> { } /// Only return DebitReversals for a given resolution. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryDebitReversalResolution { +pub enum ListTreasuryDebitReversalBuilderResolution { Lost, Won, } -impl ListTreasuryDebitReversalResolution { +impl ListTreasuryDebitReversalBuilderResolution { pub fn as_str(self) -> &'static str { - use ListTreasuryDebitReversalResolution::*; + use ListTreasuryDebitReversalBuilderResolution::*; match self { Lost => "lost", Won => "won", @@ -59,10 +178,10 @@ impl ListTreasuryDebitReversalResolution { } } -impl std::str::FromStr for ListTreasuryDebitReversalResolution { +impl std::str::FromStr for ListTreasuryDebitReversalBuilderResolution { type Err = (); fn from_str(s: &str) -> Result { - use ListTreasuryDebitReversalResolution::*; + use ListTreasuryDebitReversalBuilderResolution::*; match s { "lost" => Ok(Lost), "won" => Ok(Won), @@ -70,18 +189,18 @@ impl std::str::FromStr for ListTreasuryDebitReversalResolution { } } } -impl std::fmt::Display for ListTreasuryDebitReversalResolution { +impl std::fmt::Display for ListTreasuryDebitReversalBuilderResolution { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTreasuryDebitReversalResolution { +impl std::fmt::Debug for ListTreasuryDebitReversalBuilderResolution { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTreasuryDebitReversalResolution { +impl serde::Serialize for ListTreasuryDebitReversalBuilderResolution { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -91,14 +210,14 @@ impl serde::Serialize for ListTreasuryDebitReversalResolution { } /// Only return DebitReversals for a given status. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryDebitReversalStatus { +pub enum ListTreasuryDebitReversalBuilderStatus { Canceled, Completed, Processing, } -impl ListTreasuryDebitReversalStatus { +impl ListTreasuryDebitReversalBuilderStatus { pub fn as_str(self) -> &'static str { - use ListTreasuryDebitReversalStatus::*; + use ListTreasuryDebitReversalBuilderStatus::*; match self { Canceled => "canceled", Completed => "completed", @@ -107,10 +226,10 @@ impl ListTreasuryDebitReversalStatus { } } -impl std::str::FromStr for ListTreasuryDebitReversalStatus { +impl std::str::FromStr for ListTreasuryDebitReversalBuilderStatus { type Err = (); fn from_str(s: &str) -> Result { - use ListTreasuryDebitReversalStatus::*; + use ListTreasuryDebitReversalBuilderStatus::*; match s { "canceled" => Ok(Canceled), "completed" => Ok(Completed), @@ -119,18 +238,18 @@ impl std::str::FromStr for ListTreasuryDebitReversalStatus { } } } -impl std::fmt::Display for ListTreasuryDebitReversalStatus { +impl std::fmt::Display for ListTreasuryDebitReversalBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTreasuryDebitReversalStatus { +impl std::fmt::Debug for ListTreasuryDebitReversalBuilderStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTreasuryDebitReversalStatus { +impl serde::Serialize for ListTreasuryDebitReversalBuilderStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -138,66 +257,70 @@ impl serde::Serialize for ListTreasuryDebitReversalStatus { serializer.serialize_str(self.as_str()) } } +/// Returns a list of DebitReversals. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryDebitReversal<'a> { + inner: ListTreasuryDebitReversalBuilder<'a>, +} impl<'a> ListTreasuryDebitReversal<'a> { - /// Returns a list of DebitReversals. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/debit_reversals", self) + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryDebitReversalBuilder::new(financial_account) } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/debit_reversals", self) + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryDebitReversal<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTreasuryDebitReversal<'a> { - pub fn new() -> Self { - Self::default() + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn received_debit(mut self, received_debit: &'a str) -> Self { + self.inner.received_debit = Some(received_debit); + self + } + + pub fn resolution(mut self, resolution: ListTreasuryDebitReversalBuilderResolution) -> Self { + self.inner.resolution = Some(resolution); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: ListTreasuryDebitReversalBuilderStatus) -> Self { + self.inner.status = Some(status); + self } } -impl<'a> RetrieveTreasuryDebitReversal<'a> { - /// Retrieves a DebitReversal object. - pub fn send( +impl ListTreasuryDebitReversal<'_> { + pub async fn send( &self, - client: &stripe::Client, - debit_reversal: &stripe_treasury::TreasuryDebitReversalId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/debit_reversals/{debit_reversal}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryDebitReversal<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The ReceivedDebit to reverse. - pub received_debit: &'a str, -} -impl<'a> CreateTreasuryDebitReversal<'a> { - pub fn new(received_debit: &'a str) -> Self { - Self { expand: None, metadata: None, received_debit } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CreateTreasuryDebitReversal<'a> { - /// Reverses a ReceivedDebit and creates a DebitReversal object. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/debit_reversals", self, http_types::Method::Post) + +impl StripeRequest for ListTreasuryDebitReversal<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/debit_reversals").query(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_financial_account/requests.rs b/generated/stripe_treasury/src/treasury_financial_account/requests.rs index a30f0be40..9e0368bc6 100644 --- a/generated/stripe_treasury/src/treasury_financial_account/requests.rs +++ b/generated/stripe_treasury/src/treasury_financial_account/requests.rs @@ -1,91 +1,16 @@ -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTreasuryFinancialAccount<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: Option, - /// An object ID cursor for use in pagination. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// A limit ranging from 1 to 100 (defaults to 10). - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// An object ID cursor for use in pagination. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, -} -impl<'a> ListTreasuryFinancialAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListTreasuryFinancialAccount<'a> { - /// Returns a list of FinancialAccounts. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/financial_accounts", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/financial_accounts", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryFinancialAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTreasuryFinancialAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveTreasuryFinancialAccount<'a> { - /// Retrieves the details of a FinancialAccount. - pub fn send( - &self, - client: &stripe::Client, - financial_account: &stripe_treasury::TreasuryFinancialAccountId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/financial_accounts/{financial_account}"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveFeaturesTreasuryFinancialAccount<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveFeaturesTreasuryFinancialAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveFeaturesTreasuryFinancialAccount<'a> { - /// Retrieves Features information associated with the FinancialAccount. - pub fn send( - &self, - client: &stripe::Client, - financial_account: &stripe_treasury::TreasuryFinancialAccountId, - ) -> stripe::Response { - client - .get_query(&format!("/treasury/financial_accounts/{financial_account}/features"), self) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccount<'a> { +pub struct CreateTreasuryFinancialAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Encodes whether a FinancialAccount has access to a particular feature. /// Stripe or the platform can control features via the requested field. #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option, + pub features: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -94,11 +19,11 @@ pub struct CreateTreasuryFinancialAccount<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// The set of functionalities that the platform can restrict on the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub platform_restrictions: Option, + pub platform_restrictions: Option, /// The currencies the FinancialAccount can hold a balance in. pub supported_currencies: &'a [&'a str], } -impl<'a> CreateTreasuryFinancialAccount<'a> { +impl<'a> CreateTreasuryFinancialAccountBuilder<'a> { pub fn new(supported_currencies: &'a [&'a str]) -> Self { Self { expand: None, @@ -112,42 +37,43 @@ impl<'a> CreateTreasuryFinancialAccount<'a> { /// Encodes whether a FinancialAccount has access to a particular feature. /// Stripe or the platform can control features via the requested field. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeatures { +pub struct CreateTreasuryFinancialAccountBuilderFeatures { /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option, + pub card_issuing: Option, /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[serde(skip_serializing_if = "Option::is_none")] - pub deposit_insurance: Option, + pub deposit_insurance: Option, /// Contains Features that add FinancialAddresses to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub financial_addresses: Option, + pub financial_addresses: + Option, /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub inbound_transfers: Option, + pub inbound_transfers: Option, /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[serde(skip_serializing_if = "Option::is_none")] - pub intra_stripe_flows: Option, + pub intra_stripe_flows: Option, /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_payments: Option, + pub outbound_payments: Option, /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_transfers: Option, + pub outbound_transfers: Option, } -impl CreateTreasuryFinancialAccountFeatures { +impl CreateTreasuryFinancialAccountBuilderFeatures { pub fn new() -> Self { Self::default() } } /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesCardIssuing { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesCardIssuing { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesCardIssuing { +impl CreateTreasuryFinancialAccountBuilderFeaturesCardIssuing { pub fn new(requested: bool) -> Self { Self { requested } } @@ -155,172 +81,174 @@ impl CreateTreasuryFinancialAccountFeaturesCardIssuing { /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesDepositInsurance { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesDepositInsurance { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesDepositInsurance { +impl CreateTreasuryFinancialAccountBuilderFeaturesDepositInsurance { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains Features that add FinancialAddresses to the FinancialAccount. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesFinancialAddresses { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesFinancialAddresses { /// Adds an ABA FinancialAddress to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub aba: Option, + pub aba: Option, } -impl CreateTreasuryFinancialAccountFeaturesFinancialAddresses { +impl CreateTreasuryFinancialAccountBuilderFeaturesFinancialAddresses { pub fn new() -> Self { Self::default() } } /// Adds an ABA FinancialAddress to the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesFinancialAddressesAba { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesFinancialAddressesAba { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesFinancialAddressesAba { +impl CreateTreasuryFinancialAccountBuilderFeaturesFinancialAddressesAba { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesInboundTransfers { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesInboundTransfers { /// Enables ACH Debits via the InboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, } -impl CreateTreasuryFinancialAccountFeaturesInboundTransfers { +impl CreateTreasuryFinancialAccountBuilderFeaturesInboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH Debits via the InboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesInboundTransfersAch { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesInboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesInboundTransfersAch { +impl CreateTreasuryFinancialAccountBuilderFeaturesInboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesIntraStripeFlows { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesIntraStripeFlows { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesIntraStripeFlows { +impl CreateTreasuryFinancialAccountBuilderFeaturesIntraStripeFlows { pub fn new(requested: bool) -> Self { Self { requested } } } /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundPayments { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundPayments { /// Enables ACH transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl CreateTreasuryFinancialAccountFeaturesOutboundPayments { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundPayments { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundPaymentsAch { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesOutboundPaymentsAch { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundPaymentsUsDomesticWire { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesOutboundPaymentsUsDomesticWire { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundTransfers { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfers { /// Enables ACH transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl CreateTreasuryFinancialAccountFeaturesOutboundTransfers { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundTransfersAch { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesOutboundTransfersAch { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountFeaturesOutboundTransfersUsDomesticWire { +pub struct CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl CreateTreasuryFinancialAccountFeaturesOutboundTransfersUsDomesticWire { +impl CreateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } /// The set of functionalities that the platform can restrict on the FinancialAccount. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryFinancialAccountPlatformRestrictions { +pub struct CreateTreasuryFinancialAccountBuilderPlatformRestrictions { /// Restricts all inbound money movement. #[serde(skip_serializing_if = "Option::is_none")] - pub inbound_flows: Option, + pub inbound_flows: + Option, /// Restricts all outbound money movement. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_flows: Option, + pub outbound_flows: + Option, } -impl CreateTreasuryFinancialAccountPlatformRestrictions { +impl CreateTreasuryFinancialAccountBuilderPlatformRestrictions { pub fn new() -> Self { Self::default() } } /// Restricts all inbound money movement. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +pub enum CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { Restricted, Unrestricted, } -impl CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { pub fn as_str(self) -> &'static str { - use CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows::*; + use CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows::*; match self { Restricted => "restricted", Unrestricted => "unrestricted", @@ -328,10 +256,10 @@ impl CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { } } -impl std::str::FromStr for CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::str::FromStr for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows::*; + use CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows::*; match s { "restricted" => Ok(Restricted), "unrestricted" => Ok(Unrestricted), @@ -339,18 +267,18 @@ impl std::str::FromStr for CreateTreasuryFinancialAccountPlatformRestrictionsInb } } } -impl std::fmt::Display for CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::fmt::Display for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::fmt::Debug for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl serde::Serialize for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -360,13 +288,13 @@ impl serde::Serialize for CreateTreasuryFinancialAccountPlatformRestrictionsInbo } /// Restricts all outbound money movement. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +pub enum CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { Restricted, Unrestricted, } -impl CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { pub fn as_str(self) -> &'static str { - use CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows::*; + use CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows::*; match self { Restricted => "restricted", Unrestricted => "unrestricted", @@ -374,10 +302,10 @@ impl CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { } } -impl std::str::FromStr for CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::str::FromStr for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows::*; + use CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows::*; match s { "restricted" => Ok(Restricted), "unrestricted" => Ok(Unrestricted), @@ -385,18 +313,18 @@ impl std::str::FromStr for CreateTreasuryFinancialAccountPlatformRestrictionsOut } } } -impl std::fmt::Display for CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::fmt::Display for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::fmt::Debug for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl serde::Serialize for CreateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -404,24 +332,70 @@ impl serde::Serialize for CreateTreasuryFinancialAccountPlatformRestrictionsOutb serializer.serialize_str(self.as_str()) } } +/// Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryFinancialAccount<'a> { + inner: CreateTreasuryFinancialAccountBuilder<'a>, +} impl<'a> CreateTreasuryFinancialAccount<'a> { - /// Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount. - pub fn send( + pub fn new(supported_currencies: &'a [&'a str]) -> Self { + Self { inner: CreateTreasuryFinancialAccountBuilder::new(supported_currencies) } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn features(mut self, features: CreateTreasuryFinancialAccountBuilderFeatures) -> Self { + self.inner.features = Some(features); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn platform_restrictions( + mut self, + platform_restrictions: CreateTreasuryFinancialAccountBuilderPlatformRestrictions, + ) -> Self { + self.inner.platform_restrictions = Some(platform_restrictions); + self + } +} +impl CreateTreasuryFinancialAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/financial_accounts", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryFinancialAccount<'_> { + type Output = stripe_treasury::TreasuryFinancialAccount; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/financial_accounts").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccount<'a> { +pub struct UpdateTreasuryFinancialAccountBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Encodes whether a FinancialAccount has access to a particular feature, with a status enum and associated `status_details`. /// Stripe or the platform may control features via the requested field. #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option, + pub features: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// This can be useful for storing additional information about the object in a structured format. /// Individual keys can be unset by posting an empty value to them. @@ -430,9 +404,9 @@ pub struct UpdateTreasuryFinancialAccount<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// The set of functionalities that the platform can restrict on the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub platform_restrictions: Option, + pub platform_restrictions: Option, } -impl<'a> UpdateTreasuryFinancialAccount<'a> { +impl<'a> UpdateTreasuryFinancialAccountBuilder<'a> { pub fn new() -> Self { Self::default() } @@ -440,42 +414,43 @@ impl<'a> UpdateTreasuryFinancialAccount<'a> { /// Encodes whether a FinancialAccount has access to a particular feature, with a status enum and associated `status_details`. /// Stripe or the platform may control features via the requested field. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeatures { +pub struct UpdateTreasuryFinancialAccountBuilderFeatures { /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option, + pub card_issuing: Option, /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[serde(skip_serializing_if = "Option::is_none")] - pub deposit_insurance: Option, + pub deposit_insurance: Option, /// Contains Features that add FinancialAddresses to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub financial_addresses: Option, + pub financial_addresses: + Option, /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub inbound_transfers: Option, + pub inbound_transfers: Option, /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[serde(skip_serializing_if = "Option::is_none")] - pub intra_stripe_flows: Option, + pub intra_stripe_flows: Option, /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_payments: Option, + pub outbound_payments: Option, /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_transfers: Option, + pub outbound_transfers: Option, } -impl UpdateTreasuryFinancialAccountFeatures { +impl UpdateTreasuryFinancialAccountBuilderFeatures { pub fn new() -> Self { Self::default() } } /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesCardIssuing { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesCardIssuing { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesCardIssuing { +impl UpdateTreasuryFinancialAccountBuilderFeaturesCardIssuing { pub fn new(requested: bool) -> Self { Self { requested } } @@ -483,172 +458,174 @@ impl UpdateTreasuryFinancialAccountFeaturesCardIssuing { /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesDepositInsurance { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesDepositInsurance { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesDepositInsurance { +impl UpdateTreasuryFinancialAccountBuilderFeaturesDepositInsurance { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains Features that add FinancialAddresses to the FinancialAccount. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesFinancialAddresses { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesFinancialAddresses { /// Adds an ABA FinancialAddress to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub aba: Option, + pub aba: Option, } -impl UpdateTreasuryFinancialAccountFeaturesFinancialAddresses { +impl UpdateTreasuryFinancialAccountBuilderFeaturesFinancialAddresses { pub fn new() -> Self { Self::default() } } /// Adds an ABA FinancialAddress to the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesFinancialAddressesAba { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesFinancialAddressesAba { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesFinancialAddressesAba { +impl UpdateTreasuryFinancialAccountBuilderFeaturesFinancialAddressesAba { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesInboundTransfers { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesInboundTransfers { /// Enables ACH Debits via the InboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, } -impl UpdateTreasuryFinancialAccountFeaturesInboundTransfers { +impl UpdateTreasuryFinancialAccountBuilderFeaturesInboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH Debits via the InboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesInboundTransfersAch { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesInboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesInboundTransfersAch { +impl UpdateTreasuryFinancialAccountBuilderFeaturesInboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesIntraStripeFlows { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesIntraStripeFlows { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesIntraStripeFlows { +impl UpdateTreasuryFinancialAccountBuilderFeaturesIntraStripeFlows { pub fn new(requested: bool) -> Self { Self { requested } } } /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundPayments { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPayments { /// Enables ACH transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundPayments { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPayments { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundPaymentsAch { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundPaymentsAch { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundPaymentsUsDomesticWire { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundPaymentsUsDomesticWire { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundPaymentsUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundTransfers { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfers { /// Enables ACH transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundTransfers { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundTransfersAch { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundTransfersAch { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountFeaturesOutboundTransfersUsDomesticWire { +pub struct UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateTreasuryFinancialAccountFeaturesOutboundTransfersUsDomesticWire { +impl UpdateTreasuryFinancialAccountBuilderFeaturesOutboundTransfersUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } /// The set of functionalities that the platform can restrict on the FinancialAccount. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTreasuryFinancialAccountPlatformRestrictions { +pub struct UpdateTreasuryFinancialAccountBuilderPlatformRestrictions { /// Restricts all inbound money movement. #[serde(skip_serializing_if = "Option::is_none")] - pub inbound_flows: Option, + pub inbound_flows: + Option, /// Restricts all outbound money movement. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_flows: Option, + pub outbound_flows: + Option, } -impl UpdateTreasuryFinancialAccountPlatformRestrictions { +impl UpdateTreasuryFinancialAccountBuilderPlatformRestrictions { pub fn new() -> Self { Self::default() } } /// Restricts all inbound money movement. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +pub enum UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { Restricted, Unrestricted, } -impl UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { pub fn as_str(self) -> &'static str { - use UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows::*; + use UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows::*; match self { Restricted => "restricted", Unrestricted => "unrestricted", @@ -656,10 +633,10 @@ impl UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { } } -impl std::str::FromStr for UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::str::FromStr for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { type Err = (); fn from_str(s: &str) -> Result { - use UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows::*; + use UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows::*; match s { "restricted" => Ok(Restricted), "unrestricted" => Ok(Unrestricted), @@ -667,18 +644,18 @@ impl std::str::FromStr for UpdateTreasuryFinancialAccountPlatformRestrictionsInb } } } -impl std::fmt::Display for UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::fmt::Display for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl std::fmt::Debug for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateTreasuryFinancialAccountPlatformRestrictionsInboundFlows { +impl serde::Serialize for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsInboundFlows { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -688,13 +665,13 @@ impl serde::Serialize for UpdateTreasuryFinancialAccountPlatformRestrictionsInbo } /// Restricts all outbound money movement. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +pub enum UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { Restricted, Unrestricted, } -impl UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { pub fn as_str(self) -> &'static str { - use UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows::*; + use UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows::*; match self { Restricted => "restricted", Unrestricted => "unrestricted", @@ -702,10 +679,10 @@ impl UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { } } -impl std::str::FromStr for UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::str::FromStr for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { type Err = (); fn from_str(s: &str) -> Result { - use UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows::*; + use UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows::*; match s { "restricted" => Ok(Restricted), "unrestricted" => Ok(Unrestricted), @@ -713,18 +690,18 @@ impl std::str::FromStr for UpdateTreasuryFinancialAccountPlatformRestrictionsOut } } } -impl std::fmt::Display for UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::fmt::Display for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl std::fmt::Debug for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateTreasuryFinancialAccountPlatformRestrictionsOutboundFlows { +impl serde::Serialize for UpdateTreasuryFinancialAccountBuilderPlatformRestrictionsOutboundFlows { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -732,60 +709,108 @@ impl serde::Serialize for UpdateTreasuryFinancialAccountPlatformRestrictionsOutb serializer.serialize_str(self.as_str()) } } +/// Updates the details of a FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateTreasuryFinancialAccount<'a> { + inner: UpdateTreasuryFinancialAccountBuilder<'a>, + financial_account: &'a stripe_treasury::TreasuryFinancialAccountId, +} impl<'a> UpdateTreasuryFinancialAccount<'a> { - /// Updates the details of a FinancialAccount. - pub fn send( + pub fn new(financial_account: &'a stripe_treasury::TreasuryFinancialAccountId) -> Self { + Self { financial_account, inner: UpdateTreasuryFinancialAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn features(mut self, features: UpdateTreasuryFinancialAccountBuilderFeatures) -> Self { + self.inner.features = Some(features); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn platform_restrictions( + mut self, + platform_restrictions: UpdateTreasuryFinancialAccountBuilderPlatformRestrictions, + ) -> Self { + self.inner.platform_restrictions = Some(platform_restrictions); + self + } +} +impl UpdateTreasuryFinancialAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - financial_account: &stripe_treasury::TreasuryFinancialAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/treasury/financial_accounts/{financial_account}"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateTreasuryFinancialAccount<'_> { + type Output = stripe_treasury::TreasuryFinancialAccount; + + fn build(&self) -> RequestBuilder { + let financial_account = self.financial_account; + RequestBuilder::new( + StripeMethod::Post, + format!("/treasury/financial_accounts/{financial_account}"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccount<'a> { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilder<'a> { /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option, + pub card_issuing: Option, /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[serde(skip_serializing_if = "Option::is_none")] - pub deposit_insurance: Option, + pub deposit_insurance: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Contains Features that add FinancialAddresses to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub financial_addresses: Option, + pub financial_addresses: + Option, /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub inbound_transfers: Option, + pub inbound_transfers: Option, /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[serde(skip_serializing_if = "Option::is_none")] - pub intra_stripe_flows: Option, + pub intra_stripe_flows: Option, /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_payments: Option, + pub outbound_payments: Option, /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[serde(skip_serializing_if = "Option::is_none")] - pub outbound_transfers: Option, + pub outbound_transfers: Option, } -impl<'a> UpdateFeaturesTreasuryFinancialAccount<'a> { +impl<'a> UpdateFeaturesTreasuryFinancialAccountBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountCardIssuing { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderCardIssuing { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountCardIssuing { +impl UpdateFeaturesTreasuryFinancialAccountBuilderCardIssuing { pub fn new(requested: bool) -> Self { Self { requested } } @@ -793,159 +818,431 @@ impl UpdateFeaturesTreasuryFinancialAccountCardIssuing { /// Represents whether this FinancialAccount is eligible for deposit insurance. /// Various factors determine the insurance amount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountDepositInsurance { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderDepositInsurance { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountDepositInsurance { +impl UpdateFeaturesTreasuryFinancialAccountBuilderDepositInsurance { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains Features that add FinancialAddresses to the FinancialAccount. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountFinancialAddresses { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderFinancialAddresses { /// Adds an ABA FinancialAddress to the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] - pub aba: Option, + pub aba: Option, } -impl UpdateFeaturesTreasuryFinancialAccountFinancialAddresses { +impl UpdateFeaturesTreasuryFinancialAccountBuilderFinancialAddresses { pub fn new() -> Self { Self::default() } } /// Adds an ABA FinancialAddress to the FinancialAccount. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountFinancialAddressesAba { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderFinancialAddressesAba { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountFinancialAddressesAba { +impl UpdateFeaturesTreasuryFinancialAccountBuilderFinancialAddressesAba { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountInboundTransfers { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderInboundTransfers { /// Enables ACH Debits via the InboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, } -impl UpdateFeaturesTreasuryFinancialAccountInboundTransfers { +impl UpdateFeaturesTreasuryFinancialAccountBuilderInboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH Debits via the InboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountInboundTransfersAch { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderInboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountInboundTransfersAch { +impl UpdateFeaturesTreasuryFinancialAccountBuilderInboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Represents the ability for the FinancialAccount to send money to, or receive money from other FinancialAccounts (for example, via OutboundPayment). #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountIntraStripeFlows { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderIntraStripeFlows { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountIntraStripeFlows { +impl UpdateFeaturesTreasuryFinancialAccountBuilderIntraStripeFlows { pub fn new(requested: bool) -> Self { Self { requested } } } /// Includes Features related to initiating money movement out of the FinancialAccount to someone else's bucket of money. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundPayments { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPayments { /// Enables ACH transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundPayments API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundPayments { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPayments { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundPaymentsAch { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPaymentsAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundPaymentsAch { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPaymentsAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundPayments API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundPaymentsUsDomesticWire { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPaymentsUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundPaymentsUsDomesticWire { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPaymentsUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } /// Contains a Feature and settings related to moving money out of the FinancialAccount into another Account with the same owner. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundTransfers { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfers { /// Enables ACH transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] - pub ach: Option, + pub ach: Option, /// Enables US domestic wire transfers via the OutboundTransfers API. #[serde(skip_serializing_if = "Option::is_none")] pub us_domestic_wire: - Option, + Option, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundTransfers { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfers { pub fn new() -> Self { Self::default() } } /// Enables ACH transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundTransfersAch { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfersAch { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundTransfersAch { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfersAch { pub fn new(requested: bool) -> Self { Self { requested } } } /// Enables US domestic wire transfers via the OutboundTransfers API. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateFeaturesTreasuryFinancialAccountOutboundTransfersUsDomesticWire { +pub struct UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfersUsDomesticWire { /// Whether the FinancialAccount should have the Feature. pub requested: bool, } -impl UpdateFeaturesTreasuryFinancialAccountOutboundTransfersUsDomesticWire { +impl UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfersUsDomesticWire { pub fn new(requested: bool) -> Self { Self { requested } } } +/// Updates the Features associated with a FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct UpdateFeaturesTreasuryFinancialAccount<'a> { + inner: UpdateFeaturesTreasuryFinancialAccountBuilder<'a>, + financial_account: &'a stripe_treasury::TreasuryFinancialAccountId, +} impl<'a> UpdateFeaturesTreasuryFinancialAccount<'a> { - /// Updates the Features associated with a FinancialAccount. - pub fn send( + pub fn new(financial_account: &'a stripe_treasury::TreasuryFinancialAccountId) -> Self { + Self { financial_account, inner: UpdateFeaturesTreasuryFinancialAccountBuilder::new() } + } + pub fn card_issuing( + mut self, + card_issuing: UpdateFeaturesTreasuryFinancialAccountBuilderCardIssuing, + ) -> Self { + self.inner.card_issuing = Some(card_issuing); + self + } + + pub fn deposit_insurance( + mut self, + deposit_insurance: UpdateFeaturesTreasuryFinancialAccountBuilderDepositInsurance, + ) -> Self { + self.inner.deposit_insurance = Some(deposit_insurance); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn financial_addresses( + mut self, + financial_addresses: UpdateFeaturesTreasuryFinancialAccountBuilderFinancialAddresses, + ) -> Self { + self.inner.financial_addresses = Some(financial_addresses); + self + } + + pub fn inbound_transfers( + mut self, + inbound_transfers: UpdateFeaturesTreasuryFinancialAccountBuilderInboundTransfers, + ) -> Self { + self.inner.inbound_transfers = Some(inbound_transfers); + self + } + + pub fn intra_stripe_flows( + mut self, + intra_stripe_flows: UpdateFeaturesTreasuryFinancialAccountBuilderIntraStripeFlows, + ) -> Self { + self.inner.intra_stripe_flows = Some(intra_stripe_flows); + self + } + + pub fn outbound_payments( + mut self, + outbound_payments: UpdateFeaturesTreasuryFinancialAccountBuilderOutboundPayments, + ) -> Self { + self.inner.outbound_payments = Some(outbound_payments); + self + } + + pub fn outbound_transfers( + mut self, + outbound_transfers: UpdateFeaturesTreasuryFinancialAccountBuilderOutboundTransfers, + ) -> Self { + self.inner.outbound_transfers = Some(outbound_transfers); + self + } +} +impl UpdateFeaturesTreasuryFinancialAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for UpdateFeaturesTreasuryFinancialAccount<'_> { + type Output = stripe_treasury::TreasuryFinancialAccountFeatures; + + fn build(&self) -> RequestBuilder { + let financial_account = self.financial_account; + RequestBuilder::new( + StripeMethod::Post, + format!("/treasury/financial_accounts/{financial_account}/features"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ListTreasuryFinancialAccountBuilder<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub created: Option, + /// An object ID cursor for use in pagination. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// A limit ranging from 1 to 100 (defaults to 10). + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// An object ID cursor for use in pagination. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, +} +impl<'a> ListTreasuryFinancialAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Returns a list of FinancialAccounts. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryFinancialAccount<'a> { + inner: ListTreasuryFinancialAccountBuilder<'a>, +} +impl<'a> ListTreasuryFinancialAccount<'a> { + pub fn new() -> Self { + Self { inner: ListTreasuryFinancialAccountBuilder::new() } + } + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } +} +impl ListTreasuryFinancialAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryFinancialAccount<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/financial_accounts").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryFinancialAccountBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryFinancialAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of a FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryFinancialAccount<'a> { + inner: RetrieveTreasuryFinancialAccountBuilder<'a>, + financial_account: &'a stripe_treasury::TreasuryFinancialAccountId, +} +impl<'a> RetrieveTreasuryFinancialAccount<'a> { + pub fn new(financial_account: &'a stripe_treasury::TreasuryFinancialAccountId) -> Self { + Self { financial_account, inner: RetrieveTreasuryFinancialAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryFinancialAccount<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryFinancialAccount<'_> { + type Output = stripe_treasury::TreasuryFinancialAccount; + + fn build(&self) -> RequestBuilder { + let financial_account = self.financial_account; + RequestBuilder::new( + StripeMethod::Get, + format!("/treasury/financial_accounts/{financial_account}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveFeaturesTreasuryFinancialAccountBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveFeaturesTreasuryFinancialAccountBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves Features information associated with the FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveFeaturesTreasuryFinancialAccount<'a> { + inner: RetrieveFeaturesTreasuryFinancialAccountBuilder<'a>, + financial_account: &'a stripe_treasury::TreasuryFinancialAccountId, +} +impl<'a> RetrieveFeaturesTreasuryFinancialAccount<'a> { + pub fn new(financial_account: &'a stripe_treasury::TreasuryFinancialAccountId) -> Self { + Self { financial_account, inner: RetrieveFeaturesTreasuryFinancialAccountBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveFeaturesTreasuryFinancialAccount<'_> { + pub async fn send( &self, - client: &stripe::Client, - financial_account: &stripe_treasury::TreasuryFinancialAccountId, - ) -> stripe::Response { - client.send_form( - &format!("/treasury/financial_accounts/{financial_account}/features"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveFeaturesTreasuryFinancialAccount<'_> { + type Output = stripe_treasury::TreasuryFinancialAccountFeatures; + + fn build(&self) -> RequestBuilder { + let financial_account = self.financial_account; + RequestBuilder::new( + StripeMethod::Get, + format!("/treasury/financial_accounts/{financial_account}/features"), ) + .query(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs b/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs index 827f865be..3810cb6ee 100644 --- a/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs +++ b/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs @@ -1,5 +1,224 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelTreasuryInboundTransferBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelTreasuryInboundTransferBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Cancels an InboundTransfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelTreasuryInboundTransfer<'a> { + inner: CancelTreasuryInboundTransferBuilder<'a>, + inbound_transfer: &'a stripe_treasury::TreasuryInboundTransferId, +} +impl<'a> CancelTreasuryInboundTransfer<'a> { + pub fn new(inbound_transfer: &'a stripe_treasury::TreasuryInboundTransferId) -> Self { + Self { inbound_transfer, inner: CancelTreasuryInboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelTreasuryInboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + let inbound_transfer = self.inbound_transfer; + RequestBuilder::new( + StripeMethod::Post, + format!("/treasury/inbound_transfers/{inbound_transfer}/cancel"), + ) + .form(&self.inner) + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryInboundTransfer<'a> { +pub struct CreateTreasuryInboundTransferBuilder<'a> { + /// Amount (in cents) to be transferred. + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// An arbitrary string attached to the object. Often useful for displaying to users. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// The FinancialAccount to send funds to. + pub financial_account: &'a str, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The origin payment method to be debited for the InboundTransfer. + pub origin_payment_method: &'a str, + /// The complete description that appears on your customers' statements. Maximum 10 characters. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor: Option<&'a str>, +} +impl<'a> CreateTreasuryInboundTransferBuilder<'a> { + pub fn new( + amount: i64, + currency: stripe_types::Currency, + financial_account: &'a str, + origin_payment_method: &'a str, + ) -> Self { + Self { + amount, + currency, + description: None, + expand: None, + financial_account, + metadata: None, + origin_payment_method, + statement_descriptor: None, + } + } +} +/// Creates an InboundTransfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryInboundTransfer<'a> { + inner: CreateTreasuryInboundTransferBuilder<'a>, +} +impl<'a> CreateTreasuryInboundTransfer<'a> { + pub fn new( + amount: i64, + currency: stripe_types::Currency, + financial_account: &'a str, + origin_payment_method: &'a str, + ) -> Self { + Self { + inner: CreateTreasuryInboundTransferBuilder::new( + amount, + currency, + financial_account, + origin_payment_method, + ), + } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } +} +impl CreateTreasuryInboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/inbound_transfers").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryInboundTransferBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryInboundTransferBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing InboundTransfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryInboundTransfer<'a> { + inner: RetrieveTreasuryInboundTransferBuilder<'a>, + id: &'a stripe_treasury::TreasuryInboundTransferId, +} +impl<'a> RetrieveTreasuryInboundTransfer<'a> { + pub fn new(id: &'a stripe_treasury::TreasuryInboundTransferId) -> Self { + Self { id, inner: RetrieveTreasuryInboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryInboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/inbound_transfers/{id}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ListTreasuryInboundTransferBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -23,7 +242,7 @@ pub struct ListTreasuryInboundTransfer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListTreasuryInboundTransfer<'a> { +impl<'a> ListTreasuryInboundTransferBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -35,63 +254,140 @@ impl<'a> ListTreasuryInboundTransfer<'a> { } } } +/// Returns a list of InboundTransfers sent from the specified FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryInboundTransfer<'a> { + inner: ListTreasuryInboundTransferBuilder<'a>, +} impl<'a> ListTreasuryInboundTransfer<'a> { - /// Returns a list of InboundTransfers sent from the specified FinancialAccount. - pub fn send( + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryInboundTransferBuilder::new(financial_account) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryInboundTransferStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryInboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/inbound_transfers", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/inbound_transfers", self) +} + +impl StripeRequest for ListTreasuryInboundTransfer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/inbound_transfers").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryInboundTransfer<'a> { +pub struct SucceedTreasuryInboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTreasuryInboundTransfer<'a> { +impl<'a> SucceedTreasuryInboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveTreasuryInboundTransfer<'a> { - /// Retrieves the details of an existing InboundTransfer. - pub fn send( +/// Transitions a test mode created InboundTransfer to the `succeeded` status. +/// The InboundTransfer must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct SucceedTreasuryInboundTransfer<'a> { + inner: SucceedTreasuryInboundTransferBuilder<'a>, + id: &'a str, +} +impl<'a> SucceedTreasuryInboundTransfer<'a> { + pub fn new(id: &'a str) -> Self { + Self { id, inner: SucceedTreasuryInboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl SucceedTreasuryInboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryInboundTransferId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/inbound_transfers/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for SucceedTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/inbound_transfers/{id}/succeed"), + ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FailTreasuryInboundTransfer<'a> { +pub struct FailTreasuryInboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Details about a failed InboundTransfer. #[serde(skip_serializing_if = "Option::is_none")] - pub failure_details: Option, + pub failure_details: Option, } -impl<'a> FailTreasuryInboundTransfer<'a> { +impl<'a> FailTreasuryInboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Details about a failed InboundTransfer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FailTreasuryInboundTransferFailureDetails { +pub struct FailTreasuryInboundTransferBuilderFailureDetails { /// Reason for the failure. #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, + pub code: Option, } -impl FailTreasuryInboundTransferFailureDetails { +impl FailTreasuryInboundTransferBuilderFailureDetails { pub fn new() -> Self { Self::default() } @@ -99,7 +395,7 @@ impl FailTreasuryInboundTransferFailureDetails { /// Reason for the failure. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum FailTreasuryInboundTransferFailureDetailsCode { +pub enum FailTreasuryInboundTransferBuilderFailureDetailsCode { AccountClosed, AccountFrozen, BankAccountRestricted, @@ -116,9 +412,9 @@ pub enum FailTreasuryInboundTransferFailureDetailsCode { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl FailTreasuryInboundTransferFailureDetailsCode { +impl FailTreasuryInboundTransferBuilderFailureDetailsCode { pub fn as_str(self) -> &'static str { - use FailTreasuryInboundTransferFailureDetailsCode::*; + use FailTreasuryInboundTransferBuilderFailureDetailsCode::*; match self { AccountClosed => "account_closed", AccountFrozen => "account_frozen", @@ -138,10 +434,10 @@ impl FailTreasuryInboundTransferFailureDetailsCode { } } -impl std::str::FromStr for FailTreasuryInboundTransferFailureDetailsCode { +impl std::str::FromStr for FailTreasuryInboundTransferBuilderFailureDetailsCode { type Err = (); fn from_str(s: &str) -> Result { - use FailTreasuryInboundTransferFailureDetailsCode::*; + use FailTreasuryInboundTransferBuilderFailureDetailsCode::*; match s { "account_closed" => Ok(AccountClosed), "account_frozen" => Ok(AccountFrozen), @@ -160,18 +456,18 @@ impl std::str::FromStr for FailTreasuryInboundTransferFailureDetailsCode { } } } -impl std::fmt::Display for FailTreasuryInboundTransferFailureDetailsCode { +impl std::fmt::Display for FailTreasuryInboundTransferBuilderFailureDetailsCode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for FailTreasuryInboundTransferFailureDetailsCode { +impl std::fmt::Debug for FailTreasuryInboundTransferBuilderFailureDetailsCode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for FailTreasuryInboundTransferFailureDetailsCode { +impl serde::Serialize for FailTreasuryInboundTransferBuilderFailureDetailsCode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -179,150 +475,110 @@ impl serde::Serialize for FailTreasuryInboundTransferFailureDetailsCode { serializer.serialize_str(self.as_str()) } } +/// Transitions a test mode created InboundTransfer to the `failed` status. +/// The InboundTransfer must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FailTreasuryInboundTransfer<'a> { + inner: FailTreasuryInboundTransferBuilder<'a>, + id: &'a str, +} impl<'a> FailTreasuryInboundTransfer<'a> { - /// Transitions a test mode created InboundTransfer to the `failed` status. - /// The InboundTransfer must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/inbound_transfers/{id}/fail"), - self, - http_types::Method::Post, - ) + pub fn new(id: &'a str) -> Self { + Self { id, inner: FailTreasuryInboundTransferBuilder::new() } } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnInboundTransferTreasuryInboundTransfer<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> ReturnInboundTransferTreasuryInboundTransfer<'a> { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn failure_details( + mut self, + failure_details: FailTreasuryInboundTransferBuilderFailureDetails, + ) -> Self { + self.inner.failure_details = Some(failure_details); + self } } -impl<'a> ReturnInboundTransferTreasuryInboundTransfer<'a> { - /// Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. - /// The InboundTransfer must already be in the `succeeded` state. - pub fn send( +impl FailTreasuryInboundTransfer<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/inbound_transfers/{id}/return"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FailTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/inbound_transfers/{id}/fail"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct SucceedTreasuryInboundTransfer<'a> { +pub struct ReturnInboundTransferTreasuryInboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> SucceedTreasuryInboundTransfer<'a> { +impl<'a> ReturnInboundTransferTreasuryInboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> SucceedTreasuryInboundTransfer<'a> { - /// Transitions a test mode created InboundTransfer to the `succeeded` status. - /// The InboundTransfer must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/inbound_transfers/{id}/succeed"), - self, - http_types::Method::Post, - ) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryInboundTransfer<'a> { - /// Amount (in cents) to be transferred. - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// An arbitrary string attached to the object. Often useful for displaying to users. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The FinancialAccount to send funds to. - pub financial_account: &'a str, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The origin payment method to be debited for the InboundTransfer. - pub origin_payment_method: &'a str, - /// The complete description that appears on your customers' statements. Maximum 10 characters. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, +/// Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. +/// The InboundTransfer must already be in the `succeeded` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReturnInboundTransferTreasuryInboundTransfer<'a> { + inner: ReturnInboundTransferTreasuryInboundTransferBuilder<'a>, + id: &'a str, } -impl<'a> CreateTreasuryInboundTransfer<'a> { - pub fn new( - amount: i64, - currency: stripe_types::Currency, - financial_account: &'a str, - origin_payment_method: &'a str, - ) -> Self { - Self { - amount, - currency, - description: None, - expand: None, - financial_account, - metadata: None, - origin_payment_method, - statement_descriptor: None, - } +impl<'a> ReturnInboundTransferTreasuryInboundTransfer<'a> { + pub fn new(id: &'a str) -> Self { + Self { id, inner: ReturnInboundTransferTreasuryInboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } } -impl<'a> CreateTreasuryInboundTransfer<'a> { - /// Creates an InboundTransfer. - pub fn send( +impl ReturnInboundTransferTreasuryInboundTransfer<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/inbound_transfers", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelTreasuryInboundTransfer<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelTreasuryInboundTransfer<'a> { - pub fn new() -> Self { - Self::default() + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CancelTreasuryInboundTransfer<'a> { - /// Cancels an InboundTransfer. - pub fn send( - &self, - client: &stripe::Client, - inbound_transfer: &stripe_treasury::TreasuryInboundTransferId, - ) -> stripe::Response { - client.send_form( - &format!("/treasury/inbound_transfers/{inbound_transfer}/cancel"), - self, - http_types::Method::Post, + +impl StripeRequest for ReturnInboundTransferTreasuryInboundTransfer<'_> { + type Output = stripe_treasury::TreasuryInboundTransfer; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/inbound_transfers/{id}/return"), ) + .form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs b/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs index f189e6490..f5288213e 100644 --- a/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs +++ b/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs @@ -1,244 +1,9 @@ -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryOutboundPayment<'a> { - /// Only return OutboundPayments sent to this customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub customer: Option<&'a str>, - /// A cursor for use in pagination. - /// `ending_before` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub ending_before: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Returns objects associated with this FinancialAccount. - pub financial_account: &'a str, - /// A limit on the number of objects to be returned. - /// Limit can range between 1 and 100, and the default is 10. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// A cursor for use in pagination. - /// `starting_after` is an object ID that defines your place in the list. - /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, - /// Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, -} -impl<'a> ListTreasuryOutboundPayment<'a> { - pub fn new(financial_account: &'a str) -> Self { - Self { - customer: None, - ending_before: None, - expand: None, - financial_account, - limit: None, - starting_after: None, - status: None, - } - } -} -impl<'a> ListTreasuryOutboundPayment<'a> { - /// Returns a list of OutboundPayments sent from the specified FinancialAccount. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/outbound_payments", self) - } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/outbound_payments", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryOutboundPayment<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTreasuryOutboundPayment<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> RetrieveTreasuryOutboundPayment<'a> { - /// Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list. - pub fn send( - &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryOutboundPaymentId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/outbound_payments/{id}"), self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FailTreasuryOutboundPayment<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> FailTreasuryOutboundPayment<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> FailTreasuryOutboundPayment<'a> { - /// Transitions a test mode created OutboundPayment to the `failed` status. - /// The OutboundPayment must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_payments/{id}/fail"), - self, - http_types::Method::Post, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PostTreasuryOutboundPayment<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> PostTreasuryOutboundPayment<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> PostTreasuryOutboundPayment<'a> { - /// Transitions a test mode created OutboundPayment to the `posted` status. - /// The OutboundPayment must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_payments/{id}/post"), - self, - http_types::Method::Post, - ) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnOutboundPaymentTreasuryOutboundPayment<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// Optional hash to set the the return code. - #[serde(skip_serializing_if = "Option::is_none")] - pub returned_details: Option, -} -impl<'a> ReturnOutboundPaymentTreasuryOutboundPayment<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Optional hash to set the the return code. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetails { - /// The return code to be set on the OutboundPayment object. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, -} -impl ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetails { - pub fn new() -> Self { - Self::default() - } -} -/// The return code to be set on the OutboundPayment object. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - AccountClosed, - AccountFrozen, - BankAccountRestricted, - BankOwnershipChanged, - Declined, - IncorrectAccountHolderName, - InvalidAccountNumber, - InvalidCurrency, - NoAccount, - Other, -} -impl ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - pub fn as_str(self) -> &'static str { - use ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode::*; - match self { - AccountClosed => "account_closed", - AccountFrozen => "account_frozen", - BankAccountRestricted => "bank_account_restricted", - BankOwnershipChanged => "bank_ownership_changed", - Declined => "declined", - IncorrectAccountHolderName => "incorrect_account_holder_name", - InvalidAccountNumber => "invalid_account_number", - InvalidCurrency => "invalid_currency", - NoAccount => "no_account", - Other => "other", - } - } -} - -impl std::str::FromStr for ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - type Err = (); - fn from_str(s: &str) -> Result { - use ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode::*; - match s { - "account_closed" => Ok(AccountClosed), - "account_frozen" => Ok(AccountFrozen), - "bank_account_restricted" => Ok(BankAccountRestricted), - "bank_ownership_changed" => Ok(BankOwnershipChanged), - "declined" => Ok(Declined), - "incorrect_account_holder_name" => Ok(IncorrectAccountHolderName), - "invalid_account_number" => Ok(InvalidAccountNumber), - "invalid_currency" => Ok(InvalidCurrency), - "no_account" => Ok(NoAccount), - "other" => Ok(Other), - _ => Err(()), - } - } -} -impl std::fmt::Display for ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; -impl std::fmt::Debug for ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ReturnOutboundPaymentTreasuryOutboundPaymentReturnedDetailsCode { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> ReturnOutboundPaymentTreasuryOutboundPayment<'a> { - /// Transitions a test mode created OutboundPayment to the `returned` status. - /// The OutboundPayment must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - id: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_payments/{id}/return"), - self, - http_types::Method::Post, - ) - } -} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryOutboundPayment<'a> { +pub struct CreateTreasuryOutboundPaymentBuilder<'a> { /// Amount (in cents) to be transferred. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -259,14 +24,14 @@ pub struct CreateTreasuryOutboundPayment<'a> { /// Exclusive with `destination_payment_method`. #[serde(skip_serializing_if = "Option::is_none")] pub destination_payment_method_data: - Option>, + Option>, /// Payment method-specific configuration for this OutboundPayment. #[serde(skip_serializing_if = "Option::is_none")] pub destination_payment_method_options: - Option, + Option, /// End user details. #[serde(skip_serializing_if = "Option::is_none")] - pub end_user_details: Option>, + pub end_user_details: Option>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -279,12 +44,12 @@ pub struct CreateTreasuryOutboundPayment<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<&'a std::collections::HashMap>, /// The description that appears on the receiving end for this OutboundPayment (for example, bank statement for external bank transfer). - /// Maximum 10 characters for `ach` payments, 140 characters for `us_domestic_wire` payments, or 500 characters for `stripe` network transfers. - /// The default value is "payment". + /// Maximum 10 characters for `ach` payments, 140 characters for `wire` payments, or 500 characters for `stripe` network transfers. + /// The default value is `payment`. #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, } -impl<'a> CreateTreasuryOutboundPayment<'a> { +impl<'a> CreateTreasuryOutboundPaymentBuilder<'a> { pub fn new(amount: i64, currency: stripe_types::Currency, financial_account: &'a str) -> Self { Self { amount, @@ -305,11 +70,11 @@ impl<'a> CreateTreasuryOutboundPayment<'a> { /// Hash used to generate the PaymentMethod to be used for this OutboundPayment. /// Exclusive with `destination_payment_method`. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodData<'a> { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodData<'a> { /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] pub billing_details: - Option>, + Option>, /// Required if type is set to `financial_account`. The FinancialAccount ID to send funds to. #[serde(skip_serializing_if = "Option::is_none")] pub financial_account: Option<&'a str>, @@ -323,14 +88,16 @@ pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodData<'a> { /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] - pub type_: CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType, + pub type_: CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType, /// Required hash if type is set to `us_bank_account`. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option>, + Option>, } -impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodData<'a> { - pub fn new(type_: CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType) -> Self { +impl<'a> CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodData<'a> { + pub fn new( + type_: CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType, + ) -> Self { Self { billing_details: None, financial_account: None, @@ -342,11 +109,12 @@ impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodData<'a> { } /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetails<'a> { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataBillingDetails<'a> { /// Billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: - Option>, + pub address: Option< + CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataBillingDetailsAddress<'a>, + >, /// Email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -357,14 +125,15 @@ pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetai #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, } -impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetails<'a> { +impl<'a> CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataBillingDetails<'a> { pub fn new() -> Self { Self::default() } } /// Billing address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetailsAddress<'a> { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataBillingDetailsAddress<'a> +{ /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -384,7 +153,7 @@ pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetai #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetailsAddress<'a> { +impl<'a> CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataBillingDetailsAddress<'a> { pub fn new() -> Self { Self::default() } @@ -393,13 +162,13 @@ impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetails /// An additional hash is included on the PaymentMethod with a name matching this value. /// It contains additional information specific to the PaymentMethod type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +pub enum CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { FinancialAccount, UsBankAccount, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +impl CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { pub fn as_str(self) -> &'static str { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType::*; match self { FinancialAccount => "financial_account", UsBankAccount => "us_bank_account", @@ -407,10 +176,10 @@ impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { } } -impl std::str::FromStr for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +impl std::str::FromStr for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType::*; match s { "financial_account" => Ok(FinancialAccount), "us_bank_account" => Ok(UsBankAccount), @@ -418,18 +187,18 @@ impl std::str::FromStr for CreateTreasuryOutboundPaymentDestinationPaymentMethod } } } -impl std::fmt::Display for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +impl std::fmt::Display for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +impl std::fmt::Debug for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataType { +impl serde::Serialize for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -439,40 +208,41 @@ impl serde::Serialize for CreateTreasuryOutboundPaymentDestinationPaymentMethodD } /// Required hash if type is set to `us_bank_account`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccount<'a> { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccount<'a> { /// Account holder type: individual or company. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_holder_type: Option< - CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType, - >, +#[serde(skip_serializing_if = "Option::is_none")] +pub account_holder_type: Option, /// Account number of the bank account. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_number: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub account_number: Option<&'a str>, /// Account type: checkings or savings. Defaults to checking if omitted. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_type: - Option, +#[serde(skip_serializing_if = "Option::is_none")] +pub account_type: Option, /// The ID of a Financial Connections Account to use as a payment method. - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections_account: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub financial_connections_account: Option<&'a str>, /// Routing number of the bank account. - #[serde(skip_serializing_if = "Option::is_none")] - pub routing_number: Option<&'a str>, +#[serde(skip_serializing_if = "Option::is_none")] +pub routing_number: Option<&'a str>, + } -impl<'a> CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccount<'a> { +impl<'a> CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// Account holder type: individual or company. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType { +pub enum CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType +{ Company, Individual, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType { +impl + CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType +{ pub fn as_str(self) -> &'static str { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType::*; match self { Company => "company", Individual => "individual", @@ -480,53 +250,43 @@ impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccou } } -impl std::str::FromStr - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType -{ +impl std::str::FromStr for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType::*; match s { - "company" => Ok(Company), - "individual" => Ok(Individual), - _ => Err(()), + "company" => Ok(Company), +"individual" => Ok(Individual), +_ => Err(()) + } } } -impl std::fmt::Display - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType -{ +impl std::fmt::Display for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType -{ +impl std::fmt::Debug for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountHolderType -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { +impl serde::Serialize for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountHolderType { + fn serialize(&self, serializer: S) -> Result where S: serde::Serializer { serializer.serialize_str(self.as_str()) } } /// Account type: checkings or savings. Defaults to checking if omitted. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType { +pub enum CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { Checking, Savings, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType { +impl CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { pub fn as_str(self) -> &'static str { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType::*; match self { Checking => "checking", Savings => "savings", @@ -535,11 +295,11 @@ impl CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccou } impl std::str::FromStr - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType::*; match s { "checking" => Ok(Checking), "savings" => Ok(Savings), @@ -548,7 +308,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -556,14 +316,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateTreasuryOutboundPaymentDestinationPaymentMethodDataUsBankAccountAccountType + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodDataUsBankAccountAccountType { fn serialize(&self, serializer: S) -> Result where @@ -574,27 +334,28 @@ impl serde::Serialize } /// Payment method-specific configuration for this OutboundPayment. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodOptions { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptions { /// Optional fields for `us_bank_account`. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option, + Option, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodOptions { +impl CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptions { pub fn new() -> Self { Self::default() } } /// Optional fields for `us_bank_account`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccount { +pub struct CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccount { /// The US bank account network that must be used for this OutboundPayment. /// If not set, we will default to the PaymentMethod's preferred network. #[serde(skip_serializing_if = "Option::is_none")] - pub network: - Option, + pub network: Option< + CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork, + >, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccount { +impl CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccount { pub fn new() -> Self { Self::default() } @@ -602,13 +363,13 @@ impl CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccount { /// The US bank account network that must be used for this OutboundPayment. /// If not set, we will default to the PaymentMethod's preferred network. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork { +pub enum CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { Ach, UsDomesticWire, } -impl CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork { +impl CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { pub fn as_str(self) -> &'static str { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -617,11 +378,11 @@ impl CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNe } impl std::str::FromStr - for CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork::*; + use CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -630,7 +391,7 @@ impl std::str::FromStr } } impl std::fmt::Display - for CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) @@ -638,14 +399,14 @@ impl std::fmt::Display } impl std::fmt::Debug - for CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } impl serde::Serialize - for CreateTreasuryOutboundPaymentDestinationPaymentMethodOptionsUsBankAccountNetwork + for CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { fn serialize(&self, serializer: S) -> Result where @@ -656,7 +417,7 @@ impl serde::Serialize } /// End user details. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryOutboundPaymentEndUserDetails<'a> { +pub struct CreateTreasuryOutboundPaymentBuilderEndUserDetails<'a> { /// IP address of the user initiating the OutboundPayment. /// Must be supplied if `present` is set to `true`. #[serde(skip_serializing_if = "Option::is_none")] @@ -665,42 +426,560 @@ pub struct CreateTreasuryOutboundPaymentEndUserDetails<'a> { /// Otherwise, `false`. pub present: bool, } -impl<'a> CreateTreasuryOutboundPaymentEndUserDetails<'a> { +impl<'a> CreateTreasuryOutboundPaymentBuilderEndUserDetails<'a> { pub fn new(present: bool) -> Self { Self { ip_address: None, present } } } +/// Creates an OutboundPayment. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryOutboundPayment<'a> { + inner: CreateTreasuryOutboundPaymentBuilder<'a>, +} impl<'a> CreateTreasuryOutboundPayment<'a> { - /// Creates an OutboundPayment. - pub fn send( + pub fn new(amount: i64, currency: stripe_types::Currency, financial_account: &'a str) -> Self { + Self { + inner: CreateTreasuryOutboundPaymentBuilder::new(amount, currency, financial_account), + } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn destination_payment_method(mut self, destination_payment_method: &'a str) -> Self { + self.inner.destination_payment_method = Some(destination_payment_method); + self + } + + pub fn destination_payment_method_data( + mut self, + destination_payment_method_data: CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodData<'a>, + ) -> Self { + self.inner.destination_payment_method_data = Some(destination_payment_method_data); + self + } + + pub fn destination_payment_method_options( + mut self, + destination_payment_method_options: CreateTreasuryOutboundPaymentBuilderDestinationPaymentMethodOptions, + ) -> Self { + self.inner.destination_payment_method_options = Some(destination_payment_method_options); + self + } + + pub fn end_user_details( + mut self, + end_user_details: CreateTreasuryOutboundPaymentBuilderEndUserDetails<'a>, + ) -> Self { + self.inner.end_user_details = Some(end_user_details); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } +} +impl CreateTreasuryOutboundPayment<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/outbound_payments", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/outbound_payments").form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelTreasuryOutboundPayment<'a> { +pub struct RetrieveTreasuryOutboundPaymentBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> CancelTreasuryOutboundPayment<'a> { +impl<'a> RetrieveTreasuryOutboundPaymentBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryOutboundPayment<'a> { + inner: RetrieveTreasuryOutboundPaymentBuilder<'a>, + id: &'a stripe_treasury::TreasuryOutboundPaymentId, +} +impl<'a> RetrieveTreasuryOutboundPayment<'a> { + pub fn new(id: &'a stripe_treasury::TreasuryOutboundPaymentId) -> Self { + Self { id, inner: RetrieveTreasuryOutboundPaymentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryOutboundPayment<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/outbound_payments/{id}")) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ListTreasuryOutboundPaymentBuilder<'a> { + /// Only return OutboundPayments sent to this customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option<&'a str>, + /// A cursor for use in pagination. + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Returns objects associated with this FinancialAccount. + pub financial_account: &'a str, + /// A limit on the number of objects to be returned. + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// A cursor for use in pagination. + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option<&'a str>, + /// Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl<'a> ListTreasuryOutboundPaymentBuilder<'a> { + pub fn new(financial_account: &'a str) -> Self { + Self { + customer: None, + ending_before: None, + expand: None, + financial_account, + limit: None, + starting_after: None, + status: None, + } + } +} +/// Returns a list of OutboundPayments sent from the specified FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryOutboundPayment<'a> { + inner: ListTreasuryOutboundPaymentBuilder<'a>, +} +impl<'a> ListTreasuryOutboundPayment<'a> { + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryOutboundPaymentBuilder::new(financial_account) } + } + pub fn customer(mut self, customer: &'a str) -> Self { + self.inner.customer = Some(customer); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryOutboundPaymentStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryOutboundPayment<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryOutboundPayment<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/outbound_payments").query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CancelTreasuryOutboundPaymentBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> CancelTreasuryOutboundPaymentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Cancel an OutboundPayment. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelTreasuryOutboundPayment<'a> { + inner: CancelTreasuryOutboundPaymentBuilder<'a>, + id: &'a stripe_treasury::TreasuryOutboundPaymentId, +} impl<'a> CancelTreasuryOutboundPayment<'a> { - /// Cancel an OutboundPayment. - pub fn send( + pub fn new(id: &'a stripe_treasury::TreasuryOutboundPaymentId) -> Self { + Self { id, inner: CancelTreasuryOutboundPaymentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelTreasuryOutboundPayment<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Post, format!("/treasury/outbound_payments/{id}/cancel")) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct FailTreasuryOutboundPaymentBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> FailTreasuryOutboundPaymentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Transitions a test mode created OutboundPayment to the `failed` status. +/// The OutboundPayment must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FailTreasuryOutboundPayment<'a> { + inner: FailTreasuryOutboundPaymentBuilder<'a>, + id: &'a str, +} +impl<'a> FailTreasuryOutboundPayment<'a> { + pub fn new(id: &'a str) -> Self { + Self { id, inner: FailTreasuryOutboundPaymentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl FailTreasuryOutboundPayment<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FailTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_payments/{id}/fail"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PostTreasuryOutboundPaymentBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> PostTreasuryOutboundPaymentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Transitions a test mode created OutboundPayment to the `posted` status. +/// The OutboundPayment must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PostTreasuryOutboundPayment<'a> { + inner: PostTreasuryOutboundPaymentBuilder<'a>, + id: &'a str, +} +impl<'a> PostTreasuryOutboundPayment<'a> { + pub fn new(id: &'a str) -> Self { + Self { id, inner: PostTreasuryOutboundPaymentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl PostTreasuryOutboundPayment<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for PostTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_payments/{id}/post"), + ) + .form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ReturnOutboundPaymentTreasuryOutboundPaymentBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// Optional hash to set the the return code. + #[serde(skip_serializing_if = "Option::is_none")] + pub returned_details: + Option, +} +impl<'a> ReturnOutboundPaymentTreasuryOutboundPaymentBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Optional hash to set the the return code. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetails { + /// The return code to be set on the OutboundPayment object. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, +} +impl ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetails { + pub fn new() -> Self { + Self::default() + } +} +/// The return code to be set on the OutboundPayment object. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + AccountClosed, + AccountFrozen, + BankAccountRestricted, + BankOwnershipChanged, + Declined, + IncorrectAccountHolderName, + InvalidAccountNumber, + InvalidCurrency, + NoAccount, + Other, +} +impl ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + pub fn as_str(self) -> &'static str { + use ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode::*; + match self { + AccountClosed => "account_closed", + AccountFrozen => "account_frozen", + BankAccountRestricted => "bank_account_restricted", + BankOwnershipChanged => "bank_ownership_changed", + Declined => "declined", + IncorrectAccountHolderName => "incorrect_account_holder_name", + InvalidAccountNumber => "invalid_account_number", + InvalidCurrency => "invalid_currency", + NoAccount => "no_account", + Other => "other", + } + } +} + +impl std::str::FromStr for ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + type Err = (); + fn from_str(s: &str) -> Result { + use ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode::*; + match s { + "account_closed" => Ok(AccountClosed), + "account_frozen" => Ok(AccountFrozen), + "bank_account_restricted" => Ok(BankAccountRestricted), + "bank_ownership_changed" => Ok(BankOwnershipChanged), + "declined" => Ok(Declined), + "incorrect_account_holder_name" => Ok(IncorrectAccountHolderName), + "invalid_account_number" => Ok(InvalidAccountNumber), + "invalid_currency" => Ok(InvalidCurrency), + "no_account" => Ok(NoAccount), + "other" => Ok(Other), + _ => Err(()), + } + } +} +impl std::fmt::Display for ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetailsCode { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Transitions a test mode created OutboundPayment to the `returned` status. +/// The OutboundPayment must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReturnOutboundPaymentTreasuryOutboundPayment<'a> { + inner: ReturnOutboundPaymentTreasuryOutboundPaymentBuilder<'a>, + id: &'a str, +} +impl<'a> ReturnOutboundPaymentTreasuryOutboundPayment<'a> { + pub fn new(id: &'a str) -> Self { + Self { id, inner: ReturnOutboundPaymentTreasuryOutboundPaymentBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn returned_details( + mut self, + returned_details: ReturnOutboundPaymentTreasuryOutboundPaymentBuilderReturnedDetails, + ) -> Self { + self.inner.returned_details = Some(returned_details); + self + } +} +impl ReturnOutboundPaymentTreasuryOutboundPayment<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryOutboundPaymentId, - ) -> stripe::Response { - client.send_form( - &format!("/treasury/outbound_payments/{id}/cancel"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ReturnOutboundPaymentTreasuryOutboundPayment<'_> { + type Output = stripe_treasury::TreasuryOutboundPayment; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_payments/{id}/return"), ) + .form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs b/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs index a5f1ac540..5c9c338d7 100644 --- a/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs +++ b/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs @@ -1,5 +1,260 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryOutboundTransfer<'a> { +pub struct CreateTreasuryOutboundTransferBuilder<'a> { + /// Amount (in cents) to be transferred. + pub amount: i64, + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// Must be a [supported currency](https://stripe.com/docs/currencies). + pub currency: stripe_types::Currency, + /// An arbitrary string attached to the object. Often useful for displaying to users. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + /// The PaymentMethod to use as the payment instrument for the OutboundTransfer. + #[serde(skip_serializing_if = "Option::is_none")] + pub destination_payment_method: Option<&'a str>, + /// Hash describing payment method configuration details. + #[serde(skip_serializing_if = "Option::is_none")] + pub destination_payment_method_options: + Option, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, + /// The FinancialAccount to pull funds from. + pub financial_account: &'a str, + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// This can be useful for storing additional information about the object in a structured format. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// Statement descriptor to be shown on the receiving end of an OutboundTransfer. + /// Maximum 10 characters for `ach` transfers or 140 characters for `wire` transfers. + /// The default value is `transfer`. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor: Option<&'a str>, +} +impl<'a> CreateTreasuryOutboundTransferBuilder<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency, financial_account: &'a str) -> Self { + Self { + amount, + currency, + description: None, + destination_payment_method: None, + destination_payment_method_options: None, + expand: None, + financial_account, + metadata: None, + statement_descriptor: None, + } + } +} +/// Hash describing payment method configuration details. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptions { + /// Optional fields for `us_bank_account`. + #[serde(skip_serializing_if = "Option::is_none")] + pub us_bank_account: + Option, +} +impl CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptions { + pub fn new() -> Self { + Self::default() + } +} +/// Optional fields for `us_bank_account`. +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccount { + /// Designate the OutboundTransfer as using a US bank account network configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub network: Option< + CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork, + >, +} +impl CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccount { + pub fn new() -> Self { + Self::default() + } +} +/// Designate the OutboundTransfer as using a US bank account network configuration. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { + Ach, + UsDomesticWire, +} +impl CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork { + pub fn as_str(self) -> &'static str { + use CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork::*; + match self { + Ach => "ach", + UsDomesticWire => "us_domestic_wire", + } + } +} + +impl std::str::FromStr + for CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork +{ + type Err = (); + fn from_str(s: &str) -> Result { + use CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork::*; + match s { + "ach" => Ok(Ach), + "us_domestic_wire" => Ok(UsDomesticWire), + _ => Err(()), + } + } +} +impl std::fmt::Display + for CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug + for CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize + for CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptionsUsBankAccountNetwork +{ + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Creates an OutboundTransfer. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryOutboundTransfer<'a> { + inner: CreateTreasuryOutboundTransferBuilder<'a>, +} +impl<'a> CreateTreasuryOutboundTransfer<'a> { + pub fn new(amount: i64, currency: stripe_types::Currency, financial_account: &'a str) -> Self { + Self { + inner: CreateTreasuryOutboundTransferBuilder::new(amount, currency, financial_account), + } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn destination_payment_method(mut self, destination_payment_method: &'a str) -> Self { + self.inner.destination_payment_method = Some(destination_payment_method); + self + } + + pub fn destination_payment_method_options( + mut self, + destination_payment_method_options: CreateTreasuryOutboundTransferBuilderDestinationPaymentMethodOptions, + ) -> Self { + self.inner.destination_payment_method_options = Some(destination_payment_method_options); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn metadata(mut self, metadata: &'a std::collections::HashMap) -> Self { + self.inner.metadata = Some(metadata); + self + } + + pub fn statement_descriptor(mut self, statement_descriptor: &'a str) -> Self { + self.inner.statement_descriptor = Some(statement_descriptor); + self + } +} +impl CreateTreasuryOutboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/treasury/outbound_transfers").form(&self.inner) + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryOutboundTransferBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryOutboundTransferBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryOutboundTransfer<'a> { + inner: RetrieveTreasuryOutboundTransferBuilder<'a>, + outbound_transfer: &'a stripe_treasury::TreasuryOutboundTransferId, +} +impl<'a> RetrieveTreasuryOutboundTransfer<'a> { + pub fn new(outbound_transfer: &'a stripe_treasury::TreasuryOutboundTransferId) -> Self { + Self { outbound_transfer, inner: RetrieveTreasuryOutboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryOutboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + let outbound_transfer = self.outbound_transfer; + RequestBuilder::new( + StripeMethod::Get, + format!("/treasury/outbound_transfers/{outbound_transfer}"), + ) + .query(&self.inner) + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ListTreasuryOutboundTransferBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -23,7 +278,7 @@ pub struct ListTreasuryOutboundTransfer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListTreasuryOutboundTransfer<'a> { +impl<'a> ListTreasuryOutboundTransferBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -35,122 +290,257 @@ impl<'a> ListTreasuryOutboundTransfer<'a> { } } } +/// Returns a list of OutboundTransfers sent from the specified FinancialAccount. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryOutboundTransfer<'a> { + inner: ListTreasuryOutboundTransferBuilder<'a>, +} impl<'a> ListTreasuryOutboundTransfer<'a> { - /// Returns a list of OutboundTransfers sent from the specified FinancialAccount. - pub fn send( + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryOutboundTransferBuilder::new(financial_account) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryOutboundTransferStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryOutboundTransfer<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/outbound_transfers", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/outbound_transfers", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryOutboundTransfer<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/outbound_transfers").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryOutboundTransfer<'a> { +pub struct CancelTreasuryOutboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTreasuryOutboundTransfer<'a> { +impl<'a> CancelTreasuryOutboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> RetrieveTreasuryOutboundTransfer<'a> { - /// Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list. - pub fn send( +/// An OutboundTransfer can be canceled if the funds have not yet been paid out. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CancelTreasuryOutboundTransfer<'a> { + inner: CancelTreasuryOutboundTransferBuilder<'a>, + outbound_transfer: &'a stripe_treasury::TreasuryOutboundTransferId, +} +impl<'a> CancelTreasuryOutboundTransfer<'a> { + pub fn new(outbound_transfer: &'a stripe_treasury::TreasuryOutboundTransferId) -> Self { + Self { outbound_transfer, inner: CancelTreasuryOutboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl CancelTreasuryOutboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - outbound_transfer: &stripe_treasury::TreasuryOutboundTransferId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/outbound_transfers/{outbound_transfer}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CancelTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + let outbound_transfer = self.outbound_transfer; + RequestBuilder::new( + StripeMethod::Post, + format!("/treasury/outbound_transfers/{outbound_transfer}/cancel"), + ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct FailTreasuryOutboundTransfer<'a> { +pub struct FailTreasuryOutboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> FailTreasuryOutboundTransfer<'a> { +impl<'a> FailTreasuryOutboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Transitions a test mode created OutboundTransfer to the `failed` status. +/// The OutboundTransfer must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct FailTreasuryOutboundTransfer<'a> { + inner: FailTreasuryOutboundTransferBuilder<'a>, + outbound_transfer: &'a str, +} impl<'a> FailTreasuryOutboundTransfer<'a> { - /// Transitions a test mode created OutboundTransfer to the `failed` status. - /// The OutboundTransfer must already be in the `processing` state. - pub fn send( + pub fn new(outbound_transfer: &'a str) -> Self { + Self { outbound_transfer, inner: FailTreasuryOutboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl FailTreasuryOutboundTransfer<'_> { + pub async fn send( &self, - client: &stripe::Client, - outbound_transfer: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for FailTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + let outbound_transfer = self.outbound_transfer; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PostTreasuryOutboundTransfer<'a> { +pub struct PostTreasuryOutboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> PostTreasuryOutboundTransfer<'a> { +impl<'a> PostTreasuryOutboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Transitions a test mode created OutboundTransfer to the `posted` status. +/// The OutboundTransfer must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct PostTreasuryOutboundTransfer<'a> { + inner: PostTreasuryOutboundTransferBuilder<'a>, + outbound_transfer: &'a str, +} impl<'a> PostTreasuryOutboundTransfer<'a> { - /// Transitions a test mode created OutboundTransfer to the `posted` status. - /// The OutboundTransfer must already be in the `processing` state. - pub fn send( + pub fn new(outbound_transfer: &'a str) -> Self { + Self { outbound_transfer, inner: PostTreasuryOutboundTransferBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl PostTreasuryOutboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - outbound_transfer: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post"), - self, - http_types::Method::Post, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for PostTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + let outbound_transfer = self.outbound_transfer; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post"), ) + .form(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnOutboundTransferTreasuryOutboundTransfer<'a> { +pub struct ReturnOutboundTransferTreasuryOutboundTransferBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// Details about a returned OutboundTransfer. #[serde(skip_serializing_if = "Option::is_none")] - pub returned_details: Option, + pub returned_details: + Option, } -impl<'a> ReturnOutboundTransferTreasuryOutboundTransfer<'a> { +impl<'a> ReturnOutboundTransferTreasuryOutboundTransferBuilder<'a> { pub fn new() -> Self { Self::default() } } /// Details about a returned OutboundTransfer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ReturnOutboundTransferTreasuryOutboundTransferReturnedDetails { +pub struct ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetails { /// Reason for the return. #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, + pub code: Option, } -impl ReturnOutboundTransferTreasuryOutboundTransferReturnedDetails { +impl ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetails { pub fn new() -> Self { Self::default() } } /// Reason for the return. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +pub enum ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode { AccountClosed, AccountFrozen, BankAccountRestricted, @@ -162,9 +552,9 @@ pub enum ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { NoAccount, Other, } -impl ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +impl ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode { pub fn as_str(self) -> &'static str { - use ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode::*; + use ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode::*; match self { AccountClosed => "account_closed", AccountFrozen => "account_frozen", @@ -180,10 +570,12 @@ impl ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { } } -impl std::str::FromStr for ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +impl std::str::FromStr + for ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode +{ type Err = (); fn from_str(s: &str) -> Result { - use ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode::*; + use ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode::*; match s { "account_closed" => Ok(AccountClosed), "account_frozen" => Ok(AccountFrozen), @@ -199,18 +591,20 @@ impl std::str::FromStr for ReturnOutboundTransferTreasuryOutboundTransferReturne } } } -impl std::fmt::Display for ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +impl std::fmt::Display + for ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode +{ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +impl std::fmt::Debug for ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ReturnOutboundTransferTreasuryOutboundTransferReturnedDetailsCode { +impl serde::Serialize for ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetailsCode { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -218,181 +612,58 @@ impl serde::Serialize for ReturnOutboundTransferTreasuryOutboundTransferReturned serializer.serialize_str(self.as_str()) } } -impl<'a> ReturnOutboundTransferTreasuryOutboundTransfer<'a> { - /// Transitions a test mode created OutboundTransfer to the `returned` status. - /// The OutboundTransfer must already be in the `processing` state. - pub fn send( - &self, - client: &stripe::Client, - outbound_transfer: &str, - ) -> stripe::Response { - client.send_form( - &format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return"), - self, - http_types::Method::Post, - ) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryOutboundTransfer<'a> { - /// Amount (in cents) to be transferred. - pub amount: i64, - /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - /// Must be a [supported currency](https://stripe.com/docs/currencies). - pub currency: stripe_types::Currency, - /// An arbitrary string attached to the object. Often useful for displaying to users. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - /// The PaymentMethod to use as the payment instrument for the OutboundTransfer. - #[serde(skip_serializing_if = "Option::is_none")] - pub destination_payment_method: Option<&'a str>, - /// Hash describing payment method configuration details. - #[serde(skip_serializing_if = "Option::is_none")] - pub destination_payment_method_options: - Option, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The FinancialAccount to pull funds from. - pub financial_account: &'a str, - /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. - /// This can be useful for storing additional information about the object in a structured format. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// Statement descriptor to be shown on the receiving end of an OutboundTransfer. - /// Maximum 10 characters for `ach` transfers or 140 characters for `us_domestic_wire` transfers. - /// The default value is "transfer". - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, +/// Transitions a test mode created OutboundTransfer to the `returned` status. +/// The OutboundTransfer must already be in the `processing` state. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ReturnOutboundTransferTreasuryOutboundTransfer<'a> { + inner: ReturnOutboundTransferTreasuryOutboundTransferBuilder<'a>, + outbound_transfer: &'a str, } -impl<'a> CreateTreasuryOutboundTransfer<'a> { - pub fn new(amount: i64, currency: stripe_types::Currency, financial_account: &'a str) -> Self { +impl<'a> ReturnOutboundTransferTreasuryOutboundTransfer<'a> { + pub fn new(outbound_transfer: &'a str) -> Self { Self { - amount, - currency, - description: None, - destination_payment_method: None, - destination_payment_method_options: None, - expand: None, - financial_account, - metadata: None, - statement_descriptor: None, + outbound_transfer, + inner: ReturnOutboundTransferTreasuryOutboundTransferBuilder::new(), } } -} -/// Hash describing payment method configuration details. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundTransferDestinationPaymentMethodOptions { - /// Optional fields for `us_bank_account`. - #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account: - Option, -} -impl CreateTreasuryOutboundTransferDestinationPaymentMethodOptions { - pub fn new() -> Self { - Self::default() + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self } -} -/// Optional fields for `us_bank_account`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccount { - /// Designate the OutboundTransfer as using a US bank account network configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub network: - Option, -} -impl CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccount { - pub fn new() -> Self { - Self::default() - } -} -/// Designate the OutboundTransfer as using a US bank account network configuration. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork { - Ach, - UsDomesticWire, -} -impl CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork { - pub fn as_str(self) -> &'static str { - use CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork::*; - match self { - Ach => "ach", - UsDomesticWire => "us_domestic_wire", - } - } -} -impl std::str::FromStr - for CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork -{ - type Err = (); - fn from_str(s: &str) -> Result { - use CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork::*; - match s { - "ach" => Ok(Ach), - "us_domestic_wire" => Ok(UsDomesticWire), - _ => Err(()), - } + pub fn returned_details( + mut self, + returned_details: ReturnOutboundTransferTreasuryOutboundTransferBuilderReturnedDetails, + ) -> Self { + self.inner.returned_details = Some(returned_details); + self } } -impl std::fmt::Display - for CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl ReturnOutboundTransferTreasuryOutboundTransfer<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } -} -impl std::fmt::Debug - for CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize - for CreateTreasuryOutboundTransferDestinationPaymentMethodOptionsUsBankAccountNetwork -{ - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> CreateTreasuryOutboundTransfer<'a> { - /// Creates an OutboundTransfer. - pub fn send( + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/treasury/outbound_transfers", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CancelTreasuryOutboundTransfer<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> CancelTreasuryOutboundTransfer<'a> { - pub fn new() -> Self { - Self::default() + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) } } -impl<'a> CancelTreasuryOutboundTransfer<'a> { - /// An OutboundTransfer can be canceled if the funds have not yet been paid out. - pub fn send( - &self, - client: &stripe::Client, - outbound_transfer: &stripe_treasury::TreasuryOutboundTransferId, - ) -> stripe::Response { - client.send_form( - &format!("/treasury/outbound_transfers/{outbound_transfer}/cancel"), - self, - http_types::Method::Post, + +impl StripeRequest for ReturnOutboundTransferTreasuryOutboundTransfer<'_> { + type Output = stripe_treasury::TreasuryOutboundTransfer; + + fn build(&self) -> RequestBuilder { + let outbound_transfer = self.outbound_transfer; + RequestBuilder::new( + StripeMethod::Post, + format!("/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return"), ) + .form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_received_credit/requests.rs b/generated/stripe_treasury/src/treasury_received_credit/requests.rs index fd87be55a..5d7c754f4 100644 --- a/generated/stripe_treasury/src/treasury_received_credit/requests.rs +++ b/generated/stripe_treasury/src/treasury_received_credit/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryReceivedCredit<'a> { +pub struct ListTreasuryReceivedCreditBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -16,7 +20,7 @@ pub struct ListTreasuryReceivedCredit<'a> { pub limit: Option, /// Only return ReceivedCredits described by the flow. #[serde(skip_serializing_if = "Option::is_none")] - pub linked_flows: Option, + pub linked_flows: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @@ -26,7 +30,7 @@ pub struct ListTreasuryReceivedCredit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListTreasuryReceivedCredit<'a> { +impl<'a> ListTreasuryReceivedCreditBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -41,26 +45,28 @@ impl<'a> ListTreasuryReceivedCredit<'a> { } /// Only return ReceivedCredits described by the flow. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryReceivedCreditLinkedFlows { +pub struct ListTreasuryReceivedCreditBuilderLinkedFlows { /// The source flow type. - pub source_flow_type: ListTreasuryReceivedCreditLinkedFlowsSourceFlowType, + pub source_flow_type: ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType, } -impl ListTreasuryReceivedCreditLinkedFlows { - pub fn new(source_flow_type: ListTreasuryReceivedCreditLinkedFlowsSourceFlowType) -> Self { +impl ListTreasuryReceivedCreditBuilderLinkedFlows { + pub fn new( + source_flow_type: ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType, + ) -> Self { Self { source_flow_type } } } /// The source flow type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +pub enum ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { CreditReversal, Other, OutboundPayment, Payout, } -impl ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +impl ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { pub fn as_str(self) -> &'static str { - use ListTreasuryReceivedCreditLinkedFlowsSourceFlowType::*; + use ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType::*; match self { CreditReversal => "credit_reversal", Other => "other", @@ -70,10 +76,10 @@ impl ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { } } -impl std::str::FromStr for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +impl std::str::FromStr for ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { type Err = (); fn from_str(s: &str) -> Result { - use ListTreasuryReceivedCreditLinkedFlowsSourceFlowType::*; + use ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType::*; match s { "credit_reversal" => Ok(CreditReversal), "other" => Ok(Other), @@ -83,18 +89,18 @@ impl std::str::FromStr for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { } } } -impl std::fmt::Display for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +impl std::fmt::Display for ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +impl std::fmt::Debug for ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { +impl serde::Serialize for ListTreasuryReceivedCreditBuilderLinkedFlowsSourceFlowType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -102,43 +108,124 @@ impl serde::Serialize for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { serializer.serialize_str(self.as_str()) } } +/// Returns a list of ReceivedCredits. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryReceivedCredit<'a> { + inner: ListTreasuryReceivedCreditBuilder<'a>, +} impl<'a> ListTreasuryReceivedCredit<'a> { - /// Returns a list of ReceivedCredits. - pub fn send( + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryReceivedCreditBuilder::new(financial_account) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn linked_flows( + mut self, + linked_flows: ListTreasuryReceivedCreditBuilderLinkedFlows, + ) -> Self { + self.inner.linked_flows = Some(linked_flows); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryReceivedCreditStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryReceivedCredit<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/received_credits", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/received_credits", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryReceivedCredit<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/received_credits").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryReceivedCredit<'a> { +pub struct RetrieveTreasuryReceivedCreditBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTreasuryReceivedCredit<'a> { +impl<'a> RetrieveTreasuryReceivedCreditBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryReceivedCredit<'a> { + inner: RetrieveTreasuryReceivedCreditBuilder<'a>, + id: &'a stripe_treasury::TreasuryReceivedCreditId, +} impl<'a> RetrieveTreasuryReceivedCredit<'a> { - /// Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list. - pub fn send( + pub fn new(id: &'a stripe_treasury::TreasuryReceivedCreditId) -> Self { + Self { id, inner: RetrieveTreasuryReceivedCreditBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryReceivedCredit<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryReceivedCreditId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/received_credits/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryReceivedCredit<'_> { + type Output = stripe_treasury::TreasuryReceivedCredit; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/received_credits/{id}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryReceivedCredit<'a> { +pub struct CreateTreasuryReceivedCreditBuilder<'a> { /// Amount (in cents) to be transferred. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -155,16 +242,16 @@ pub struct CreateTreasuryReceivedCredit<'a> { /// Initiating payment method details for the object. #[serde(skip_serializing_if = "Option::is_none")] pub initiating_payment_method_details: - Option>, + Option>, /// The rails used for the object. - pub network: CreateTreasuryReceivedCreditNetwork, + pub network: CreateTreasuryReceivedCreditBuilderNetwork, } -impl<'a> CreateTreasuryReceivedCredit<'a> { +impl<'a> CreateTreasuryReceivedCreditBuilder<'a> { pub fn new( amount: i64, currency: stripe_types::Currency, financial_account: &'a str, - network: CreateTreasuryReceivedCreditNetwork, + network: CreateTreasuryReceivedCreditBuilderNetwork, ) -> Self { Self { amount, @@ -179,56 +266,58 @@ impl<'a> CreateTreasuryReceivedCredit<'a> { } /// Initiating payment method details for the object. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryReceivedCreditInitiatingPaymentMethodDetails<'a> { +pub struct CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetails<'a> { /// The source type. #[serde(rename = "type")] - pub type_: CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType, + pub type_: CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType, /// Optional fields for `us_bank_account`. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option>, + Option>, } -impl<'a> CreateTreasuryReceivedCreditInitiatingPaymentMethodDetails<'a> { - pub fn new(type_: CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType) -> Self { +impl<'a> CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetails<'a> { + pub fn new( + type_: CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType, + ) -> Self { Self { type_, us_bank_account: None } } } /// The source type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +pub enum CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { UsBankAccount, } -impl CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +impl CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { pub fn as_str(self) -> &'static str { - use CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType::*; + use CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType::*; match self { UsBankAccount => "us_bank_account", } } } -impl std::str::FromStr for CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +impl std::str::FromStr for CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType::*; + use CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType::*; match s { "us_bank_account" => Ok(UsBankAccount), _ => Err(()), } } } -impl std::fmt::Display for CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +impl std::fmt::Display for CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +impl std::fmt::Debug for CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsType { +impl serde::Serialize for CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -238,7 +327,7 @@ impl serde::Serialize for CreateTreasuryReceivedCreditInitiatingPaymentMethodDet } /// Optional fields for `us_bank_account`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsUsBankAccount<'a> { +pub struct CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsUsBankAccount<'a> { /// The bank account holder's name. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, @@ -249,20 +338,20 @@ pub struct CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsUsBankAccou #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreateTreasuryReceivedCreditInitiatingPaymentMethodDetailsUsBankAccount<'a> { +impl<'a> CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetailsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// The rails used for the object. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryReceivedCreditNetwork { +pub enum CreateTreasuryReceivedCreditBuilderNetwork { Ach, UsDomesticWire, } -impl CreateTreasuryReceivedCreditNetwork { +impl CreateTreasuryReceivedCreditBuilderNetwork { pub fn as_str(self) -> &'static str { - use CreateTreasuryReceivedCreditNetwork::*; + use CreateTreasuryReceivedCreditBuilderNetwork::*; match self { Ach => "ach", UsDomesticWire => "us_domestic_wire", @@ -270,10 +359,10 @@ impl CreateTreasuryReceivedCreditNetwork { } } -impl std::str::FromStr for CreateTreasuryReceivedCreditNetwork { +impl std::str::FromStr for CreateTreasuryReceivedCreditBuilderNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryReceivedCreditNetwork::*; + use CreateTreasuryReceivedCreditBuilderNetwork::*; match s { "ach" => Ok(Ach), "us_domestic_wire" => Ok(UsDomesticWire), @@ -281,18 +370,18 @@ impl std::str::FromStr for CreateTreasuryReceivedCreditNetwork { } } } -impl std::fmt::Display for CreateTreasuryReceivedCreditNetwork { +impl std::fmt::Display for CreateTreasuryReceivedCreditBuilderNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryReceivedCreditNetwork { +impl std::fmt::Debug for CreateTreasuryReceivedCreditBuilderNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryReceivedCreditNetwork { +impl serde::Serialize for CreateTreasuryReceivedCreditBuilderNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -300,13 +389,67 @@ impl serde::Serialize for CreateTreasuryReceivedCreditNetwork { serializer.serialize_str(self.as_str()) } } +/// Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. +/// In live mode, you can’t directly create ReceivedCredits initiated by third parties. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryReceivedCredit<'a> { + inner: CreateTreasuryReceivedCreditBuilder<'a>, +} impl<'a> CreateTreasuryReceivedCredit<'a> { - /// Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. - /// In live mode, you can’t directly create ReceivedCredits initiated by third parties. - pub fn send( + pub fn new( + amount: i64, + currency: stripe_types::Currency, + financial_account: &'a str, + network: CreateTreasuryReceivedCreditBuilderNetwork, + ) -> Self { + Self { + inner: CreateTreasuryReceivedCreditBuilder::new( + amount, + currency, + financial_account, + network, + ), + } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn initiating_payment_method_details( + mut self, + initiating_payment_method_details: CreateTreasuryReceivedCreditBuilderInitiatingPaymentMethodDetails<'a>, + ) -> Self { + self.inner.initiating_payment_method_details = Some(initiating_payment_method_details); + self + } +} +impl CreateTreasuryReceivedCredit<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/test_helpers/treasury/received_credits", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryReceivedCredit<'_> { + type Output = stripe_treasury::TreasuryReceivedCredit; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/test_helpers/treasury/received_credits") + .form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_received_debit/requests.rs b/generated/stripe_treasury/src/treasury_received_debit/requests.rs index d04972f91..bc22f7d21 100644 --- a/generated/stripe_treasury/src/treasury_received_debit/requests.rs +++ b/generated/stripe_treasury/src/treasury_received_debit/requests.rs @@ -1,5 +1,9 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryReceivedDebit<'a> { +pub struct ListTreasuryReceivedDebitBuilder<'a> { /// A cursor for use in pagination. /// `ending_before` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. @@ -23,7 +27,7 @@ pub struct ListTreasuryReceivedDebit<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } -impl<'a> ListTreasuryReceivedDebit<'a> { +impl<'a> ListTreasuryReceivedDebitBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { ending_before: None, @@ -35,43 +39,116 @@ impl<'a> ListTreasuryReceivedDebit<'a> { } } } +/// Returns a list of ReceivedDebits. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryReceivedDebit<'a> { + inner: ListTreasuryReceivedDebitBuilder<'a>, +} impl<'a> ListTreasuryReceivedDebit<'a> { - /// Returns a list of ReceivedDebits. - pub fn send( + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryReceivedDebitBuilder::new(financial_account) } + } + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryReceivedDebitStatus) -> Self { + self.inner.status = Some(status); + self + } +} +impl ListTreasuryReceivedDebit<'_> { + pub async fn send( &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/received_debits", self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/received_debits", self) + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryReceivedDebit<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/received_debits").query(&self.inner) } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryReceivedDebit<'a> { +pub struct RetrieveTreasuryReceivedDebitBuilder<'a> { /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, } -impl<'a> RetrieveTreasuryReceivedDebit<'a> { +impl<'a> RetrieveTreasuryReceivedDebitBuilder<'a> { pub fn new() -> Self { Self::default() } } +/// Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryReceivedDebit<'a> { + inner: RetrieveTreasuryReceivedDebitBuilder<'a>, + id: &'a stripe_treasury::TreasuryReceivedDebitId, +} impl<'a> RetrieveTreasuryReceivedDebit<'a> { - /// Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list. - pub fn send( + pub fn new(id: &'a stripe_treasury::TreasuryReceivedDebitId) -> Self { + Self { id, inner: RetrieveTreasuryReceivedDebitBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryReceivedDebit<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryReceivedDebitId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/received_debits/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryReceivedDebit<'_> { + type Output = stripe_treasury::TreasuryReceivedDebit; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/received_debits/{id}")) + .query(&self.inner) } } #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryReceivedDebit<'a> { +pub struct CreateTreasuryReceivedDebitBuilder<'a> { /// Amount (in cents) to be transferred. pub amount: i64, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -88,16 +165,16 @@ pub struct CreateTreasuryReceivedDebit<'a> { /// Initiating payment method details for the object. #[serde(skip_serializing_if = "Option::is_none")] pub initiating_payment_method_details: - Option>, + Option>, /// The rails used for the object. - pub network: CreateTreasuryReceivedDebitNetwork, + pub network: CreateTreasuryReceivedDebitBuilderNetwork, } -impl<'a> CreateTreasuryReceivedDebit<'a> { +impl<'a> CreateTreasuryReceivedDebitBuilder<'a> { pub fn new( amount: i64, currency: stripe_types::Currency, financial_account: &'a str, - network: CreateTreasuryReceivedDebitNetwork, + network: CreateTreasuryReceivedDebitBuilderNetwork, ) -> Self { Self { amount, @@ -112,56 +189,58 @@ impl<'a> CreateTreasuryReceivedDebit<'a> { } /// Initiating payment method details for the object. #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTreasuryReceivedDebitInitiatingPaymentMethodDetails<'a> { +pub struct CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetails<'a> { /// The source type. #[serde(rename = "type")] - pub type_: CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType, + pub type_: CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType, /// Optional fields for `us_bank_account`. #[serde(skip_serializing_if = "Option::is_none")] pub us_bank_account: - Option>, + Option>, } -impl<'a> CreateTreasuryReceivedDebitInitiatingPaymentMethodDetails<'a> { - pub fn new(type_: CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType) -> Self { +impl<'a> CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetails<'a> { + pub fn new( + type_: CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType, + ) -> Self { Self { type_, us_bank_account: None } } } /// The source type. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +pub enum CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { UsBankAccount, } -impl CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +impl CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { pub fn as_str(self) -> &'static str { - use CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType::*; + use CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType::*; match self { UsBankAccount => "us_bank_account", } } } -impl std::str::FromStr for CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +impl std::str::FromStr for CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType::*; + use CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType::*; match s { "us_bank_account" => Ok(UsBankAccount), _ => Err(()), } } } -impl std::fmt::Display for CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +impl std::fmt::Display for CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +impl std::fmt::Debug for CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsType { +impl serde::Serialize for CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -171,7 +250,7 @@ impl serde::Serialize for CreateTreasuryReceivedDebitInitiatingPaymentMethodDeta } /// Optional fields for `us_bank_account`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsUsBankAccount<'a> { +pub struct CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsUsBankAccount<'a> { /// The bank account holder's name. #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_name: Option<&'a str>, @@ -182,47 +261,47 @@ pub struct CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsUsBankAccoun #[serde(skip_serializing_if = "Option::is_none")] pub routing_number: Option<&'a str>, } -impl<'a> CreateTreasuryReceivedDebitInitiatingPaymentMethodDetailsUsBankAccount<'a> { +impl<'a> CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetailsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } /// The rails used for the object. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateTreasuryReceivedDebitNetwork { +pub enum CreateTreasuryReceivedDebitBuilderNetwork { Ach, } -impl CreateTreasuryReceivedDebitNetwork { +impl CreateTreasuryReceivedDebitBuilderNetwork { pub fn as_str(self) -> &'static str { - use CreateTreasuryReceivedDebitNetwork::*; + use CreateTreasuryReceivedDebitBuilderNetwork::*; match self { Ach => "ach", } } } -impl std::str::FromStr for CreateTreasuryReceivedDebitNetwork { +impl std::str::FromStr for CreateTreasuryReceivedDebitBuilderNetwork { type Err = (); fn from_str(s: &str) -> Result { - use CreateTreasuryReceivedDebitNetwork::*; + use CreateTreasuryReceivedDebitBuilderNetwork::*; match s { "ach" => Ok(Ach), _ => Err(()), } } } -impl std::fmt::Display for CreateTreasuryReceivedDebitNetwork { +impl std::fmt::Display for CreateTreasuryReceivedDebitBuilderNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateTreasuryReceivedDebitNetwork { +impl std::fmt::Debug for CreateTreasuryReceivedDebitBuilderNetwork { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateTreasuryReceivedDebitNetwork { +impl serde::Serialize for CreateTreasuryReceivedDebitBuilderNetwork { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -230,13 +309,67 @@ impl serde::Serialize for CreateTreasuryReceivedDebitNetwork { serializer.serialize_str(self.as_str()) } } +/// Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. +/// In live mode, you can’t directly create ReceivedDebits initiated by third parties. +#[derive(Clone, Debug, serde::Serialize)] +pub struct CreateTreasuryReceivedDebit<'a> { + inner: CreateTreasuryReceivedDebitBuilder<'a>, +} impl<'a> CreateTreasuryReceivedDebit<'a> { - /// Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. - /// In live mode, you can’t directly create ReceivedDebits initiated by third parties. - pub fn send( + pub fn new( + amount: i64, + currency: stripe_types::Currency, + financial_account: &'a str, + network: CreateTreasuryReceivedDebitBuilderNetwork, + ) -> Self { + Self { + inner: CreateTreasuryReceivedDebitBuilder::new( + amount, + currency, + financial_account, + network, + ), + } + } + pub fn description(mut self, description: &'a str) -> Self { + self.inner.description = Some(description); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn initiating_payment_method_details( + mut self, + initiating_payment_method_details: CreateTreasuryReceivedDebitBuilderInitiatingPaymentMethodDetails<'a>, + ) -> Self { + self.inner.initiating_payment_method_details = Some(initiating_payment_method_details); + self + } +} +impl CreateTreasuryReceivedDebit<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/test_helpers/treasury/received_debits", self, http_types::Method::Post) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for CreateTreasuryReceivedDebit<'_> { + type Output = stripe_treasury::TreasuryReceivedDebit; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Post, "/test_helpers/treasury/received_debits") + .form(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_transaction/requests.rs b/generated/stripe_treasury/src/treasury_transaction/requests.rs index e9dc83b9f..84355fa8a 100644 --- a/generated/stripe_treasury/src/treasury_transaction/requests.rs +++ b/generated/stripe_treasury/src/treasury_transaction/requests.rs @@ -1,5 +1,60 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryTransactionBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryTransactionBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves the details of an existing Transaction. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryTransaction<'a> { + inner: RetrieveTreasuryTransactionBuilder<'a>, + id: &'a stripe_treasury::TreasuryTransactionId, +} +impl<'a> RetrieveTreasuryTransaction<'a> { + pub fn new(id: &'a stripe_treasury::TreasuryTransactionId) -> Self { + Self { id, inner: RetrieveTreasuryTransactionBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryTransaction<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryTransaction<'_> { + type Output = stripe_treasury::TreasuryTransaction; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/transactions/{id}")) + .query(&self.inner) + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryTransaction<'a> { +pub struct ListTreasuryTransactionBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// A cursor for use in pagination. @@ -19,7 +74,7 @@ pub struct ListTreasuryTransaction<'a> { /// The results are in reverse chronological order by `created` or `posted_at`. /// The default is `created`. #[serde(skip_serializing_if = "Option::is_none")] - pub order_by: Option, + pub order_by: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @@ -31,9 +86,9 @@ pub struct ListTreasuryTransaction<'a> { /// A filter for the `status_transitions.posted_at` timestamp. /// When using this filter, `status=posted` and `order_by=posted_at` must also be specified. #[serde(skip_serializing_if = "Option::is_none")] - pub status_transitions: Option, + pub status_transitions: Option, } -impl<'a> ListTreasuryTransaction<'a> { +impl<'a> ListTreasuryTransactionBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { created: None, @@ -51,13 +106,13 @@ impl<'a> ListTreasuryTransaction<'a> { /// The results are in reverse chronological order by `created` or `posted_at`. /// The default is `created`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryTransactionOrderBy { +pub enum ListTreasuryTransactionBuilderOrderBy { Created, PostedAt, } -impl ListTreasuryTransactionOrderBy { +impl ListTreasuryTransactionBuilderOrderBy { pub fn as_str(self) -> &'static str { - use ListTreasuryTransactionOrderBy::*; + use ListTreasuryTransactionBuilderOrderBy::*; match self { Created => "created", PostedAt => "posted_at", @@ -65,10 +120,10 @@ impl ListTreasuryTransactionOrderBy { } } -impl std::str::FromStr for ListTreasuryTransactionOrderBy { +impl std::str::FromStr for ListTreasuryTransactionBuilderOrderBy { type Err = (); fn from_str(s: &str) -> Result { - use ListTreasuryTransactionOrderBy::*; + use ListTreasuryTransactionBuilderOrderBy::*; match s { "created" => Ok(Created), "posted_at" => Ok(PostedAt), @@ -76,18 +131,18 @@ impl std::str::FromStr for ListTreasuryTransactionOrderBy { } } } -impl std::fmt::Display for ListTreasuryTransactionOrderBy { +impl std::fmt::Display for ListTreasuryTransactionBuilderOrderBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTreasuryTransactionOrderBy { +impl std::fmt::Debug for ListTreasuryTransactionBuilderOrderBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTreasuryTransactionOrderBy { +impl serde::Serialize for ListTreasuryTransactionBuilderOrderBy { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -98,48 +153,88 @@ impl serde::Serialize for ListTreasuryTransactionOrderBy { /// A filter for the `status_transitions.posted_at` timestamp. /// When using this filter, `status=posted` and `order_by=posted_at` must also be specified. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListTreasuryTransactionStatusTransitions { +pub struct ListTreasuryTransactionBuilderStatusTransitions { /// Returns Transactions with `posted_at` within the specified range. #[serde(skip_serializing_if = "Option::is_none")] pub posted_at: Option, } -impl ListTreasuryTransactionStatusTransitions { +impl ListTreasuryTransactionBuilderStatusTransitions { pub fn new() -> Self { Self::default() } } +/// Retrieves a list of Transaction objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryTransaction<'a> { + inner: ListTreasuryTransactionBuilder<'a>, +} impl<'a> ListTreasuryTransaction<'a> { - /// Retrieves a list of Transaction objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/transactions", self) + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryTransactionBuilder::new(financial_account) } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/transactions", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryTransaction<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTreasuryTransaction<'a> { - pub fn new() -> Self { - Self::default() + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn order_by(mut self, order_by: ListTreasuryTransactionBuilderOrderBy) -> Self { + self.inner.order_by = Some(order_by); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn status(mut self, status: stripe_treasury::TreasuryTransactionStatus) -> Self { + self.inner.status = Some(status); + self + } + + pub fn status_transitions( + mut self, + status_transitions: ListTreasuryTransactionBuilderStatusTransitions, + ) -> Self { + self.inner.status_transitions = Some(status_transitions); + self } } -impl<'a> RetrieveTreasuryTransaction<'a> { - /// Retrieves the details of an existing Transaction. - pub fn send( +impl ListTreasuryTransaction<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryTransactionId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/transactions/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryTransaction<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/transactions").query(&self.inner) } } diff --git a/generated/stripe_treasury/src/treasury_transaction_entry/requests.rs b/generated/stripe_treasury/src/treasury_transaction_entry/requests.rs index 5e1cbf5d3..f738c3fc5 100644 --- a/generated/stripe_treasury/src/treasury_transaction_entry/requests.rs +++ b/generated/stripe_treasury/src/treasury_transaction_entry/requests.rs @@ -1,5 +1,60 @@ +use stripe_client_core::{ + RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest, +}; + +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveTreasuryTransactionEntryBuilder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, +} +impl<'a> RetrieveTreasuryTransactionEntryBuilder<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Retrieves a TransactionEntry object. +#[derive(Clone, Debug, serde::Serialize)] +pub struct RetrieveTreasuryTransactionEntry<'a> { + inner: RetrieveTreasuryTransactionEntryBuilder<'a>, + id: &'a stripe_treasury::TreasuryTransactionEntryId, +} +impl<'a> RetrieveTreasuryTransactionEntry<'a> { + pub fn new(id: &'a stripe_treasury::TreasuryTransactionEntryId) -> Self { + Self { id, inner: RetrieveTreasuryTransactionEntryBuilder::new() } + } + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } +} +impl RetrieveTreasuryTransactionEntry<'_> { + pub async fn send( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for RetrieveTreasuryTransactionEntry<'_> { + type Output = stripe_treasury::TreasuryTransactionEntry; + + fn build(&self) -> RequestBuilder { + let id = self.id; + RequestBuilder::new(StripeMethod::Get, format!("/treasury/transaction_entries/{id}")) + .query(&self.inner) + } +} #[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ListTreasuryTransactionEntry<'a> { +pub struct ListTreasuryTransactionEntryBuilder<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -21,7 +76,7 @@ pub struct ListTreasuryTransactionEntry<'a> { /// The results are in reverse chronological order by `created` or `effective_at`. /// The default is `created`. #[serde(skip_serializing_if = "Option::is_none")] - pub order_by: Option, + pub order_by: Option, /// A cursor for use in pagination. /// `starting_after` is an object ID that defines your place in the list. /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. @@ -31,7 +86,7 @@ pub struct ListTreasuryTransactionEntry<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub transaction: Option<&'a str>, } -impl<'a> ListTreasuryTransactionEntry<'a> { +impl<'a> ListTreasuryTransactionEntryBuilder<'a> { pub fn new(financial_account: &'a str) -> Self { Self { created: None, @@ -49,13 +104,13 @@ impl<'a> ListTreasuryTransactionEntry<'a> { /// The results are in reverse chronological order by `created` or `effective_at`. /// The default is `created`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryTransactionEntryOrderBy { +pub enum ListTreasuryTransactionEntryBuilderOrderBy { Created, EffectiveAt, } -impl ListTreasuryTransactionEntryOrderBy { +impl ListTreasuryTransactionEntryBuilderOrderBy { pub fn as_str(self) -> &'static str { - use ListTreasuryTransactionEntryOrderBy::*; + use ListTreasuryTransactionEntryBuilderOrderBy::*; match self { Created => "created", EffectiveAt => "effective_at", @@ -63,10 +118,10 @@ impl ListTreasuryTransactionEntryOrderBy { } } -impl std::str::FromStr for ListTreasuryTransactionEntryOrderBy { +impl std::str::FromStr for ListTreasuryTransactionEntryBuilderOrderBy { type Err = (); fn from_str(s: &str) -> Result { - use ListTreasuryTransactionEntryOrderBy::*; + use ListTreasuryTransactionEntryBuilderOrderBy::*; match s { "created" => Ok(Created), "effective_at" => Ok(EffectiveAt), @@ -74,18 +129,18 @@ impl std::str::FromStr for ListTreasuryTransactionEntryOrderBy { } } } -impl std::fmt::Display for ListTreasuryTransactionEntryOrderBy { +impl std::fmt::Display for ListTreasuryTransactionEntryBuilderOrderBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for ListTreasuryTransactionEntryOrderBy { +impl std::fmt::Debug for ListTreasuryTransactionEntryBuilderOrderBy { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for ListTreasuryTransactionEntryOrderBy { +impl serde::Serialize for ListTreasuryTransactionEntryBuilderOrderBy { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -93,38 +148,75 @@ impl serde::Serialize for ListTreasuryTransactionEntryOrderBy { serializer.serialize_str(self.as_str()) } } +/// Retrieves a list of TransactionEntry objects. +#[derive(Clone, Debug, serde::Serialize)] +pub struct ListTreasuryTransactionEntry<'a> { + inner: ListTreasuryTransactionEntryBuilder<'a>, +} impl<'a> ListTreasuryTransactionEntry<'a> { - /// Retrieves a list of TransactionEntry objects. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/treasury/transaction_entries", self) + pub fn new(financial_account: &'a str) -> Self { + Self { inner: ListTreasuryTransactionEntryBuilder::new(financial_account) } } - pub fn paginate( - self, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/treasury/transaction_entries", self) + pub fn created(mut self, created: stripe_types::RangeQueryTs) -> Self { + self.inner.created = Some(created); + self } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveTreasuryTransactionEntry<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveTreasuryTransactionEntry<'a> { - pub fn new() -> Self { - Self::default() + + pub fn effective_at(mut self, effective_at: stripe_types::RangeQueryTs) -> Self { + self.inner.effective_at = Some(effective_at); + self + } + + pub fn ending_before(mut self, ending_before: &'a str) -> Self { + self.inner.ending_before = Some(ending_before); + self + } + + pub fn expand(mut self, expand: &'a [&'a str]) -> Self { + self.inner.expand = Some(expand); + self + } + + pub fn limit(mut self, limit: i64) -> Self { + self.inner.limit = Some(limit); + self + } + + pub fn order_by(mut self, order_by: ListTreasuryTransactionEntryBuilderOrderBy) -> Self { + self.inner.order_by = Some(order_by); + self + } + + pub fn starting_after(mut self, starting_after: &'a str) -> Self { + self.inner.starting_after = Some(starting_after); + self + } + + pub fn transaction(mut self, transaction: &'a str) -> Self { + self.inner.transaction = Some(transaction); + self } } -impl<'a> RetrieveTreasuryTransactionEntry<'a> { - /// Retrieves a TransactionEntry object. - pub fn send( +impl ListTreasuryTransactionEntry<'_> { + pub async fn send( &self, - client: &stripe::Client, - id: &stripe_treasury::TreasuryTransactionEntryId, - ) -> stripe::Response { - client.get_query(&format!("/treasury/transaction_entries/{id}"), self) + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()).await + } + + pub fn send_blocking( + &self, + client: &C, + ) -> Result<::Output, C::Err> { + client.execute(self.customize()) + } +} + +impl StripeRequest for ListTreasuryTransactionEntry<'_> { + type Output = stripe_types::List; + + fn build(&self) -> RequestBuilder { + RequestBuilder::new(StripeMethod::Get, "/treasury/transaction_entries").query(&self.inner) } } diff --git a/openapi/src/codegen.rs b/openapi/src/codegen.rs index 0d4935ad9..1b1ecf6dc 100644 --- a/openapi/src/codegen.rs +++ b/openapi/src/codegen.rs @@ -50,8 +50,7 @@ impl CodeGen { write_to_file(version_file_content, base_path.join("version.rs"))?; let _ = writeln!(mod_rs_contents, "pub mod version;"); - append_to_file(mod_rs_contents, mod_rs_path)?; - Ok(()) + append_to_file(mod_rs_contents, mod_rs_path) } fn write_components(&self) -> anyhow::Result<()> { @@ -127,7 +126,15 @@ impl CodeGen { fn write_component_requests(&self, comp: &StripeObject) -> anyhow::Result<()> { let req_content = gen_requests(&comp.requests, &self.components); - write_to_file(req_content, comp.get_requests_content_path())?; + + let req_file_content = formatdoc! { + r#" + use stripe_client_core::{{StripeClient, StripeBlockingClient, StripeRequest, RequestBuilder, StripeMethod}}; + + {req_content} + "# + }; + write_to_file(req_file_content, comp.get_requests_content_path())?; let feature_gate = comp.mod_path(); let new_mod_file_content = formatdoc! { r#" diff --git a/openapi/src/object_writing.rs b/openapi/src/object_writing.rs index ea3efe846..bec3a2132 100644 --- a/openapi/src/object_writing.rs +++ b/openapi/src/object_writing.rs @@ -38,7 +38,10 @@ impl Components { RustObject::Struct(fields) => { let should_derive_default = fields.iter().all(|field| field.rust_type.is_option()); writer.derive_default(should_derive_default); - writer.write_struct(out, fields); + writer.write_struct_definition(out, fields); + if metadata.kind.is_request_param() { + writer.write_struct_constructor(out, fields); + } for field in fields { if let Some((obj, meta)) = field.rust_type.extract_object() { @@ -112,7 +115,9 @@ pub fn gen_requests(specs: &[RequestSpec], components: &Components) -> String { let mut out = String::with_capacity(128); for req in specs { - components.write_rust_type_objs(&req.params, &mut out); + if let Some(params) = &req.params { + components.write_rust_type_objs(¶ms.typ, &mut out); + } let req_body = req.gen(components); let _ = write!(out, "{}", req_body); diff --git a/openapi/src/overrides.rs b/openapi/src/overrides.rs index 7b37f3149..2353ddf04 100644 --- a/openapi/src/overrides.rs +++ b/openapi/src/overrides.rs @@ -6,7 +6,6 @@ use crate::rust_object::{ObjectKind, ObjectMetadata, RustObject}; use crate::rust_type::{PathToType, RustType}; use crate::stripe_object::OperationType; use crate::types::RustIdent; -use crate::utils::get_request_param_field; use crate::visitor::VisitMut; #[derive(Debug, Clone, Eq, PartialEq)] @@ -56,7 +55,8 @@ fn get_override_object( data: &OverrideData, ) -> anyhow::Result<(RustObject, OverrideMetadata)> { let req = components.get_request_spec(data.source).context("Request source not found")?; - let (obj, _) = get_request_param_field(req, data.source.field_name) + let (obj, _) = req + .get_param_field(data.source.field_name) .context("Could not extract field")? .extract_object() .context("Not an object")?; diff --git a/openapi/src/requests.rs b/openapi/src/requests.rs index 6b1ec6394..bf88615ef 100644 --- a/openapi/src/requests.rs +++ b/openapi/src/requests.rs @@ -9,7 +9,7 @@ use crate::rust_object::{ObjectKind, ObjectMetadata, RustObject}; use crate::rust_type::{RustType, SimpleType}; use crate::spec::{get_ok_response_schema, get_request_form_parameters, Spec}; use crate::spec_inference::Inference; -use crate::stripe_object::{OperationType, PathParam, RequestSpec, StripeOperation}; +use crate::stripe_object::{OperationType, PathParam, RequestParam, RequestSpec, StripeOperation}; use crate::types::{ComponentPath, RustIdent}; /// Should we skip a currently unsupported request? @@ -190,14 +190,16 @@ fn build_request( method_name: &str, path_id_map: &HashMap, ) -> anyhow::Result { - let params_ident = RustIdent::joined(method_name, parent_ident); - let return_ident = RustIdent::joined(¶ms_ident, "returned"); + let req_builder_ident = RustIdent::joined(method_name, parent_ident); + let return_ident = RustIdent::joined(&req_builder_ident, "returned"); let return_type = Inference::new(&return_ident, ObjectKind::RequestReturned) .required(true) .infer_schema_or_ref_type(req.returned); - let param_inference = - Inference::new(¶ms_ident, ObjectKind::RequestParam).can_borrow(true).required(true); + let param_inner_ident = RustIdent::joined(&req_builder_ident, "Builder"); + let param_inference = Inference::new(¶m_inner_ident, ObjectKind::RequestParam) + .can_borrow(true) + .required(true); let param_typ = match &req.params { RequestParams::Form(schema) => schema.map(|s| param_inference.infer_schema_or_ref_type(s)), @@ -219,17 +221,11 @@ fn build_request( } Some(RustType::Object( RustObject::Struct(struct_fields), - ObjectMetadata::new(params_ident.clone(), ObjectKind::RequestParam), + ObjectMetadata::new(param_inner_ident.clone(), ObjectKind::RequestParam), )) } }, - } - .unwrap_or_else(|| { - RustType::Object( - RustObject::Struct(vec![]), - ObjectMetadata::new(params_ident.clone(), ObjectKind::RequestParam), - ) - }); + }; let req_path = req.path.trim_start_matches("/v1"); @@ -238,7 +234,7 @@ fn build_request( let ParameterSchemaOrContent::Schema(schema) = ¶m.format else { bail!("Expected path parameter to follow schema format"); }; - let base_param_typ = Inference::new(¶ms_ident, ObjectKind::RequestParam) + let base_param_typ = Inference::new(&req_builder_ident, ObjectKind::RequestParam) .can_borrow(true) .required(param.required) .maybe_description(param.description.as_deref()) @@ -259,8 +255,9 @@ fn build_request( path_params.push(PathParam { name: param.name.clone(), rust_type }) } Ok(RequestSpec { + ident: req_builder_ident, path_params, - params: param_typ, + params: param_typ.map(|t| RequestParam { ident: param_inner_ident, typ: t }), doc_comment: req.description.map(|d| d.to_string()), req_path: req_path.to_string(), returned: return_type, diff --git a/openapi/src/rust_object.rs b/openapi/src/rust_object.rs index ef6f28003..74e51eeaf 100644 --- a/openapi/src/rust_object.rs +++ b/openapi/src/rust_object.rs @@ -193,17 +193,13 @@ impl Debug for StructField { } impl StructField { - pub fn new(field_name: T, rust_type: RustType, required: bool) -> Self { + pub fn new(field_name: T, rust_type: RustType) -> Self { Self { field_name: field_name.to_string(), doc_comment: None, rename_as: None, - required, - vis: if rust_type.implies_private_field() { - Visibility::Private - } else { - Visibility::Public - }, + required: false, + vis: Visibility::Public, rust_type, } } @@ -219,6 +215,16 @@ impl StructField { self.doc_comment = Some(doc_comment.to_string()); self } + + pub fn vis(mut self, vis: Visibility) -> Self { + self.vis = vis; + self + } + + pub fn required(mut self, required: bool) -> Self { + self.required = required; + self + } } pub fn as_enum_of_objects<'a>( diff --git a/openapi/src/rust_type.rs b/openapi/src/rust_type.rs index 63f3bd2c2..dd08990f8 100644 --- a/openapi/src/rust_type.rs +++ b/openapi/src/rust_type.rs @@ -150,10 +150,6 @@ impl RustType { } } - pub fn implies_private_field(&self) -> bool { - matches!(self, Self::Simple(SimpleType::Ext(ExtType::AlwaysTrue))) - } - /// Is this type `Option<>`? pub const fn is_option(&self) -> bool { matches!(self, Self::Container(Container::Option(_))) diff --git a/openapi/src/spec_inference.rs b/openapi/src/spec_inference.rs index af5fdd929..e18334b8b 100644 --- a/openapi/src/spec_inference.rs +++ b/openapi/src/spec_inference.rs @@ -9,7 +9,7 @@ use openapiv3::{ }; use crate::rust_object::{ - EnumVariant, FieldlessVariant, ObjectKind, ObjectMetadata, RustObject, StructField, + EnumVariant, FieldlessVariant, ObjectKind, ObjectMetadata, RustObject, StructField, Visibility, }; use crate::rust_type::{ExtType, IntType, RustType, SimpleType}; use crate::spec::{ @@ -299,7 +299,15 @@ impl<'a> Inference<'a> { if field_rename == "type" { field_rename = "type_".into(); } - let mut struct_field = StructField::new(&field_rename, rust_type, self.required); + + // The `deleted` field is only used as a de/ser discriminant, so there is no reason to make it public + let force_private = + matches!(rust_type, RustType::Simple(SimpleType::Ext(ExtType::AlwaysTrue))); + + let mut struct_field = StructField::new(&field_rename, rust_type).required(self.required); + if force_private { + struct_field = struct_field.vis(Visibility::Private); + } if let Some(doc) = self.description { struct_field = struct_field.doc(doc); } diff --git a/openapi/src/stripe_object.rs b/openapi/src/stripe_object.rs index ee228025b..040f6fc47 100644 --- a/openapi/src/stripe_object.rs +++ b/openapi/src/stripe_object.rs @@ -7,9 +7,10 @@ use lazy_static::lazy_static; use openapiv3::Schema; use serde::{Deserialize, Serialize}; +use crate::components::Components; use crate::crates::Crate; use crate::deduplication::DeduppedObject; -use crate::rust_object::{ObjectKind, RustObject}; +use crate::rust_object::{ObjectKind, RustObject, StructField}; use crate::rust_type::RustType; use crate::spec_inference::Inference; use crate::types::{ComponentPath, RustIdent}; @@ -323,8 +324,9 @@ fn infer_object_ident(path: &ComponentPath) -> RustIdent { #[derive(Debug, Clone)] pub struct RequestSpec { + pub ident: RustIdent, pub path_params: Vec, - pub params: RustType, + pub params: Option, pub method_type: OperationType, pub returned: RustType, pub doc_comment: Option, @@ -332,15 +334,47 @@ pub struct RequestSpec { pub method_name: String, } +#[derive(Debug, Clone)] +pub struct RequestParam { + pub ident: RustIdent, + pub typ: RustType, +} + impl RequestSpec { pub fn visit<'a, V: Visit<'a>>(&'a self, visitor: &mut V) { visitor.visit_typ(&self.returned); - visitor.visit_typ(&self.params); + if let Some(params) = &self.params { + visitor.visit_typ(¶ms.typ); + } } pub fn visit_mut(&mut self, visitor: &mut V) { visitor.visit_typ_mut(&mut self.returned); - visitor.visit_typ_mut(&mut self.params); + if let Some(params) = &mut self.params { + visitor.visit_typ_mut(&mut params.typ); + } + } + + pub fn has_reference(&self, components: &Components) -> bool { + if !self.path_params.is_empty() { + return true; + } + let Some(params) = &self.params else { + return false; + }; + params.typ.has_reference(components) + } + + pub fn param_struct_fields(&self) -> Option<&[StructField]> { + let params = self.params.as_ref()?; + match ¶ms.typ.as_rust_object()? { + RustObject::Struct(fields) => Some(fields), + _ => None, + } + } + + pub fn get_param_field(&self, field: &str) -> Option<&RustType> { + self.params.as_ref()?.typ.as_rust_object()?.get_struct_field(field) } } diff --git a/openapi/src/templates/cargo_toml.rs b/openapi/src/templates/cargo_toml.rs index 586fdebbb..f78e28c05 100644 --- a/openapi/src/templates/cargo_toml.rs +++ b/openapi/src/templates/cargo_toml.rs @@ -4,16 +4,6 @@ use indoc::formatdoc; use crate::crates::Crate; -const CORE_FEATURES: &[&str] = &[ - "runtime-tokio-hyper", - "runtime-tokio-hyper-rustls", - "runtime-tokio-hyper-rustls-webpki", - "runtime-blocking", - "runtime-blocking-rustls", - "runtime-blocking-rustls-webpki", - "runtime-async-std-surf", -]; - pub fn gen_crate_toml(krate: Crate, crate_deps: Vec, crate_features: Vec) -> String { let mut crate_dep_section = String::new(); for dep in crate_deps { @@ -25,12 +15,7 @@ pub fn gen_crate_toml(krate: Crate, crate_deps: Vec, crate_features: Vec< let request_deps = if krate == Crate::SHARED { "".into() } else { - formatdoc! { - r#" - http-types.workspace = true - async-stripe = {{path = "../../async-stripe"}} - "# - } + format!(r#"stripe_client_core = {{path = "../../stripe_client_core"}}"#) }; let features = @@ -58,7 +43,6 @@ pub fn gen_crate_toml(krate: Crate, crate_deps: Vec, crate_features: Vec< smol_str.workspace = true serde_json.workspace = true stripe_types = {{path = "../../stripe_types"}} - {request_deps} {crate_dep_section} @@ -69,41 +53,27 @@ pub fn gen_crate_toml(krate: Crate, crate_deps: Vec, crate_features: Vec< } fn gen_feature_section(mut crate_features: Vec) -> String { + assert!(!crate_features.is_empty(), "expected crate to have features"); let mut feature_section = String::new(); - for feature in CORE_FEATURES { - let _ = writeln!(feature_section, r#"{feature} = ["async-stripe/{feature}"]"#); - } - feature_section.push('\n'); crate_features.sort_unstable(); for feature in &crate_features { let _ = writeln!(feature_section, "{feature} = []"); } - if !crate_features.is_empty() { - feature_section.push('\n'); - let _ = writeln!( - feature_section, - "full = [{}]", - crate_features - .iter() - .map(|feat| format!(r#""{feat}""#)) - .collect::>() - .join(",\n") - ); - } + feature_section.push('\n'); + let _ = writeln!( + feature_section, + "full = [{}]", + crate_features.iter().map(|feat| format!(r#""{feat}""#)).collect::>().join(",\n") + ); - let mut docs_rs_features = String::from(r#"["runtime-tokio-hyper""#); - if !crate_features.is_empty() { - docs_rs_features.push_str(r#", "full""#); - } - docs_rs_features.push(']'); formatdoc! { r#" [features] {feature_section} [package.metadata.docs.rs] - features = {docs_rs_features} + features = ["full"] "# } } diff --git a/openapi/src/templates/requests.rs b/openapi/src/templates/requests.rs index 721347e62..b61318682 100644 --- a/openapi/src/templates/requests.rs +++ b/openapi/src/templates/requests.rs @@ -3,10 +3,12 @@ use std::fmt::Write; use indoc::{formatdoc, writedoc}; use crate::components::Components; -use crate::printable::{Lifetime, PrintableType}; +use crate::printable::{Lifetime, PrintableWithLifetime}; +use crate::rust_object::{ObjectKind, StructField, Visibility}; use crate::rust_type::{Container, RustType}; use crate::stripe_object::{OperationType, RequestSpec}; use crate::templates::utils::write_doc_comment; +use crate::templates::ObjectWriter; impl RequestSpec { fn gen_path_arg(&self) -> String { @@ -14,99 +16,223 @@ impl RequestSpec { // Parameterized request path if !self.path_params.is_empty() { - format!(r#"&format!("{req_path}")"#) + format!(r#"format!("{req_path}")"#) // Plain request path } else { format!(r#""{req_path}""#) } } - fn gen_method_path_params(&self, components: &Components) -> String { - self.path_params - .iter() - .map(|p| format!("{}:{}", p.name, components.construct_printable_type(&p.rust_type))) - .collect::>() - .join(",") - } - pub fn gen(&self, components: &Components) -> String { - let mut req_out = String::with_capacity(128); - self.write_req_body(&mut req_out, components); - - let lifetime_str = - if self.params.has_reference(components) { Lifetime.as_param() } else { "" }; - let impl_for = components.construct_printable_type(&self.params); - if let Some(pagination_kind) = as_pagination_kind(&self.returned) { - self.gen_paginate( - components.construct_printable_type(&self.returned), - pagination_kind, - &mut req_out, - components, - ) - } - formatdoc!( + let build_inner = self.write_build_inner(); + + let lifetime_str = if self.has_reference(components) { "<'_>" } else { "" }; + let impl_for = &self.ident; + // if let Some(pagination_kind) = as_pagination_kind(&self.returned) { + // self.gen_paginate( + // components.construct_printable_type(&self.returned), + // pagination_kind, + // &mut req_out, + // components, + // ) + // } + + let impl_for_str = format!("{impl_for}{lifetime_str}"); + + let return_type = components.construct_printable_type(&self.returned); + let mut out = self.write_builder_struct(components); + let _ = writedoc!( + out, r#" - impl{lifetime_str} {impl_for}{lifetime_str} {{ - {req_out} + impl {impl_for_str} {{ + pub async fn send(&self, client: &C) -> Result<::Output, C::Err> {{ + client.execute(self.customize()).await + }} + + pub fn send_blocking(&self, client: &C) -> Result<::Output, C::Err> {{ + client.execute(self.customize()) + }} + }} + + impl StripeRequest for {impl_for_str} {{ + type Output = {return_type}; + + {build_inner} }} "# - ) + ); + out } - fn write_req_body(&self, out: &mut String, components: &Components) { - let return_type = components.construct_printable_type(&self.returned); + fn write_build_inner(&self) -> String { let path_arg = self.gen_path_arg(); - let path_params = self.gen_method_path_params(components); let method_enum = match self.method_type { OperationType::Get => "Get", OperationType::Post => "Post", OperationType::Delete => "Delete", }; - let body = match self.method_type { - OperationType::Get => { - format!("client.get_query({path_arg}, self)") - } - OperationType::Post | OperationType::Delete => { - format!("client.send_form({path_arg}, self, http_types::Method::{method_enum})") + let mut build_inner = String::new(); + for param in &self.path_params { + let name = ¶m.name; + let _ = writeln!(build_inner, r#"let {name} = self.{name};"#); + } + let _ = write!(build_inner, "RequestBuilder::new(StripeMethod::{method_enum}, {path_arg})"); + + if self.params.is_some() { + if matches!(self.method_type, OperationType::Get) { + let _ = write!(build_inner, ".query(&self.inner)"); + } else { + let _ = write!(build_inner, ".form(&self.inner)"); } - }; - if let Some(doc) = &self.doc_comment { - let comment = write_doc_comment(doc, 2); - let _ = write!(out, "{comment}"); } - let _ = writedoc!( - out, + + formatdoc!( r#" - pub fn send(&self, client: &stripe::Client, {path_params}) -> stripe::Response<{return_type}> {{ - {body} + fn build(&self) -> RequestBuilder {{ + {build_inner} }} "# - ); + ) } - fn gen_paginate( - &self, - pagination_typ: PrintableType, - kind: PaginationKind, - out: &mut String, - components: &Components, - ) { - let path = self.gen_path_arg(); - let path_params = self.gen_method_path_params(components); - - let paginate_method_name = match kind { - PaginationKind::List => "from_list_params", - PaginationKind::Search => "from_search_params", + // fn gen_paginate( + // &self, + // pagination_typ: PrintableType, + // kind: PaginationKind, + // out: &mut String, + // components: &Components, + // ) { + // let path = self.gen_path_arg(); + // let path_params = self.gen_method_path_params(components); + // + // let paginate_method_name = match kind { + // PaginationKind::List => "from_list_params", + // PaginationKind::Search => "from_search_params", + // }; + // let _ = writedoc!( + // out, + // r#" + // pub fn paginate(self, {path_params}) -> stripe::ListPaginator<{pagination_typ}> {{ + // stripe::ListPaginator::{paginate_method_name}({path}, self) + // }} + // "# + // ); + // } + + fn write_builder_struct(&self, components: &Components) -> String { + let name = &self.ident; + let mut out = String::new(); + let (lifetime, lifetime_str) = if self.has_reference(components) { + (Some(Lifetime), Lifetime.as_param()) + } else { + (None, "") + }; + if let Some(doc) = &self.doc_comment { + let _ = writeln!(out, "{}", write_doc_comment(doc, 1).trim_end()); + } + + let mut fields = vec![]; + + if let Some(req_param) = &self.params { + fields.push(StructField::new("inner", req_param.typ.clone()).vis(Visibility::Private)); + } + + for arg in &self.path_params { + fields + .push(StructField::new(&arg.name, arg.rust_type.clone()).vis(Visibility::Private)); + } + + ObjectWriter::new(components, &self.ident, ObjectKind::RequestParam) + .lifetime(lifetime) + .write_struct_definition(&mut out, &fields); + + let mut required_args = self + .path_params + .iter() + .map(|p| { + format!( + "{}:{}", + p.name, + PrintableWithLifetime::new( + &components.construct_printable_type(&p.rust_type), + lifetime + ) + ) + }) + .collect::>(); + + let mut required_fields = vec![]; + let mut optional_fields = vec![]; + if let Some(fields) = self.param_struct_fields() { + for field in fields { + if field.required { + required_fields.push((&field.field_name, &field.rust_type)); + } else { + optional_fields.push((&field.field_name, &field.rust_type)) + } + } + } + for (f_name, typ) in &required_fields { + let typ = components.construct_printable_type(typ); + let printable = PrintableWithLifetime::new(&typ, lifetime); + required_args.push(format!("{f_name}:{printable}")) + } + let required_arg_str = required_args.join(","); + + let mut cons_inner = String::new(); + for path in &self.path_params { + let _ = write!(cons_inner, "{},", path.name); + } + + if let Some(req_param) = &self.params { + let builder_name = components.construct_printable_type(&req_param.typ); + let mut builder_params = String::new(); + for (f_name, _) in &required_fields { + let _ = write!(builder_params, "{f_name},"); + } + let _ = write!(cons_inner, "inner: {builder_name}::new({builder_params})"); + } + + let mut cons_body = formatdoc! { + r" + pub fn new({required_arg_str}) -> Self {{ + Self {{ + {cons_inner} + }} + }} + " }; + + for (f_name, typ) in &optional_fields { + let typ = match typ { + RustType::Container(Container::Option(inner)) => inner, + _ => panic!("expected `Option`, found {typ:?}"), + }; + let typ = components.construct_printable_type(typ); + let typ = PrintableWithLifetime::new(&typ, lifetime); + let _ = writedoc!( + cons_body, + r#" + pub fn {f_name}(mut self, {f_name}: {typ}) -> Self {{ + self.inner.{f_name} = Some({f_name}); + self + }} + + "# + ); + } + let _ = writedoc!( out, - r#" - pub fn paginate(self, {path_params}) -> stripe::ListPaginator<{pagination_typ}> {{ - stripe::ListPaginator::{paginate_method_name}({path}, self) - }} - "# + r" + impl{lifetime_str} {name}{lifetime_str} {{ + {cons_body} + }} + " ); + + out } } diff --git a/openapi/src/templates/structs.rs b/openapi/src/templates/structs.rs index fc6553b74..e438cba08 100644 --- a/openapi/src/templates/structs.rs +++ b/openapi/src/templates/structs.rs @@ -8,7 +8,7 @@ use crate::templates::utils::{write_doc_comment, write_serde_rename}; use crate::templates::ObjectWriter; impl<'a> ObjectWriter<'a> { - pub fn write_struct(&self, out: &mut String, fields: &[StructField]) { + pub fn write_struct_definition(&self, out: &mut String, fields: &[StructField]) { let name = self.ident; let mut fields_str = String::with_capacity(64); @@ -26,52 +26,62 @@ impl<'a> ObjectWriter<'a> { }} " ); + } - if self.obj_kind.is_request_param() { - let cons_body = if self.derives.default { - r" + fn get_required_param_args(&self, fields: &[StructField]) -> String { + let mut params = String::new(); + for field in fields.iter().filter(|f| f.required) { + let printable = self.get_printable(&field.rust_type); + let typ = PrintableWithLifetime::new(&printable, self.lifetime); + let _ = write!(params, "{}: {typ},", field.field_name); + } + params + } + + pub fn write_struct_constructor(&self, out: &mut String, fields: &[StructField]) { + let name = self.ident; + let lifetime_str = self.lifetime_param(); + let cons_body = if self.derives.default { + r" pub fn new() -> Self { Self::default() } " - .into() - } else { - let mut cons_inner = String::new(); - let mut params = String::new(); - for field in fields { - if field.required { - let printable = self.get_printable(&field.rust_type); - let typ = PrintableWithLifetime::new(&printable, self.lifetime); - let _ = write!(params, "{}: {typ},", field.field_name); - let _ = write!(cons_inner, "{},", field.field_name); - } else { - // `Default::default()` would also evaluate to `None` for `Option` types, but nice to - // generate less code and maybe make things easier for the compiler since most - // of these types are `Option`. - let field_default_val = - if field.rust_type.is_option() { "None" } else { "Default::default()" }; - let _ = write!(cons_inner, "{}: {field_default_val},", field.field_name); - } + .into() + } else { + let mut cons_inner = String::new(); + let params = self.get_required_param_args(fields); + for field in fields { + let f_name = &field.field_name; + if field.required { + let _ = write!(cons_inner, "{f_name},"); + } else { + // `Default::default()` would also evaluate to `None` for `Option` types, but nice to + // generate less code and maybe make things easier for the compiler since pretty much all + // of these types are `Option`. + let field_default_val = + if field.rust_type.is_option() { "None" } else { "Default::default()" }; + let _ = write!(cons_inner, "{f_name}: {field_default_val},"); } - formatdoc! { - r" + } + formatdoc! { + r" pub fn new({params}) -> Self {{ Self {{ {cons_inner} }} - }} + }} " - } - }; - let _ = writedoc!( - out, - r" + } + }; + let _ = writedoc!( + out, + r" impl{lifetime_str} {name}{lifetime_str} {{ {cons_body} }} " - ); - } + ); } fn write_struct_field(&self, out: &mut String, field: &StructField) { diff --git a/openapi/src/utils.rs b/openapi/src/utils.rs index 7d5f2cfa1..4a50a6252 100644 --- a/openapi/src/utils.rs +++ b/openapi/src/utils.rs @@ -4,9 +4,6 @@ use std::path::{Path, PathBuf}; use anyhow::Context; -use crate::rust_type::RustType; -use crate::stripe_object::RequestSpec; - /// Write to a file, starting paths from the `out` directory and ensuring existence /// of directories along the way. pub fn write_to_file, P: AsRef>( @@ -44,7 +41,3 @@ fn write_or_append_to_outfile, P: AsRef>( .write_all(content.as_ref())?; Ok(()) } - -pub fn get_request_param_field<'a>(req: &'a RequestSpec, field: &str) -> Option<&'a RustType> { - req.params.as_rust_object()?.get_struct_field(field) -} diff --git a/stripe_client_core/Cargo.toml b/stripe_client_core/Cargo.toml new file mode 100644 index 000000000..9c5926311 --- /dev/null +++ b/stripe_client_core/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "stripe_client_core" +version.workspace = true +description.workspace = true +rust-version.workspace = true +authors.workspace = true +license.workspace = true +readme.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +keywords.workspace = true +categories.workspace = true +edition.workspace = true + +[dependencies] +stripe_shared = { path = "../generated/stripe_shared" } +serde = "1.0.197" +serde_qs = "0.12.0" +serde_json = "1.0.115" +uuid = { version = "1.6.1", optional = true, features = ["v4"] } diff --git a/async-stripe/src/client/headers.rs b/stripe_client_core/src/headers.rs similarity index 71% rename from async-stripe/src/client/headers.rs rename to stripe_client_core/src/headers.rs index c381c854d..9151731ab 100644 --- a/async-stripe/src/client/headers.rs +++ b/stripe_client_core/src/headers.rs @@ -1,8 +1,9 @@ use std::fmt::{Display, Formatter}; -use crate::AccountId; -use crate::ApiVersion; -use crate::ApplicationId; +use stripe_shared::version::VERSION; +use stripe_shared::{AccountId, ApiVersion, ApplicationId}; + +pub(crate) static USER_AGENT: &str = concat!("Stripe/v1 RustBindings/", env!("CARGO_PKG_VERSION")); #[derive(Clone, Default)] pub struct AppInfo { @@ -34,8 +35,19 @@ pub struct Headers { pub stripe_account: Option, } +impl Default for Headers { + fn default() -> Self { + Self { + stripe_version: VERSION, + user_agent: USER_AGENT.to_string(), + client_id: None, + stripe_account: None, + } + } +} + impl Headers { - pub fn to_array(&self) -> [(&str, Option<&str>); 4] { + pub fn to_array(&self) -> [(&'static str, Option<&str>); 4] { [ ("Client-Id", self.client_id.as_deref()), ("Stripe-Account", self.stripe_account.as_deref()), diff --git a/stripe_client_core/src/lib.rs b/stripe_client_core/src/lib.rs new file mode 100644 index 000000000..79bcb8e6d --- /dev/null +++ b/stripe_client_core/src/lib.rs @@ -0,0 +1,7 @@ +pub mod headers; +pub mod request_strategy; +mod stripe_request; + +pub use stripe_request::*; +pub use stripe_shared::version::VERSION; +pub use stripe_shared::{AccountId, ApiVersion, ApplicationId}; diff --git a/async-stripe/src/client/request_strategy.rs b/stripe_client_core/src/request_strategy.rs similarity index 95% rename from async-stripe/src/client/request_strategy.rs rename to stripe_client_core/src/request_strategy.rs index e72edfd42..b37c64c58 100644 --- a/async-stripe/src/client/request_strategy.rs +++ b/stripe_client_core/src/request_strategy.rs @@ -1,6 +1,13 @@ use std::time::Duration; -use http_types::StatusCode; +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct StripeStatusCode(pub u16); + +impl StripeStatusCode { + pub fn is_client_error(&self) -> bool { + (400..500).contains(&self.0) + } +} #[derive(Clone, Debug)] pub enum RequestStrategy { @@ -20,7 +27,7 @@ pub enum RequestStrategy { impl RequestStrategy { pub fn test( &self, - status: Option, + status: Option, stripe_should_retry: Option, retry_count: u32, ) -> Outcome { diff --git a/stripe_client_core/src/stripe_request.rs b/stripe_client_core/src/stripe_request.rs new file mode 100644 index 000000000..43cbc7abe --- /dev/null +++ b/stripe_client_core/src/stripe_request.rs @@ -0,0 +1,82 @@ +use std::marker::PhantomData; + +use serde::de::DeserializeOwned; +use serde::Serialize; + +use crate::request_strategy::RequestStrategy; + +#[derive(Debug, Copy, Clone)] +pub enum StripeMethod { + Get, + Post, + Delete, +} + +pub trait StripeClient { + type Err; + + fn execute( + &self, + req: CustomizedStripeRequest, + ) -> impl std::future::Future>; +} + +pub trait StripeBlockingClient { + type Err; + + fn execute(&self, req: CustomizedStripeRequest) + -> Result; +} + +pub trait StripeRequest { + type Output; + + fn build(&self) -> RequestBuilder; + + fn customize(&self) -> CustomizedStripeRequest { + CustomizedStripeRequest { + inner: self.build(), + request_strategy: RequestStrategy::Once, + _output: PhantomData, + } + } +} + +pub struct CustomizedStripeRequest { + pub inner: RequestBuilder, + pub request_strategy: RequestStrategy, + _output: PhantomData, +} + +impl CustomizedStripeRequest { + pub async fn send(self, client: &C) -> Result { + client.execute(self).await + } + + pub fn send_blocking(self, client: &C) -> Result { + client.execute(self) + } +} + +pub struct RequestBuilder { + pub query: Option, + pub body: Option, + pub path: String, + pub method: StripeMethod, +} + +impl RequestBuilder { + pub fn new(method: StripeMethod, path: impl Into) -> Self { + Self { path: path.into(), method, query: None, body: None } + } + + pub fn query(mut self, params: &P) -> Self { + self.query = Some(serde_qs::to_string(params).expect("valid serialization")); + self + } + + pub fn form(mut self, form: &F) -> Self { + self.body = Some(serde_qs::to_string(form).expect("valid serialization")); + self + } +} diff --git a/stripe_types/Cargo.toml b/stripe_types/Cargo.toml index 067503983..a429a7c18 100644 --- a/stripe_types/Cargo.toml +++ b/stripe_types/Cargo.toml @@ -12,9 +12,7 @@ keywords.workspace = true categories.workspace = true [dependencies] -serde = {workspace = true } +serde = { workspace = true } smol_str.workspace = true serde_json.workspace = true - -[dev-dependencies] -serde_qs = "0.12.0" \ No newline at end of file +serde_qs = "0.12.0" diff --git a/stripe_webhook/src/generated/mod.rs b/stripe_webhook/src/generated/mod.rs index 65ffb1753..cca5a65ec 100644 --- a/stripe_webhook/src/generated/mod.rs +++ b/stripe_webhook/src/generated/mod.rs @@ -147,27 +147,6 @@ pub enum EventObject { /// Occurs when a Checkout Session is expired. #[cfg(feature = "stripe_checkout")] CheckoutSessionExpired(stripe_checkout::CheckoutSession), - /// Occurs when a Climate order is canceled. - #[cfg(feature = "stripe_misc")] - ClimateOrderCanceled(stripe_misc::ClimateOrder), - /// Occurs when a Climate order is created. - #[cfg(feature = "stripe_misc")] - ClimateOrderCreated(stripe_misc::ClimateOrder), - /// Occurs when a Climate order is delayed. - #[cfg(feature = "stripe_misc")] - ClimateOrderDelayed(stripe_misc::ClimateOrder), - /// Occurs when a Climate order is delivered. - #[cfg(feature = "stripe_misc")] - ClimateOrderDelivered(stripe_misc::ClimateOrder), - /// Occurs when a Climate order's product is substituted for another. - #[cfg(feature = "stripe_misc")] - ClimateOrderProductSubstituted(stripe_misc::ClimateOrder), - /// Occurs when a Climate product is created. - #[cfg(feature = "stripe_misc")] - ClimateProductCreated(stripe_misc::ClimateProduct), - /// Occurs when a Climate product is updated. - #[cfg(feature = "stripe_misc")] - ClimateProductPricingUpdated(stripe_misc::ClimateProduct), /// Occurs whenever a coupon is created. CouponCreated(stripe_shared::Coupon), /// Occurs whenever a coupon is deleted. @@ -243,9 +222,6 @@ pub enum EventObject { /// Occurs when an Account’s `balance_refresh` status transitions from `pending` to either `succeeded` or `failed`. #[cfg(feature = "stripe_misc")] FinancialConnectionsAccountRefreshedBalance(stripe_misc::FinancialConnectionsAccount), - /// Occurs when an Account’s `transaction_refresh` status transitions from `pending` to either `succeeded` or `failed`. - #[cfg(feature = "stripe_misc")] - FinancialConnectionsAccountRefreshedTransactions(stripe_misc::FinancialConnectionsAccount), /// Occurs whenever a VerificationSession is canceled #[cfg(feature = "stripe_misc")] IdentityVerificationSessionCanceled(stripe_misc::IdentityVerificationSession), @@ -690,34 +666,6 @@ impl EventObject { "checkout.session.expired" => { EventObject::CheckoutSessionExpired(serde_json::from_value(data)?) } - #[cfg(feature = "stripe_misc")] - "climate.order.canceled" => { - EventObject::ClimateOrderCanceled(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.order.created" => { - EventObject::ClimateOrderCreated(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.order.delayed" => { - EventObject::ClimateOrderDelayed(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.order.delivered" => { - EventObject::ClimateOrderDelivered(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.order.product_substituted" => { - EventObject::ClimateOrderProductSubstituted(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.product.created" => { - EventObject::ClimateProductCreated(serde_json::from_value(data)?) - } - #[cfg(feature = "stripe_misc")] - "climate.product.pricing_updated" => { - EventObject::ClimateProductPricingUpdated(serde_json::from_value(data)?) - } "coupon.created" => EventObject::CouponCreated(serde_json::from_value(data)?), "coupon.deleted" => EventObject::CouponDeleted(serde_json::from_value(data)?), "coupon.updated" => EventObject::CouponUpdated(serde_json::from_value(data)?), @@ -808,12 +756,6 @@ impl EventObject { )?) } #[cfg(feature = "stripe_misc")] - "financial_connections.account.refreshed_transactions" => { - EventObject::FinancialConnectionsAccountRefreshedTransactions( - serde_json::from_value(data)?, - ) - } - #[cfg(feature = "stripe_misc")] "identity.verification_session.canceled" => { EventObject::IdentityVerificationSessionCanceled(serde_json::from_value(data)?) } diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9ad327741..2f913d493 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -13,23 +13,11 @@ httpmock = "0.6.7" wiremock = "0.5.22" futures-util = { version = "0.3.21" } tokio = { version = "1.24.1", features = ["rt", "macros"] } -stripe_types = {path = "../stripe_types"} -async-stripe = {path = "../async-stripe"} -stripe_connect = {path = "../generated/stripe_connect", features = ["account", "transfer_reversal"]} -stripe_billing = {path = "../generated/stripe_billing", features = ["invoice", "plan", "subscription", "subscription_item", "usage_record"]} -stripe_core = {path = "../generated/stripe_core", features = ["customer", "charge", "token"]} -stripe_checkout = {path = "../generated/stripe_checkout", features = ["checkout_session"]} -stripe_product = {path = "../generated/stripe_product", features = ["product", "price", "promotion_code"]} -stripe_misc = {path = "../generated/stripe_misc"} - -[features] -async = [] -blocking = [] - -runtime-tokio-hyper = ["async-stripe/runtime-tokio-hyper", "async"] -runtime-tokio-hyper-rustls = ["async-stripe/runtime-tokio-hyper-rustls", "async"] -runtime-tokio-hyper-rustls-webpki = ["async-stripe/runtime-tokio-hyper-rustls-webpki", "async"] -runtime-blocking = ["async-stripe/runtime-blocking", "blocking"] -runtime-blocking-rustls = ["async-stripe/runtime-blocking-rustls", "blocking"] -runtime-blocking-rustls-webpki = ["async-stripe/runtime-blocking-rustls-webpki", "blocking"] -runtime-async-std-surf = ["async-stripe/runtime-async-std-surf", "async"] \ No newline at end of file +stripe_types = { path = "../stripe_types" } +async-stripe = { path = "../async-stripe" } +stripe_connect = { path = "../generated/stripe_connect", features = ["account", "transfer_reversal"] } +stripe_billing = { path = "../generated/stripe_billing", features = ["invoice", "plan", "subscription", "subscription_item", "usage_record"] } +stripe_core = { path = "../generated/stripe_core", features = ["customer", "charge", "token"] } +stripe_checkout = { path = "../generated/stripe_checkout", features = ["checkout_session"] } +stripe_product = { path = "../generated/stripe_product", features = ["product", "price", "promotion_code"] } +stripe_misc = { path = "../generated/stripe_misc" } diff --git a/tests/tests/it/async_tests/mod.rs b/tests/tests/it/async_tests/mod.rs index bfe793d59..c0d765485 100644 --- a/tests/tests/it/async_tests/mod.rs +++ b/tests/tests/it/async_tests/mod.rs @@ -1 +1 @@ -mod pagination; +// mod pagination; diff --git a/tests/tests/it/main.rs b/tests/tests/it/main.rs index a0366d4b0..c484fbe92 100644 --- a/tests/tests/it/main.rs +++ b/tests/tests/it/main.rs @@ -4,11 +4,9 @@ mod deser; mod mock; mod price; -#[cfg(feature = "async")] mod async_tests; -#[cfg(feature = "blocking")] -mod blocking; +// mod blocking; + // NB: pagination utils ideally could be used for blocking tests as well, but tricky because the `MockServer` is async // and the blocking client unconditionally creates its own runtime already -#[cfg(feature = "async")] -mod pagination_utils; +// mod pagination_utils;