@@ -2,12 +2,6 @@ module Stripe where
2
2
3
3
import Data.Maybe (Maybe )
4
4
5
-
6
- -- | Stripe populates this with things like `"customer"`, `"object"`, `"list"` and so on.
7
- type ObjectTag = String
8
-
9
- -- ------------------------------------------------------------------------------
10
-
11
5
-- | https://stripe.com/docs/api/customers/object
12
6
type Customer =
13
7
{ object :: ObjectTag
@@ -20,8 +14,10 @@ type Customer =
20
14
, currency :: Currency
21
15
, invoice_prefix :: String
22
16
, invoice_settings :: InvoiceSettings
23
- , subscriptions :: SubscriptionsInfo
17
+ , subscriptions :: { | ArrayWrapperRow Subscription ( total_count :: Int ) }
24
18
, delinquent :: Boolean
19
+ , tax_ids :: ArrayWrapper TaxIdData
20
+ , tax_exempt :: TaxExemptType
25
21
}
26
22
27
23
type CustomerId = String
@@ -94,16 +90,6 @@ type InvoiceId = String
94
90
95
91
-- ------------------------------------------------------------------------------
96
92
97
- type SubscriptionsInfo =
98
- { object :: ObjectTag
99
- , has_more :: Boolean
100
- , total_count :: Int
101
- , url :: URLSuffix -- ^ e.g. "/v1/customers/:customerId:/subscriptions"
102
- , data :: Array Subscription
103
- }
104
-
105
- -- ------------------------------------------------------------------------------
106
-
107
93
type Subscription =
108
94
{ id :: SubscriptionId
109
95
, customer :: CustomerId
@@ -112,11 +98,7 @@ type Subscription =
112
98
, current_period_start :: Timestamp
113
99
, current_period_end :: Timestamp
114
100
, latest_invoice :: Maybe InvoiceId
115
- , items :: { object :: ObjectTag
116
- , data :: Array SubscriptionItem
117
- , url :: URLSuffix
118
- , has_more :: Boolean
119
- }
101
+ , items :: ArrayWrapper SubscriptionItem
120
102
}
121
103
122
104
type SubscriptionId = String
@@ -161,6 +143,23 @@ type ProductId = String
161
143
162
144
-- ------------------------------------------------------------------------------
163
145
146
+ type TaxIdData =
147
+ { type :: TaxIdType
148
+ , value :: String
149
+ }
150
+
151
+ -- | One of `"eu_vat"` | `"nz_gst"` | `"au_abn"` | `"in_gst"` | `"no_vat"` |
152
+ -- | `"za_vat"` | `"ch_vat"` | `"mx_rfc"` | `"sg_uen"` | `"ru_inn"` |
153
+ -- | `"ca_bn"` | `"hk_br"` | `"es_cif"` | `"tw_vat"` | `"th_vat"` |
154
+ -- | `"jp_cn"` | `"li_uid"` | `"my_itn"` | `"us_ein"` | `"kr_brn"` |
155
+ -- | `"ca_qst"` | `"my_sst"`.
156
+ type TaxIdType = String
157
+
158
+ -- | One of `"none"`, `"exempt"`, or `"reverse`".
159
+ type TaxExemptType = String
160
+
161
+ -- ------------------------------------------------------------------------------
162
+
164
163
type Address =
165
164
{ postal_code :: Maybe PostalCode
166
165
, city :: Maybe String
@@ -203,3 +202,19 @@ type MonthNr = Int
203
202
204
203
-- | Year, starting from zero, i.e. the year 2020 is represented as `2020`.
205
204
type Year = Int
205
+
206
+ -- ------------------------------------------------------------------------------
207
+
208
+ -- | Stripe populates this with things like `"customer"`, `"object"`,
209
+ -- | `"list"` and so on.
210
+ type ObjectTag = String
211
+
212
+ type ArrayWrapperRow a r =
213
+ ( object :: ObjectTag
214
+ , data :: Array a
215
+ , has_more :: Boolean
216
+ , url :: URLSuffix
217
+ | r
218
+ )
219
+
220
+ type ArrayWrapper a = { | ArrayWrapperRow a () }
0 commit comments