generated from DEFRA/ffc-template-node
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasyncapi.yaml
670 lines (668 loc) · 19.5 KB
/
asyncapi.yaml
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
asyncapi: 2.6.0
info:
title: FFC Payment Document Generator
version: 1.0.3
description: Generate PDF payment documents
channels:
ffc-pay-statements/ffc-pay-statement-generator:
subscribe:
message:
oneOf:
- $ref: '#/components/messages/PaymentSchedule'
- $ref: '#/components/messages/PaymentStatement'
ffc-pay-statement-publish:
publish:
message:
oneOf:
- $ref: '#/components/messages/DocumentSchedule'
- $ref: '#/components/messages/DocumentStatement'
ffc-pay-statement-crm:
publish:
message:
oneOf:
- $ref: '#/components/messages/Crm'
components:
messages:
PaymentSchedule:
title: Payment schedule
name: Payment schedule
contentType: application/json
payload:
$ref: '#/components/schemas/PaymentSchedule'
PaymentStatement:
title: Payment statement
name: Payment statement
contentType: application/json
payload:
$ref: '#/components/schemas/PaymentStatement'
DocumentSchedule:
title: Payment schedule
name: Payment schedule
contentType: application/json
payload:
$ref: '#/components/schemas/BodySchedule'
DocumentStatement:
title: Payment Statement
name: Payment statement
contentType: application/json
payload:
$ref: '#/components/schemas/BodyStatement'
Crm:
title: Crm Message
name: Crm Message
contentType: application/json
payload:
additionalProperties: false
type: object
properties:
body:
additionalProperties: false
type: object
properties:
sbi:
type: number
description: Single Business Identifier
minimum: 105000000
maximum: 999999999
example: 123456789
frn:
type: number
description: Firm Reference Number
minimum: 1000000000
maximum: 9999999999
example: 1234567890
apiLink:
description: >-
api link for calling file stream of statement file that has
been published unto blob
example: >-
https://myStatementRetreivalApiEndpoint/statement-receiver/statement/v1/FFC_PaymentStatement_SFI_2022_1234567890_2022090615023001.pdf
documentType:
type: string
enum:
- Payment statement
- Payment schedule
description: document type
example:
items:
- Payment statement
- Payment schedule
scheme:
type: string
enum:
- SFI
description: Scheme name
example: SFI
schemas:
PaymentSchedule:
additionalProperties: false
type: object
required:
- businessName
- frn
- sbi
- email
- address
- funding
- payments
- scheme
- documentReference
- remainingAmount
properties:
businessName:
$ref: '#/components/schemas/BusinessName'
frn:
$ref: '#/components/schemas/FRN'
sbi:
$ref: '#/components/schemas/SBI'
email:
$ref: '#/components/schemas/Email'
address:
$ref: '#/components/schemas/Address'
scheme:
$ref: '#/components/schemas/Scheme'
documentReference:
$ref: '#/components/schemas/DocumentReference'
remainingAmount:
$ref: '#/components/schemas/RemainingAmount'
schedule:
type: array
items:
- $ref: '#/components/schemas/Schedule'
- $ref: '#/components/schemas/ScheduleAdjustment'
adjustment:
$ref: '#/components/schemas/Adjustment'
PaymentStatement:
additionalProperties: false
type: object
required:
- businessName
- frn
- sbi
- address
- funding
- payments
- scheme
- documentReference
- remainingAmount
properties:
businessName:
$ref: '#/components/schemas/BusinessName'
email:
$ref: '#/components/schemas/Email'
frn:
$ref: '#/components/schemas/FRN'
sbi:
$ref: '#/components/schemas/SBI'
address:
$ref: '#/components/schemas/Address'
funding:
type: array
items:
- $ref: '#/components/schemas/Funding'
- $ref: '#/components/schemas/FundingTotal'
payments:
type: array
items:
$ref: '#/components/schemas/Payment'
scheme:
$ref: '#/components/schemas/Scheme'
documentReference:
$ref: '#/components/schemas/DocumentReference'
remainingAmount:
$ref: '#/components/schemas/RemainingAmount'
Address:
additionalProperties: false
required:
- line3
- line5
- postcode
type: object
properties:
line1:
$ref: '#/components/schemas/Street'
line2:
$ref: '#/components/schemas/Area'
line3:
$ref: '#/components/schemas/Town'
line4:
$ref: '#/components/schemas/Region'
line5:
$ref: '#/components/schemas/County'
postcode:
$ref: '#/components/schemas/Postcode'
Adjustment:
type: object
description: Overview of the total adjustment
required:
- currentValue
- newValue
- adjustmentValue
properties:
currentValue:
$ref: '#/components/schemas/AdjustmentCurrentValue'
newValue:
$ref: '#/components/schemas/AdjustmentNewValue'
adjustmentValue:
$ref: '#/components/schemas/AdjustmentValue'
BodySchedule:
additionalProperties: false
type: object
required:
- body
- source
- type
properties:
body:
$ref: '#/components/schemas/DocumentSchedule'
source:
$ref: '#/components/schemas/Source'
type:
$ref: '#/components/schemas/TypeSchedule'
BodyStatement:
additionalProperties: false
type: object
required:
- body
- source
- type
properties:
body:
$ref: '#/components/schemas/DocumentStatement'
source:
$ref: '#/components/schemas/Source'
type:
$ref: '#/components/schemas/TypeStatement'
DocumentSchedule:
additionalProperties: false
type: object
required:
- address
- businessName
- documentReference
- remainingAmount
- filename
- frn
- sbi
- scheme
properties:
address:
$ref: '#/components/schemas/Address'
businessName:
$ref: '#/components/schemas/BusinessName'
documentReference:
$ref: '#/components/schemas/DocumentReference'
remainingAmount:
$ref: '#/components/schemas/RemainingAmount'
email:
$ref: '#/components/schemas/Email'
filename:
$ref: '#/components/schemas/FilenameSchedule'
frn:
$ref: '#/components/schemas/FRN'
sbi:
$ref: '#/components/schemas/SBI'
scheme:
$ref: '#/components/schemas/Scheme'
DocumentStatement:
additionalProperties: false
type: object
required:
- address
- businessName
- documentReference
- remainingAmount
- filename
- frn
- sbi
- scheme
properties:
address:
$ref: '#/components/schemas/Address'
businessName:
$ref: '#/components/schemas/BusinessName'
documentReference:
$ref: '#/components/schemas/DocumentReference'
remainingAmount:
$ref: '#/components/schemas/RemainingAmount'
email:
$ref: '#/components/schemas/Email'
filename:
$ref: '#/components/schemas/FilenameStatement'
frn:
$ref: '#/components/schemas/FRN'
sbi:
$ref: '#/components/schemas/SBI'
scheme:
$ref: '#/components/schemas/Scheme'
Funding:
additionalProperties: false
type: object
required:
- name
- annualValue
- quarterlyValue
- quarterlyReduction
- quarterlyPayment
properties:
name:
$ref: '#/components/schemas/FundingName'
level:
$ref: '#/components/schemas/FundingLevel'
area:
$ref: '#/components/schemas/FundingArea'
rate:
$ref: '#/components/schemas/FundingRate'
annualValue:
$ref: '#/components/schemas/FundingAnnualValue'
quarterlyValue:
$ref: '#/components/schemas/FundingQuarterlyValue'
quarterlyReduction:
$ref: '#/components/schemas/FundingQuarterlyReduction'
quarterlyPayment:
$ref: '#/components/schemas/FundingQuarterlyPayment'
reductions:
type: array
items:
$ref: '#/components/schemas/Reduction'
FundingTotal:
additionalProperties: false
type: object
required:
- name
- annualValue
- quarterlyValue
- quarterlyReduction
- quarterlyPayment
properties:
name:
$ref: '#/components/schemas/FundingTotalName'
level:
$ref: '#/components/schemas/FundingTotalLevel'
area:
$ref: '#/components/schemas/FundingArea'
rate:
$ref: '#/components/schemas/FundingTotalRate'
annualValue:
$ref: '#/components/schemas/FundingAnnualValue'
quarterlyValue:
$ref: '#/components/schemas/FundingQuarterlyValue'
quarterlyReduction:
$ref: '#/components/schemas/FundingQuarterlyReduction'
quarterlyPayment:
$ref: '#/components/schemas/FundingQuarterlyPayment'
Payment:
type: object
required:
- invoiceNumber
- reference
- dueDate
- settled
- calculated
- value
- period
properties:
invoiceNumber:
$ref: '#/components/schemas/InvoiceNumber'
reference:
$ref: '#/components/schemas/Reference'
dueDate:
$ref: '#/components/schemas/DueDate'
settled:
$ref: '#/components/schemas/Settled'
calculated:
$ref: '#/components/schemas/Calculated'
value:
$ref: '#/components/schemas/Value'
period:
$ref: '#/components/schemas/Period'
Schedule:
additionalProperties: false
type: object
required:
- order
- dueDate
- paymenType
- period
- value
properties:
order:
$ref: '#/components/schemas/Order'
dueDate:
$ref: '#/components/schemas/DueDate'
paymentType:
$ref: '#/components/schemas/PaymentType'
period:
$ref: '#/components/schemas/Period'
value:
$ref: '#/components/schemas/Value'
ScheduleAdjustment:
additionalProperties: false
type: object
required:
- order
- dueDate
- paymenType
- period
- value
properties:
order:
$ref: '#/components/schemas/OrderAdjustment'
dueDate:
$ref: '#/components/schemas/DueDateAdjustment'
paymentType:
$ref: '#/components/schemas/PaymentTypeAdjustment'
period:
$ref: '#/components/schemas/PeriodAdjustment'
value:
$ref: '#/components/schemas/Value'
AdjustmentCurrentValue:
type: string
description: Current settled payment value
example: '1000.00'
AdjustmentNewValue:
type: string
description: New to-be settled payment value
example: '1500.00'
AdjustmentValue:
type: string
description: Delta between the new value and current value
example: '500.00'
Area:
type: string
description: The second line of the address
example: Some Area
BusinessName:
type: string
description: The business name
example: Summer Days Farm
Calculated:
type: string
description: The calculated date of the payment request
example: 16 Jun 2022
County:
type: string
description: The fifth line of the address
example: Some County
DocumentReference:
type: number
description: Unique identifier of the document
minimum: 1
example: 1
RemainingAmount:
type: number
description: Remaining amount to be paid can be any number
DueDate:
type: string
description: The due date of the payment request
example: 1 August 2022
DueDateAdjustment:
type: string
description: The due date of the adjustment payment
example: ''
Email:
type: string
description: The business email address
example: farm@farms.com
FRN:
type: number
description: Firm Reference Number
minimum: 1000000000
maximum: 9999999999
example: 1234567890
FilenameSchedule:
type: string
description: PDF filename, formatted as product code using 3 to 6 uppercase characters, descriptor in PascalCase, Scheme ID using 3 to 6 uppercase characters, Scheme Year using 4 digits, FRN using 10 digits, date and time using 16 digits and then .pdf. All separated by underscore
example: FFC_PaymentSchedule_SFI_2022_1234567890_2023051810181212.pdf
pattern: ^[A-Z]{3,6}\_[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*\_[A-Z]{3,6}_\d{4}_\d{10}_\d{16}\.pdf$
FilenameStatement:
type: string
description: PDF filename, formatted as product code using 3 to 6 uppercase characters, descriptor in PascalCase, Scheme ID using 3 to 6 uppercase characters, Scheme Year using 4 digits, FRN using 10 digits, date and time using 16 digits and then .pdf. All separated by underscore
example: FFC_PaymentStatement_SFI_2022_1234567890_2023051810181212.pdf
pattern: ^[A-Z]{3,6}\_[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*\_[A-Z]{3,6}_\d{4}_\d{10}_\d{16}\.pdf$
FundingName:
type: string
description: The funding option name
example: Arable and horticultural soils
FundingTotalName:
type: string
description: The funding total name
example: Total
FundingLevel:
type: string
description: The funding option level
example: Introductory
FundingTotalLevel:
type: string
description: The funding total level
example: ''
FundingArea:
type: string
description: The funding option area in hectares
example: '45.4545'
FundingRate:
type: string
description: The funding option rate in pounds per hectare
example: '22.00'
FundingTotalRate:
type: string
description: The funding total rate in pounds per hectare
example: ''
FundingAnnualValue:
type: string
description: The funding option annual value in pounds
example: '1000.00'
FundingQuarterlyValue:
type: string
description: The funding option quarterly value in pounds
example: '250.00'
FundingQuarterlyReduction:
type: string
description: The funding option quarterly reduction in pounds
example: '0.00'
FundingQuarterlyPayment:
type: string
description: The funding option quarterly payment in pounds
example: '250.00'
InvoiceNumber:
type: string
description: Invoice number of payment request
example: S000000200000002V001
Order:
type: number
format: integer
description: The order in which the schedule columns are displayed
example: 1
OrderAdjustment:
type: number
format: integer
description: The order in which the schedule columns are displayed
example: 2
PaymentType:
type: string
description: The payment description
enum:
- Immediate payment
- Quarterly payment
example: Quarterly payment
PaymentTypeAdjustment:
type: string
description: The payment description
enum:
- Immediate payment
- Quarterly payment
example: Immediate payment
Period:
type: string
description: The period of the payment
example: April to June 2022
PeriodAdjustment:
type: string
description: The period of the payment adjustment
example: ''
Postcode:
type: string
description: The postcode
example: FA1 2PY
Reduction:
type: object
required:
- reason
- value
properties:
reason:
type: string
description: The reduction name
example: Over declaration reduction
value:
type: string
description: The reduction value
example: '75.00'
Reference:
type: string
description: Settlement reference of payment request
example: '10027651'
Region:
type: string
description: The fourth line of the address
example: Some Region
SBI:
type: number
description: Single Business Identifier
minimum: 105000000
maximum: 999999999
example: 123456789
Scheme:
additionalProperties: false
type: object
required:
- name
- shortName
- year
- frequency
- agreementNumber
properties:
name:
$ref: '#/components/schemas/SchemeName'
shortName:
$ref: '#/components/schemas/SchemeShortName'
year:
$ref: '#/components/schemas/SchemeYear'
frequency:
$ref: '#/components/schemas/SchemeFrequency'
agreementNumber:
$ref: '#/components/schemas/SchemeAgreementNumber'
SchemeName:
type: string
description: The name of the scheme
example: Sustainable Farming Incentive
SchemeShortName:
type: string
description: The short name of the scheme
example: SFI
SchemeYear:
type: string
description: The marketing year
example: '2022'
SchemeFrequency:
type: string
description: The frequency of payments
example: Quarterly
SchemeAgreementNumber:
type: string
description: The agreement number
example: SFI1234567
Settled:
type: string
description: The settled date of the payment request
example: 3 July 2022
Source:
type: string
description: The source of the message being sent
example: ffc-pay-statement-generator
Street:
type: string
description: The first line of the address
example: 1 Some Street
Town:
type: string
description: The third line of the address
example: Some Town
Type:
type: string
description: The type of message being sent
oneOf:
- $ref: '#/components/schemas/TypeSchedule'
- $ref: '#/components/schemas/TypeStatement'
TypeSchedule:
type: string
description: The schedule type of message being sent
example: uk.gov.pay.schedule.publish
TypeStatement:
type: string
description: The statement type of message being sent
example: uk.gov.pay.statement.publish
Value:
type: string
description: The value of the payment
example: '250.00'