1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
// ====================================== // This file was automatically generated. // ====================================== use crate::config::{Client, Response}; use crate::ids::{ AlipayAccountId, BankAccountId, CardId, CouponId, CustomerId, PaymentMethodId, PaymentSourceId, }; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ Address, Currency, CustomField, Discount, PaymentMethod, PaymentSource, PaymentSourceParams, Scheduled, Shipping, ShippingParams, Subscription, TaxId, }; use serde_derive::{Deserialize, Serialize}; /// The resource representing a Stripe "Customer". /// /// For more details see [https://stripe.com/docs/api/customers/object](https://stripe.com/docs/api/customers/object). #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Customer { /// Unique identifier for the object. pub id: CustomerId, /// Current balance, if any, being stored on the customer's account. /// /// If negative, the customer has credit to apply to the next invoice. /// If positive, the customer has an amount owed that will be added to the next invoice. /// The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. /// This balance is only taken into account as invoices are finalized. /// Note that the balance does not include unpaid invoices. #[serde(skip_serializing_if = "Option::is_none")] pub account_balance: Option<i64>, /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option<Address>, /// Time at which the object was created. /// /// Measured in seconds since the Unix epoch. #[serde(skip_serializing_if = "Option::is_none")] pub created: Option<Timestamp>, /// Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes. #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option<Currency>, /// ID of the default payment source for the customer. #[serde(skip_serializing_if = "Option::is_none")] pub default_source: Option<Expandable<PaymentSource>>, // Always true for a deleted object #[serde(default)] pub deleted: bool, /// When the customer's latest invoice is billed by charging automatically, delinquent is true if the invoice's latest charge is failed. /// /// When the customer's latest invoice is billed by sending an invoice, delinquent is true if the invoice is not paid by its due date. #[serde(skip_serializing_if = "Option::is_none")] pub delinquent: Option<bool>, /// An arbitrary string attached to the object. /// /// Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<String>, /// Describes the current discount active on the customer, if there is one. #[serde(skip_serializing_if = "Option::is_none")] pub discount: Option<Discount>, /// The customer's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<String>, /// The prefix for the customer used to generate unique invoice numbers. #[serde(skip_serializing_if = "Option::is_none")] pub invoice_prefix: Option<String>, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_settings: Option<InvoiceSettingCustomerSetting>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. #[serde(skip_serializing_if = "Option::is_none")] pub livemode: Option<bool>, /// Set of key-value pairs that you can attach to an object. /// /// This can be useful for storing additional information about the object in a structured format. #[serde(default)] pub metadata: Metadata, /// The customer's full name or business name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<String>, /// The customer's phone number. #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<String>, /// The customer's preferred locales (languages), ordered by preference. #[serde(skip_serializing_if = "Option::is_none")] pub preferred_locales: Option<Vec<String>>, /// Mailing and shipping address for the customer. /// /// Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option<Shipping>, /// The customer's payment sources, if any. #[serde(default)] pub sources: List<PaymentSource>, /// The customer's current subscriptions, if any. #[serde(default)] pub subscriptions: List<Subscription>, /// Describes the customer's tax exemption status. /// /// One of `none`, `exempt`, or `reverse`. /// When set to `reverse`, invoice and receipt PDFs include the text **"Reverse charge"**. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option<CustomerTaxExempt>, /// The customer's tax IDs. #[serde(default)] pub tax_ids: List<TaxId>, /// The customer's tax information. /// /// Appears on invoices emailed to this customer. /// This field has been deprecated and will be removed in a future API version, for further information view the [migration guide](https://stripe.com/docs/billing/migration/taxes#moving-from-taxinfo-to-customer-tax-ids). #[serde(skip_serializing_if = "Option::is_none")] pub tax_info: Option<TaxInfo>, /// Describes the status of looking up the tax ID provided in `tax_info`. /// /// This field has been deprecated and will be removed in a future API version, for further information view the [migration guide](https://stripe.com/docs/billing/migration/taxes#moving-from-taxinfo-to-customer-tax-ids). #[serde(skip_serializing_if = "Option::is_none")] pub tax_info_verification: Option<TaxInfoVerification>, } impl Customer { /// Returns a list of your customers. /// /// The customers are returned sorted by creation date, with the most recent customers appearing first. pub fn list(client: &Client, params: ListCustomers<'_>) -> Response<List<Customer>> { client.get_query("/customers", ¶ms) } /// Creates a new customer object. pub fn create(client: &Client, params: CreateCustomer<'_>) -> Response<Customer> { client.post_form("/customers", ¶ms) } /// Retrieves the details of an existing customer. /// /// You need only supply the unique customer identifier that was returned upon customer creation. pub fn retrieve(client: &Client, id: &CustomerId, expand: &[&str]) -> Response<Customer> { client.get_query(&format!("/customers/{}", id), &Expand { expand }) } /// 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 update( client: &Client, id: &CustomerId, params: UpdateCustomer<'_>, ) -> Response<Customer> { client.post_form(&format!("/customers/{}", id), ¶ms) } /// Permanently deletes a customer. /// /// It cannot be undone. /// Also immediately cancels any active subscriptions on the customer. pub fn delete(client: &Client, id: &CustomerId) -> Response<Deleted<CustomerId>> { client.delete(&format!("/customers/{}", id)) } } impl Object for Customer { type Id = CustomerId; fn id(&self) -> Self::Id { self.id.clone() } fn object(&self) -> &'static str { "customer" } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceSettingCustomerSetting { /// Default custom fields to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: Option<Vec<InvoiceSettingCustomField>>, /// ID of the default payment method used for subscriptions and invoices for the customer. #[serde(skip_serializing_if = "Option::is_none")] pub default_payment_method: Option<Expandable<PaymentMethod>>, /// Default footer to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<String>, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceSettingCustomField { /// The name of the custom field. pub name: String, /// The value of the custom field. pub value: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaxInfo { /// The customer's tax ID number. #[serde(skip_serializing_if = "Option::is_none")] pub tax_id: Option<String>, /// The type of ID number. #[serde(rename = "type")] pub type_: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaxInfoVerification { /// The state of verification for this customer. /// /// Possible values are `unverified`, `pending`, or `verified`. #[serde(skip_serializing_if = "Option::is_none")] pub status: Option<String>, /// The official name associated with the tax ID returned from the external provider. #[serde(skip_serializing_if = "Option::is_none")] pub verified_name: Option<String>, } /// The parameters for `Customer::create`. #[derive(Clone, Debug, Serialize, Default)] pub struct CreateCustomer<'a> { /// An integer amount in %s that represents the account balance for your customer. /// /// Account balances only affect 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 account_balance: Option<i64>, /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option<Address>, #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<CouponId>, /// 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 = "Expand::is_empty")] pub expand: &'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<CustomerInvoiceSettings>, /// A set of key-value pairs that you can attach to a customer object. /// /// It can be useful for storing additional information about the customer in a structured format. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<Metadata>, /// The customer's full name or business name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] pub payment_method: Option<PaymentMethodId>, /// 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<Vec<String>>, /// The customer's shipping information. /// /// Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option<ShippingParams>, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option<PaymentSourceParams>, /// The customer's tax exemption. /// /// One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option<CustomerTaxExemptFilter>, /// The customer's tax IDs. #[serde(skip_serializing_if = "Option::is_none")] pub tax_id_data: Option<Vec<TaxIdData>>, /// The customer's tax information. /// /// Appears on invoices emailed to this customer. /// This parameter has been deprecated and will be removed in a future API version, for further information view the [migration guide](https://stripe.com/docs/billing/migration/taxes#moving-from-taxinfo-to-customer-tax-ids). #[serde(skip_serializing_if = "Option::is_none")] pub tax_info: Option<TaxInfoParams>, } impl<'a> CreateCustomer<'a> { pub fn new() -> Self { CreateCustomer { account_balance: Default::default(), address: Default::default(), coupon: Default::default(), description: Default::default(), email: Default::default(), expand: Default::default(), invoice_prefix: Default::default(), invoice_settings: Default::default(), metadata: Default::default(), name: Default::default(), payment_method: Default::default(), phone: Default::default(), preferred_locales: Default::default(), shipping: Default::default(), source: Default::default(), tax_exempt: Default::default(), tax_id_data: Default::default(), tax_info: Default::default(), } } } /// The parameters for `Customer::list`. #[derive(Clone, Debug, Serialize, Default)] pub struct ListCustomers<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub created: Option<RangeQuery<Timestamp>>, /// A filter on the list based on the customer's `email` field. /// /// The value must be a string. #[serde(skip_serializing_if = "Option::is_none")] pub email: 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<CustomerId>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Expand::is_empty")] pub expand: &'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<u64>, /// 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<CustomerId>, } impl<'a> ListCustomers<'a> { pub fn new() -> Self { ListCustomers { created: Default::default(), email: Default::default(), ending_before: Default::default(), expand: Default::default(), limit: Default::default(), starting_after: Default::default(), } } } /// The parameters for `Customer::update`. #[derive(Clone, Debug, Serialize, Default)] pub struct UpdateCustomer<'a> { /// An integer amount in %s that represents the account balance for your customer. /// /// Account balances only affect 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 account_balance: Option<i64>, /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] pub address: Option<Address>, #[serde(skip_serializing_if = "Option::is_none")] pub coupon: Option<CouponId>, /// ID of Alipay account to make the customer's new default for invoice payments. #[serde(skip_serializing_if = "Option::is_none")] pub default_alipay_account: Option<AlipayAccountId>, /// ID of bank account to make the customer's new default for invoice payments. #[serde(skip_serializing_if = "Option::is_none")] pub default_bank_account: Option<BankAccountId>, /// ID of card to make the customer's new default for invoice payments. #[serde(skip_serializing_if = "Option::is_none")] pub default_card: Option<CardId>, /// 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<PaymentSourceId>, /// 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 = "Expand::is_empty")] pub expand: &'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<CustomerInvoiceSettings>, /// A set of key-value pairs that you can attach to a customer object. /// /// It can be useful for storing additional information about the customer in a structured format. #[serde(skip_serializing_if = "Option::is_none")] pub metadata: Option<Metadata>, /// The customer's full name or business name. #[serde(skip_serializing_if = "Option::is_none")] pub name: 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<Vec<String>>, /// The customer's shipping information. /// /// Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option<ShippingParams>, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option<PaymentSourceParams>, /// The customer's tax exemption. /// /// One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option<CustomerTaxExemptFilter>, /// The customer's tax information. /// /// Appears on invoices emailed to this customer. /// This parameter has been deprecated and will be removed in a future API version, for further information view the [migration guide](https://stripe.com/docs/billing/migration/taxes#moving-from-taxinfo-to-customer-tax-ids). #[serde(skip_serializing_if = "Option::is_none")] pub tax_info: Option<TaxInfoParams>, /// Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. /// /// This will always overwrite any trials that might apply via a subscribed plan. /// If set, trial_end will override the default trial period of the plan the customer is being subscribed to. /// 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<Scheduled>, } impl<'a> UpdateCustomer<'a> { pub fn new() -> Self { UpdateCustomer { account_balance: Default::default(), address: Default::default(), coupon: Default::default(), default_alipay_account: Default::default(), default_bank_account: Default::default(), default_card: Default::default(), default_source: Default::default(), description: Default::default(), email: Default::default(), expand: Default::default(), invoice_prefix: Default::default(), invoice_settings: Default::default(), metadata: Default::default(), name: Default::default(), phone: Default::default(), preferred_locales: Default::default(), shipping: Default::default(), source: Default::default(), tax_exempt: Default::default(), tax_info: Default::default(), trial_end: Default::default(), } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CustomerInvoiceSettings { #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: Option<Vec<CustomField>>, #[serde(skip_serializing_if = "Option::is_none")] pub default_payment_method: Option<String>, #[serde(skip_serializing_if = "Option::is_none")] pub footer: Option<String>, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaxIdData { #[serde(rename = "type")] pub type_: TaxIdDataType, pub value: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaxInfoParams { pub tax_id: String, #[serde(rename = "type")] pub type_: TaxInfoType, } /// An enum representing the possible values of an `Customer`'s `tax_exempt` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum CustomerTaxExempt { Exempt, None, Reverse, } impl CustomerTaxExempt { pub fn as_str(self) -> &'static str { match self { CustomerTaxExempt::Exempt => "exempt", CustomerTaxExempt::None => "none", CustomerTaxExempt::Reverse => "reverse", } } } impl AsRef<str> for CustomerTaxExempt { fn as_ref(&self) -> &str { self.as_str() } } impl std::fmt::Display for CustomerTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.as_str().fmt(f) } } /// An enum representing the possible values of an `CreateCustomer`'s `tax_exempt` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum CustomerTaxExemptFilter { Exempt, None, Reverse, } impl CustomerTaxExemptFilter { pub fn as_str(self) -> &'static str { match self { CustomerTaxExemptFilter::Exempt => "exempt", CustomerTaxExemptFilter::None => "none", CustomerTaxExemptFilter::Reverse => "reverse", } } } impl AsRef<str> for CustomerTaxExemptFilter { fn as_ref(&self) -> &str { self.as_str() } } impl std::fmt::Display for CustomerTaxExemptFilter { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.as_str().fmt(f) } } /// An enum representing the possible values of an `TaxIdData`'s `type` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum TaxIdDataType { AuAbn, EuVat, NzGst, } impl TaxIdDataType { pub fn as_str(self) -> &'static str { match self { TaxIdDataType::AuAbn => "au_abn", TaxIdDataType::EuVat => "eu_vat", TaxIdDataType::NzGst => "nz_gst", } } } impl AsRef<str> for TaxIdDataType { fn as_ref(&self) -> &str { self.as_str() } } impl std::fmt::Display for TaxIdDataType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.as_str().fmt(f) } } /// An enum representing the possible values of an `TaxInfoParams`'s `type` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum TaxInfoType { Vat, } impl TaxInfoType { pub fn as_str(self) -> &'static str { match self { TaxInfoType::Vat => "vat", } } } impl AsRef<str> for TaxInfoType { fn as_ref(&self) -> &str { self.as_str() } } impl std::fmt::Display for TaxInfoType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.as_str().fmt(f) } }