@@ -2,12 +2,6 @@ module Stripe where
22
33import Data.Maybe (Maybe )
44
5-
6- -- | Stripe populates this with things like `"customer"`, `"object"`, `"list"` and so on.
7- type ObjectTag = String
8-
9- -- ------------------------------------------------------------------------------
10-
115-- | https://stripe.com/docs/api/customers/object
126type Customer =
137 { object :: ObjectTag
@@ -20,8 +14,10 @@ type Customer =
2014 , currency :: Currency
2115 , invoice_prefix :: String
2216 , invoice_settings :: InvoiceSettings
23- , subscriptions :: SubscriptionsInfo
17+ , subscriptions :: { | ArrayWrapperRow Subscription ( total_count :: Int ) }
2418 , delinquent :: Boolean
19+ , tax_ids :: ArrayWrapper TaxIdData
20+ , tax_exempt :: TaxExemptType
2521 }
2622
2723type CustomerId = String
@@ -94,16 +90,6 @@ type InvoiceId = String
9490
9591-- ------------------------------------------------------------------------------
9692
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-
10793type Subscription =
10894 { id :: SubscriptionId
10995 , customer :: CustomerId
@@ -112,11 +98,7 @@ type Subscription =
11298 , current_period_start :: Timestamp
11399 , current_period_end :: Timestamp
114100 , latest_invoice :: Maybe InvoiceId
115- , items :: { object :: ObjectTag
116- , data :: Array SubscriptionItem
117- , url :: URLSuffix
118- , has_more :: Boolean
119- }
101+ , items :: ArrayWrapper SubscriptionItem
120102 }
121103
122104type SubscriptionId = String
@@ -161,6 +143,23 @@ type ProductId = String
161143
162144-- ------------------------------------------------------------------------------
163145
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+
164163type Address =
165164 { postal_code :: Maybe PostalCode
166165 , city :: Maybe String
@@ -203,3 +202,19 @@ type MonthNr = Int
203202
204203-- | Year, starting from zero, i.e. the year 2020 is represented as `2020`.
205204type 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