orb_billing/client/taxes.rs
1// Copyright Materialize, Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License in the LICENSE file at the
6// root of this repository, or online at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16use codes_iso_3166::part_1::CountryCode;
17use serde::{Deserialize, Serialize};
18use serde_enum_str::{Deserialize_enum_str, Serialize_enum_str};
19
20/// The subset of [`TaxId`] used in create and update requests.
21#[derive(Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
22pub struct TaxIdRequest<'a> {
23 /// The type of the tax ID.
24 #[serde(rename = "type")]
25 pub type_: TaxIdType,
26 /// The value of the tax ID.
27 pub value: &'a str,
28 /// The country of the tax ID.
29 pub country: CountryCode,
30}
31
32/// Tax ID details to display on an invoice.
33#[derive(Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
34pub struct TaxId {
35 /// The type of the tax ID.
36 #[serde(rename = "type")]
37 pub type_: TaxIdType,
38 /// The value of the tax ID.
39 pub value: String,
40 /// The country of the tax ID.
41 pub country: CountryCode,
42}
43
44/// The type of a [`TaxId`].
45///
46/// See: <https://docs.withorb.com/docs/orb-docs/api-reference/schemas/customer-tax-id>
47#[non_exhaustive]
48#[derive(Clone, Debug, PartialEq, Eq, Hash, Deserialize_enum_str, Serialize_enum_str)]
49#[serde(rename_all = "snake_case")]
50pub enum TaxIdType {
51 /// United Arab Emirates Tax Registration Number.
52 AeTrn,
53 /// Australian Business Number.
54 AuAbn,
55 /// Australian Taxation Office Reference Number.
56 AuArn,
57 /// Bulgaria Unified Identification Code.
58 BgUic,
59 /// Brazilian CNPJ number.
60 BrCnpj,
61 /// Brazilian CPF number.
62 BrCpf,
63 /// Canadian BN.
64 CaBn,
65 /// Canadian GST/HST number.
66 CaGstHst,
67 /// Canadian PST number (British Columbia).
68 CaPstBc,
69 /// Canadian PST number (Manitoba).
70 CaPstMb,
71 /// Canadian PST number (Saskatchewan).
72 CaPstSk,
73 /// Canadian QST number (Québec).
74 CaQst,
75 /// Switzerland VAT number.
76 ChVat,
77 /// Chilean TIN.
78 ClTin,
79 /// Spanish NIF number (previously Spanish CIF number).
80 EsCif,
81 /// European One Stop Shop VAT number for non-Union scheme.
82 EuOssVat,
83 /// European VAT number.
84 EuVat,
85 /// United Kingdom VAT number.
86 GbVat,
87 /// Georgian VAT.
88 GeVat,
89 /// Hong Kong BR number.
90 HkBr,
91 /// Hungary tax number.
92 HuTin,
93 /// Indonesian NPWP number.
94 IdNpwp,
95 /// Israel VAT.
96 IlVat,
97 /// Indian GST number.
98 InGst,
99 /// Icelandic VAT.
100 IsVat,
101 /// Japanese Corporate Number.
102 JpCn,
103 /// Japanese Registered Foreign Businesses' Registration Number.
104 JpRn,
105 /// Japanese Tax Registration Number.
106 JpTrn,
107 /// Korean BRN.
108 KrBrn,
109 /// Liechtensteinian UID number.
110 LiUid,
111 /// Mexican RFC number.
112 MxRfc,
113 /// Malaysian FRP number.
114 MyFrp,
115 /// Malaysian ITN.
116 MyItn,
117 /// Malaysian SST number.
118 MySst,
119 /// Norwegian VAT number.
120 NoVat,
121 /// New Zealand GST number
122 NzGst,
123 /// Russian INN.
124 RuInn,
125 /// Russian KPP.
126 RuKpp,
127 /// Saudi Arabia VAT.
128 SaVat,
129 /// Singaporean GST.
130 SgGst,
131 /// Singaporean UEN.
132 SgUen,
133 /// Slovenia tax number.
134 SiTin,
135 /// Thai VAT.
136 ThVat,
137 /// Taiwanese VAT.
138 TwVat,
139 /// Ukrainian VAT.
140 UaVat,
141 /// United States EIN.
142 UsEin,
143 /// South African VAT number.
144 ZaVat,
145 /// Other.
146 #[serde(other)]
147 Other(String),
148}