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 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301
// ======================================
// This file was automatically generated.
// ======================================
use serde::{Deserialize, Serialize};
use crate::client::{Client, Response};
use crate::ids::{CouponId, CustomerId, PaymentMethodId, PaymentSourceId, PromotionCodeId};
use crate::params::{
Deleted, Expand, Expandable, List, Metadata, Object, Paginable, RangeQuery, Timestamp,
};
use crate::resources::{
Address, CashBalance, Currency, Discount, InvoiceSettingRenderingOptions, PaymentMethod,
PaymentSource, PaymentSourceParams, Shipping, Subscription, TaxId, TestHelpersTestClock,
};
/// The resource representing a Stripe "Customer".
///
/// For more details see <https://stripe.com/docs/api/customers/object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Customer {
/// Unique identifier for the object.
pub id: CustomerId,
/// The customer's address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<Address>,
/// The current balance, if any, that's stored on the customer.
///
/// If negative, the customer has credit to apply to their next invoice.
/// If positive, the customer has an amount owed that's added to their next invoice.
/// The balance only considers amounts that Stripe hasn't successfully applied to any invoice.
/// It doesn't reflect unpaid invoices.
/// This balance is only taken into account after invoices finalize.
#[serde(skip_serializing_if = "Option::is_none")]
pub balance: Option<i64>,
/// The current funds being held by Stripe on behalf of the customer.
///
/// You can apply these funds towards payment intents when the source is "cash_balance".
/// The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically.
#[serde(skip_serializing_if = "Option::is_none")]
pub cash_balance: Option<CashBalance>,
/// 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.
///
/// If you use payment methods created through the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
#[serde(skip_serializing_if = "Option::is_none")]
pub default_source: Option<Expandable<PaymentSource>>,
// Always true for a deleted object
#[serde(default)]
pub deleted: bool,
/// Tracks the most recent state change on any invoice belonging to the customer.
///
/// Paying an invoice or marking it uncollectible via the API will set this field to false.
/// An automatic payment failure or passing the `invoice.due_date` will set this field to `true`. If an invoice becomes uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't reset to `false`. If you care whether the customer has paid their most recent subscription invoice, use `subscription.status` instead.
/// Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to `false`.
#[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 current multi-currency balances, if any, that's stored on the customer.
///
/// If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.
/// If negative, the customer has an amount owed that's added to their next invoice denominated in that currency.
/// These balances don't apply to unpaid invoices.
/// They solely track amounts that Stripe hasn't successfully applied to any invoice.
/// Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_credit_balance: Option<i64>,
/// 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](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.
#[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<String>,
/// The suffix of the customer's next invoice number (for example, 0001).
#[serde(skip_serializing_if = "Option::is_none")]
pub next_invoice_sequence: Option<i64>,
/// 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(skip_serializing_if = "Option::is_none")]
pub subscriptions: Option<List<Subscription>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<CustomerTax>,
/// Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`.
///
/// When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_exempt: Option<CustomerTaxExempt>,
/// The customer's tax IDs.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_ids: Option<List<TaxId>>,
/// ID of the test clock that this customer belongs to.
#[serde(skip_serializing_if = "Option::is_none")]
pub test_clock: Option<Expandable<TestHelpersTestClock>>,
}
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", params)
}
/// Creates a new customer object.
pub fn create(client: &Client, params: CreateCustomer<'_>) -> Response<Customer> {
#[allow(clippy::needless_borrows_for_generic_args)]
client.post_form("/customers", ¶ms)
}
/// Retrieves a Customer object.
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> {
#[allow(clippy::needless_borrows_for_generic_args)]
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, Default, Deserialize, Serialize)]
pub struct CustomerTax {
/// Surfaces if automatic tax computation is possible given the current customer location information.
pub automatic_tax: CustomerTaxAutomaticTax,
/// A recent IP address of the customer used for tax reporting and tax location inference.
pub ip_address: Option<String>,
/// The customer's location as identified by Stripe Tax.
pub location: Option<CustomerTaxLocation>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerTaxLocation {
/// The customer's country as identified by Stripe Tax.
pub country: String,
/// The data source used to infer the customer's location.
pub source: CustomerTaxLocationSource,
/// The customer's state, county, province, or region as identified by Stripe Tax.
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct InvoiceSettingCustomerSetting {
/// Default custom fields to be displayed on invoices for this customer.
pub custom_fields: Option<Vec<InvoiceSettingCustomField>>,
/// 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.
pub default_payment_method: Option<Expandable<PaymentMethod>>,
/// Default footer to be displayed on invoices for this customer.
pub footer: Option<String>,
/// Default options for invoice PDF rendering for this customer.
pub rendering_options: Option<InvoiceSettingRenderingOptions>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct InvoiceSettingCustomField {
/// The name of the custom field.
pub name: String,
/// The value of the custom field.
pub value: String,
}
/// The parameters for `Customer::create`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct CreateCustomer<'a> {
/// The customer's address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<Address>,
/// 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<i64>,
/// Balance information and default balance settings for this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub cash_balance: Option<CreateCustomerCashBalance>,
#[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>,
/// 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<Metadata>,
/// 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<i64>,
#[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 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<PromotionCodeId>,
/// The customer's shipping information.
///
/// Appears on invoices emailed to this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<CreateCustomerShipping>,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<PaymentSourceParams>,
/// Tax details about the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<CreateCustomerTax>,
/// 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>>,
/// 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<bool>,
}
impl<'a> CreateCustomer<'a> {
pub fn new() -> Self {
CreateCustomer {
address: Default::default(),
balance: Default::default(),
cash_balance: 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(),
next_invoice_sequence: Default::default(),
payment_method: Default::default(),
phone: Default::default(),
preferred_locales: Default::default(),
promotion_code: Default::default(),
shipping: Default::default(),
source: Default::default(),
tax: Default::default(),
tax_exempt: Default::default(),
tax_id_data: Default::default(),
test_clock: Default::default(),
validate: 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 case-sensitive 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>,
/// Provides a list of customers that are associated with the specified test clock.
///
/// The response will not include customers with test clocks if this parameter is not set.
#[serde(skip_serializing_if = "Option::is_none")]
pub test_clock: Option<&'a str>,
}
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(),
test_clock: Default::default(),
}
}
}
impl Paginable for ListCustomers<'_> {
type O = Customer;
fn set_last(&mut self, item: Self::O) {
self.starting_after = Some(item.id());
}
}
/// The parameters for `Customer::update`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct UpdateCustomer<'a> {
/// The customer's address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<Address>,
/// 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<i64>,
/// Balance information and default balance settings for this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub cash_balance: Option<UpdateCustomerCashBalance>,
#[serde(skip_serializing_if = "Option::is_none")]
pub coupon: Option<CouponId>,
/// 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<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>,
/// 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<Metadata>,
/// 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<i64>,
/// 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 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<PromotionCodeId>,
/// The customer's shipping information.
///
/// Appears on invoices emailed to this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<UpdateCustomerShipping>,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<PaymentSourceParams>,
/// Tax details about the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<UpdateCustomerTax>,
/// The customer's tax exemption.
///
/// One of `none`, `exempt`, or `reverse`.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_exempt: Option<CustomerTaxExemptFilter>,
#[serde(skip_serializing_if = "Option::is_none")]
pub validate: Option<bool>,
}
impl<'a> UpdateCustomer<'a> {
pub fn new() -> Self {
UpdateCustomer {
address: Default::default(),
balance: Default::default(),
cash_balance: Default::default(),
coupon: 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(),
next_invoice_sequence: Default::default(),
phone: Default::default(),
preferred_locales: Default::default(),
promotion_code: Default::default(),
shipping: Default::default(),
source: Default::default(),
tax: Default::default(),
tax_exempt: Default::default(),
validate: Default::default(),
}
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerCashBalance {
/// 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<CreateCustomerCashBalanceSettings>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerShipping {
/// Customer shipping address.
pub address: CreateCustomerShippingAddress,
/// Customer name.
pub name: String,
/// Customer phone (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerTax {
/// 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<String>,
/// A flag that indicates when Stripe should validate the customer tax location.
///
/// Defaults to `deferred`.
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_location: Option<CreateCustomerTaxValidateLocation>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerInvoiceSettings {
/// 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<Vec<CustomerInvoiceSettingsCustomFields>>,
/// 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<String>,
/// Default footer to be displayed on invoices for this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub footer: Option<String>,
/// Default options for invoice PDF rendering for this customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub rendering_options: Option<CustomerInvoiceSettingsRenderingOptions>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxIdData {
/// 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_: TaxIdType,
/// Value of the tax ID.
pub value: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateCustomerCashBalance {
/// 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<UpdateCustomerCashBalanceSettings>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateCustomerShipping {
/// Customer shipping address.
pub address: UpdateCustomerShippingAddress,
/// Customer name.
pub name: String,
/// Customer phone (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateCustomerTax {
/// 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<String>,
/// A flag that indicates when Stripe should validate the customer tax location.
///
/// Defaults to `deferred`.
#[serde(skip_serializing_if = "Option::is_none")]
pub validate_location: Option<UpdateCustomerTaxValidateLocation>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerCashBalanceSettings {
/// 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<CreateCustomerCashBalanceSettingsReconciliationMode>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerShippingAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// 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<String>,
/// Address line 1 (e.g., street, PO Box, or company name).
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2 (e.g., apartment, suite, unit, or building).
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region.
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerInvoiceSettingsCustomFields {
/// The name of the custom field.
///
/// This may be up to 30 characters.
pub name: String,
/// The value of the custom field.
///
/// This may be up to 30 characters.
pub value: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerInvoiceSettingsRenderingOptions {
/// 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<CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
}
#[derive(Clone, Debug, Default, Deserialize, 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).
#[serde(skip_serializing_if = "Option::is_none")]
pub reconciliation_mode: Option<UpdateCustomerCashBalanceSettingsReconciliationMode>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UpdateCustomerShippingAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// 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<String>,
/// Address line 1 (e.g., street, PO Box, or company name).
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2 (e.g., apartment, suite, unit, or building).
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region.
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
/// An enum representing the possible values of an `CreateCustomerCashBalanceSettings`'s `reconciliation_mode` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateCustomerCashBalanceSettingsReconciliationMode {
Automatic,
Manual,
MerchantDefault,
}
impl CreateCustomerCashBalanceSettingsReconciliationMode {
pub fn as_str(self) -> &'static str {
match self {
CreateCustomerCashBalanceSettingsReconciliationMode::Automatic => "automatic",
CreateCustomerCashBalanceSettingsReconciliationMode::Manual => "manual",
CreateCustomerCashBalanceSettingsReconciliationMode::MerchantDefault => {
"merchant_default"
}
}
}
}
impl AsRef<str> for CreateCustomerCashBalanceSettingsReconciliationMode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateCustomerCashBalanceSettingsReconciliationMode {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `CreateCustomerTax`'s `validate_location` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateCustomerTaxValidateLocation {
Deferred,
Immediately,
}
impl CreateCustomerTaxValidateLocation {
pub fn as_str(self) -> &'static str {
match self {
CreateCustomerTaxValidateLocation::Deferred => "deferred",
CreateCustomerTaxValidateLocation::Immediately => "immediately",
}
}
}
impl AsRef<str> for CreateCustomerTaxValidateLocation {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CreateCustomerTaxValidateLocation {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CreateCustomerTaxValidateLocation {
fn default() -> Self {
Self::Deferred
}
}
/// An enum representing the possible values of an `CustomerInvoiceSettingsRenderingOptions`'s `amount_tax_display` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
ExcludeTax,
IncludeInclusiveTax,
}
impl CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
pub fn as_str(self) -> &'static str {
match self {
CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::ExcludeTax => "exclude_tax",
CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::IncludeInclusiveTax => {
"include_inclusive_tax"
}
}
}
}
impl AsRef<str> for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
fn default() -> Self {
Self::ExcludeTax
}
}
/// An enum representing the possible values of an `CustomerTax`'s `automatic_tax` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CustomerTaxAutomaticTax {
Failed,
NotCollecting,
Supported,
UnrecognizedLocation,
}
impl CustomerTaxAutomaticTax {
pub fn as_str(self) -> &'static str {
match self {
CustomerTaxAutomaticTax::Failed => "failed",
CustomerTaxAutomaticTax::NotCollecting => "not_collecting",
CustomerTaxAutomaticTax::Supported => "supported",
CustomerTaxAutomaticTax::UnrecognizedLocation => "unrecognized_location",
}
}
}
impl AsRef<str> for CustomerTaxAutomaticTax {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CustomerTaxAutomaticTax {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CustomerTaxAutomaticTax {
fn default() -> Self {
Self::Failed
}
}
/// 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)
}
}
impl std::default::Default for CustomerTaxExempt {
fn default() -> Self {
Self::Exempt
}
}
/// 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)
}
}
impl std::default::Default for CustomerTaxExemptFilter {
fn default() -> Self {
Self::Exempt
}
}
/// An enum representing the possible values of an `CustomerTaxLocation`'s `source` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CustomerTaxLocationSource {
BillingAddress,
IpAddress,
PaymentMethod,
ShippingDestination,
}
impl CustomerTaxLocationSource {
pub fn as_str(self) -> &'static str {
match self {
CustomerTaxLocationSource::BillingAddress => "billing_address",
CustomerTaxLocationSource::IpAddress => "ip_address",
CustomerTaxLocationSource::PaymentMethod => "payment_method",
CustomerTaxLocationSource::ShippingDestination => "shipping_destination",
}
}
}
impl AsRef<str> for CustomerTaxLocationSource {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for CustomerTaxLocationSource {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for CustomerTaxLocationSource {
fn default() -> Self {
Self::BillingAddress
}
}
/// 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 TaxIdType {
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,
}
impl TaxIdType {
pub fn as_str(self) -> &'static str {
match self {
TaxIdType::AdNrt => "ad_nrt",
TaxIdType::AeTrn => "ae_trn",
TaxIdType::ArCuit => "ar_cuit",
TaxIdType::AuAbn => "au_abn",
TaxIdType::AuArn => "au_arn",
TaxIdType::BgUic => "bg_uic",
TaxIdType::BoTin => "bo_tin",
TaxIdType::BrCnpj => "br_cnpj",
TaxIdType::BrCpf => "br_cpf",
TaxIdType::CaBn => "ca_bn",
TaxIdType::CaGstHst => "ca_gst_hst",
TaxIdType::CaPstBc => "ca_pst_bc",
TaxIdType::CaPstMb => "ca_pst_mb",
TaxIdType::CaPstSk => "ca_pst_sk",
TaxIdType::CaQst => "ca_qst",
TaxIdType::ChVat => "ch_vat",
TaxIdType::ClTin => "cl_tin",
TaxIdType::CnTin => "cn_tin",
TaxIdType::CoNit => "co_nit",
TaxIdType::CrTin => "cr_tin",
TaxIdType::DoRcn => "do_rcn",
TaxIdType::EcRuc => "ec_ruc",
TaxIdType::EgTin => "eg_tin",
TaxIdType::EsCif => "es_cif",
TaxIdType::EuOssVat => "eu_oss_vat",
TaxIdType::EuVat => "eu_vat",
TaxIdType::GbVat => "gb_vat",
TaxIdType::GeVat => "ge_vat",
TaxIdType::HkBr => "hk_br",
TaxIdType::HuTin => "hu_tin",
TaxIdType::IdNpwp => "id_npwp",
TaxIdType::IlVat => "il_vat",
TaxIdType::InGst => "in_gst",
TaxIdType::IsVat => "is_vat",
TaxIdType::JpCn => "jp_cn",
TaxIdType::JpRn => "jp_rn",
TaxIdType::JpTrn => "jp_trn",
TaxIdType::KePin => "ke_pin",
TaxIdType::KrBrn => "kr_brn",
TaxIdType::LiUid => "li_uid",
TaxIdType::MxRfc => "mx_rfc",
TaxIdType::MyFrp => "my_frp",
TaxIdType::MyItn => "my_itn",
TaxIdType::MySst => "my_sst",
TaxIdType::NoVat => "no_vat",
TaxIdType::NzGst => "nz_gst",
TaxIdType::PeRuc => "pe_ruc",
TaxIdType::PhTin => "ph_tin",
TaxIdType::RoTin => "ro_tin",
TaxIdType::RsPib => "rs_pib",
TaxIdType::RuInn => "ru_inn",
TaxIdType::RuKpp => "ru_kpp",
TaxIdType::SaVat => "sa_vat",
TaxIdType::SgGst => "sg_gst",
TaxIdType::SgUen => "sg_uen",
TaxIdType::SiTin => "si_tin",
TaxIdType::SvNit => "sv_nit",
TaxIdType::ThVat => "th_vat",
TaxIdType::TrTin => "tr_tin",
TaxIdType::TwVat => "tw_vat",
TaxIdType::UaVat => "ua_vat",
TaxIdType::UsEin => "us_ein",
TaxIdType::UyRuc => "uy_ruc",
TaxIdType::VeRif => "ve_rif",
TaxIdType::VnTin => "vn_tin",
TaxIdType::ZaVat => "za_vat",
}
}
}
impl AsRef<str> for TaxIdType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for TaxIdType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for TaxIdType {
fn default() -> Self {
Self::AdNrt
}
}
/// An enum representing the possible values of an `UpdateCustomerCashBalanceSettings`'s `reconciliation_mode` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateCustomerCashBalanceSettingsReconciliationMode {
Automatic,
Manual,
MerchantDefault,
}
impl UpdateCustomerCashBalanceSettingsReconciliationMode {
pub fn as_str(self) -> &'static str {
match self {
UpdateCustomerCashBalanceSettingsReconciliationMode::Automatic => "automatic",
UpdateCustomerCashBalanceSettingsReconciliationMode::Manual => "manual",
UpdateCustomerCashBalanceSettingsReconciliationMode::MerchantDefault => {
"merchant_default"
}
}
}
}
impl AsRef<str> for UpdateCustomerCashBalanceSettingsReconciliationMode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateCustomerCashBalanceSettingsReconciliationMode {
fn default() -> Self {
Self::Automatic
}
}
/// An enum representing the possible values of an `UpdateCustomerTax`'s `validate_location` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpdateCustomerTaxValidateLocation {
Deferred,
Immediately,
}
impl UpdateCustomerTaxValidateLocation {
pub fn as_str(self) -> &'static str {
match self {
UpdateCustomerTaxValidateLocation::Deferred => "deferred",
UpdateCustomerTaxValidateLocation::Immediately => "immediately",
}
}
}
impl AsRef<str> for UpdateCustomerTaxValidateLocation {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for UpdateCustomerTaxValidateLocation {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for UpdateCustomerTaxValidateLocation {
fn default() -> Self {
Self::Deferred
}
}