Skip to content

Commit cfd86cd

Browse files
committed
Initial Invoice spec
1 parent 4c542b0 commit cfd86cd

File tree

3 files changed

+389
-0
lines changed

3 files changed

+389
-0
lines changed

fixtures/_models/adjustment.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"properties": {
5+
"amount": {
6+
"description": "The amount of the adjustment.",
7+
"type": "integer",
8+
"minimum": 0
9+
},
10+
"created_at": {
11+
"description": " `ISO 8601 <http://www.w3.org/QA/Tips/iso-date>`_ date of when this debit was created.",
12+
"type": "string",
13+
"format": "date-time"
14+
},
15+
"description": {
16+
"description": "Free-text description of the debit for the dashboard.",
17+
"type": [
18+
"string",
19+
"null"
20+
]
21+
}
22+
},
23+
"required": [
24+
"amount",
25+
"description",
26+
"created_at"
27+
],
28+
"additionalProperties": false
29+
}

fixtures/_models/invoice.json

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"properties": {
5+
"id": {
6+
"type": "string",
7+
"pattern": "IV[a-zA-Z0-9]{16,32}"
8+
},
9+
"href": {
10+
"type": "string",
11+
"format": "uri"
12+
},
13+
"created_at": {
14+
"description": " `ISO 8601 <http://www.w3.org/QA/Tips/iso-date>`_ date of when this debit was created.",
15+
"type": "string",
16+
"format": "date-time"
17+
},
18+
"updated_at": {
19+
"type": "string",
20+
"format": "date-time"
21+
},
22+
"settle_at": {
23+
"type": "string",
24+
"format": "date-time"
25+
},
26+
"period_start": {
27+
"type": "string",
28+
"format": "date-time"
29+
},
30+
"period_end": {
31+
"type": "string",
32+
"format": "date-time"
33+
},
34+
"adjustments": {
35+
"items": {
36+
"$ref": "_models/adjustment.json"
37+
},
38+
"type": "array",
39+
"minItems": 0,
40+
"uniqueItems": true
41+
},
42+
"adjustments_count": {
43+
"description": "The number of adjustments during the invoice period.",
44+
"type": "integer",
45+
"minimum": 0
46+
},
47+
"adjustment_total_fee": {
48+
"description": "The amount of adjustment fees in cents incurred during the invoice period.",
49+
"type": "integer",
50+
"minimum": 0
51+
},
52+
"bank_account_credit_fee": {
53+
"description": "The amount of fees in cents incurred for credits during the invoice period.",
54+
"type": "integer",
55+
"minimum": 0
56+
},
57+
"bank_account_credits_count": {
58+
"description": "The number of bank account credits during the invoice period.",
59+
"type": "integer",
60+
"minimum": 0
61+
},
62+
"bank_account_credits_total_amount": {
63+
"description": "The total amount of all credits during the invoice period.",
64+
"type": "integer",
65+
"minimum": 0
66+
},
67+
"bank_account_credits_total_fee": {
68+
"description": "The total amount of all bank account credit fees incurred during the invoice period.",
69+
"type": "integer",
70+
"minimum": 0
71+
},
72+
"bank_account_debit_variable_fee_cap": {
73+
"description": "The fixed fee cap for bank account debits.",
74+
"type": "integer",
75+
"minimum": 0
76+
},
77+
"bank_account_debit_variable_fee_percentage": {
78+
"description": "The fee percentage rate for bank account debits.",
79+
"type": "float",
80+
"minimum": 0.00
81+
},
82+
"bank_account_debits_count": {
83+
"description": "The number of bank account debits during the invoice period.",
84+
"type": "integer",
85+
"minimum": 0
86+
},
87+
"bank_account_debits_total_amount": {
88+
"description": "The total amount of all debits during the invoice period.",
89+
"type": "integer",
90+
"minimum": 0
91+
},
92+
"bank_account_debits_total_fee": {
93+
"description": "The total amount of all debit fees incurred during the invoice period.",
94+
"type": "integer",
95+
"minimum": 0
96+
},
97+
"card_credit_fixed_fee": {
98+
"description": "The fixed fee amount for credits to cards.",
99+
"type": "integer",
100+
"minimum": 0
101+
},
102+
"card_credits_count": {
103+
"description": "The number of credits to cards during the invoice period.",
104+
"type": "integer",
105+
"minimum": 0
106+
},
107+
"card_credits_total_amount": {
108+
"description": "The total amount of all credits to cards during the invoice period.",
109+
"type": "integer",
110+
"minimum": 0
111+
},
112+
"card_credits_total_fee": {
113+
"description": "The total amount of all credits to cards fees incurred during the invoice period.",
114+
"type": "integer",
115+
"minimum": 0
116+
},
117+
"card_debit_fixed_fee": {
118+
"description": "The fixed fee amount for card debits.",
119+
"type": "integer",
120+
"minimum": 0
121+
},
122+
"card_debit_variable_fee_percentage": {
123+
"description": "The fee percentage rate for bank account debits.",
124+
"type": "float",
125+
"minimum": 0.00
126+
},
127+
"card_debits_count": {
128+
"description": "The total number of card debits during the invoice period.",
129+
"type": "integer",
130+
"minimum": 0
131+
},
132+
"card_debits_total_amount": {
133+
"description": "The total amount of all card debits during the invoice period.",
134+
"type": "integer",
135+
"minimum": 0
136+
},
137+
"card_debits_total_fee": {
138+
"description": "The total amount of all card debit fees incurred during the invoice period.",
139+
"type": "integer",
140+
"minimum": 0
141+
},
142+
"card_hold_fee": {
143+
"description": "The fixed fee amount for card holds.",
144+
"type": "integer",
145+
"minimum": 0
146+
},
147+
"card_holds_count": {
148+
"description": "The total number of card holds during the invoice period.",
149+
"type": "integer",
150+
"minimum": 0
151+
},
152+
"card_holds_total_amount": {
153+
"description": "The total amount of all card holds during the invoice period.",
154+
"type": "integer",
155+
"minimum": 0
156+
},
157+
"card_holds_total_fee": {
158+
"description": "The total amount of all card hold fees incurred during the invoice period.",
159+
"type": "integer",
160+
"minimum": 0
161+
},
162+
"dispute_fixed_fee": {
163+
"description": "The fixed fee amount for disputes.",
164+
"type": "integer",
165+
"minimum": 0
166+
},
167+
"disputes_count": {
168+
"description": "The total number of disputes during the invoice period.",
169+
"type": "integer",
170+
"minimum": 0
171+
},
172+
"disputes_total_amount": {
173+
"description": "The total amount of all disputes during the invoice period.",
174+
"type": "integer",
175+
"minimum": 0
176+
},
177+
"disputes_total_fee": {
178+
"description": "The total amount of all dispute fees incurred during the invoice period.",
179+
"type": "integer",
180+
"minimum": 0
181+
},
182+
"failed_credit_fee": {
183+
"description": "The fixed fee amount for failed credits.",
184+
"type": "integer",
185+
"minimum": 0
186+
},
187+
"failed_credits_count": {
188+
"description": "The total number of failed credits during the invoice period.",
189+
"type": "integer",
190+
"minimum": 0
191+
},
192+
"failed_credits_total_amount": {
193+
"description": "The total amount of all failed credits during the invoice period.",
194+
"type": "integer",
195+
"minimum": 0
196+
},
197+
"failed_credits_total_fee": {
198+
"description": "The total amount of all failed credit fees incurred during the invoice period.",
199+
"type": "integer",
200+
"minimum": 0
201+
},
202+
"refund_fee": {
203+
"description": "The fixed fee amount for refunds.",
204+
"type": "integer",
205+
"minimum": 0
206+
},
207+
"refunds_count": {
208+
"description": "The total number of refunds during the invoice period.",
209+
"type": "integer",
210+
"minimum": 0
211+
},
212+
"refunds_total_amount": {
213+
"description": "The total amount of all refunds during the invoice period.",
214+
"type": "integer",
215+
"minimum": 0
216+
},
217+
"refunds_total_fee": {
218+
"description": "The total amount of all refund fees incurred during the invoice period.",
219+
"type": "integer",
220+
"minimum": 0
221+
},
222+
"reversals_count": {
223+
"description": "The total number of reversals during the invoice period.",
224+
"type": "integer",
225+
"minimum": 0
226+
},
227+
"reversals_total_amount": {
228+
"description": "The total amount of all reversals during the invoice period.",
229+
"type": "integer",
230+
"minimum": 0
231+
},
232+
"reversals_total_fee": {
233+
"description": "The total amount of all reversal fees incurred during the invoice period.",
234+
"type": "integer",
235+
"minimum": 0
236+
},
237+
"sequence_number": {
238+
"description": "The sequential number of the invoice.",
239+
"type": "integer",
240+
"minimum":1
241+
},
242+
"status": {
243+
"$ref": "status.json"
244+
},
245+
"total_fee": {
246+
"description": "The total amount of all fees incurred during the invoice period.",
247+
"type": "integer",
248+
"minimum": 0
249+
},
250+
"type": {
251+
"type": "string",
252+
"enum": [
253+
"dispute",
254+
"fee"
255+
]
256+
},
257+
"links": {
258+
"type": "object",
259+
"properties": {
260+
"source": {
261+
"description": "The bank account debited.",
262+
"type": "string",
263+
"pattern": "(BA)[a-zA-Z0-9]{16,32}"
264+
}
265+
},
266+
"required": [
267+
"source"
268+
],
269+
"additionalProperties": false
270+
}
271+
},
272+
"additionalProperties": false,
273+
"required": [
274+
"id",
275+
"href",
276+
"created_at",
277+
"updated_at",
278+
"settle_at",
279+
"period_start",
280+
"period_end",
281+
"adjustments",
282+
"adjustments_count",
283+
"adjustment_total_fee",
284+
"bank_account_credit_fee",
285+
"bank_account_credits_count",
286+
"bank_account_credits_total_amount",
287+
"bank_account_credits_total_fee",
288+
"bank_account_debit_variable_fee_cap",
289+
"bank_account_debit_variable_fee_percentage",
290+
"bank_account_debits_count",
291+
"bank_account_debits_total_amount",
292+
"bank_account_debits_total_fee",
293+
"card_credit_fixed_fee",
294+
"card_credits_count",
295+
"card_credits_total_amount",
296+
"card_credits_total_fee",
297+
"card_debit_fixed_fee",
298+
"card_debit_variable_fee_percentage",
299+
"card_debits_count",
300+
"card_debits_total_amount",
301+
"card_debits_total_fee",
302+
"card_hold_fee",
303+
"card_holds_count",
304+
"card_holds_total_amount",
305+
"card_holds_total_fee",
306+
"dispute_fixed_fee",
307+
"disputes_count",
308+
"disputes_total_amount",
309+
"disputes_total_fee",
310+
"failed_credit_fee",
311+
"failed_credits_count",
312+
"failed_credits_total_amount",
313+
"failed_credits_total_fee",
314+
"refund_fee",
315+
"refunds_count",
316+
"refunds_total_amount",
317+
"refunds_total_fee",
318+
"reversals_count",
319+
"reversals_total_amount",
320+
"reversals_total_fee",
321+
"sequence_number",
322+
"status",
323+
"total_fee",
324+
"type",
325+
"links"
326+
]
327+
}

fixtures/invoices.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"properties": {
5+
"invoices": {
6+
"items": {
7+
"$ref": "_models/invoice.json"
8+
},
9+
"type": "array",
10+
"minItems": 1,
11+
"uniqueItems": true
12+
},
13+
"links": {
14+
"type": "object",
15+
"properties": {
16+
"invoices.source": {
17+
"type": "string",
18+
"format": "uri",
19+
"pattern": "/resources/{invoices.source}"
20+
}
21+
},
22+
"required": [
23+
"invoices.source"
24+
]
25+
},
26+
"meta": {
27+
"type": "object"
28+
}
29+
},
30+
"require": [
31+
"invoices"
32+
]
33+
}

0 commit comments

Comments
 (0)