summaryrefslogtreecommitdiff
path: root/ebics/src/main/kotlin/iso20022/pain_001_001_11.kt
blob: 9e2b868c2dc0313cea408fd4ae9bf6a490e066cc (plain)
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
/*
 * This file is part of LibEuFin.
 * Copyright (C) 2024 Taler Systems S.A.

 * LibEuFin is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation; either version 3, or
 * (at your option) any later version.

 * LibEuFin is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General
 * Public License for more details.

 * You should have received a copy of the GNU Affero General Public
 * License along with LibEuFin; see the file COPYING.  If not, see
 * <http://www.gnu.org/licenses/>
 */

// THIS FILE IS GENERATED, DO NOT EDIT

package tech.libeufin.ebics.iso20022

import java.time.*
import java.util.*
import com.gitlab.mvysny.konsumexml.*


data class AdviceType1(
	val CdtAdvc: AdviceType1Choice?,
	val DbtAdvc: AdviceType1Choice?,
) {
	companion object {
		fun parse(k: Konsumer): AdviceType1 = AdviceType1(
			k.childOrNull("CdtAdvc") { AdviceType1Choice.parse(this) },
			k.childOrNull("DbtAdvc") { AdviceType1Choice.parse(this) },
		)
	}
}

sealed interface AdviceType1Choice {
	@JvmInline
	value class Cd(val value: AdviceType1Code): AdviceType1Choice
	@JvmInline
	value class Prtry(val value: String): AdviceType1Choice

	companion object {
		fun parse(k: Konsumer): AdviceType1Choice = k.child(Names.of("Cd", "Prtry")) {
			when (localName) {
				"Cd" -> Cd(AdviceType1Code.valueOf(text()))
				"Prtry" -> Prtry(text())
				else -> throw Error("Impossible")
			}
		}
	}
}

enum class AdviceType1Code {
	ADWD,
	ADND,
}

sealed interface Authorisation1Choice {
	@JvmInline
	value class Cd(val value: Authorisation1Code): Authorisation1Choice
	@JvmInline
	value class Prtry(val value: String): Authorisation1Choice

	companion object {
		fun parse(k: Konsumer): Authorisation1Choice = k.child(Names.of("Cd", "Prtry")) {
			when (localName) {
				"Cd" -> Cd(Authorisation1Code.valueOf(text()))
				"Prtry" -> Prtry(text())
				else -> throw Error("Impossible")
			}
		}
	}
}

enum class Authorisation1Code {
	AUTH,
	FDET,
	FSUM,
	ILEV,
}

data class Cheque11(
	val ChqTp: ChequeType2Code?,
	val ChqNb: String?,
	val ChqFr: NameAndAddress16?,
	val DlvryMtd: ChequeDeliveryMethod1Choice?,
	val DlvrTo: NameAndAddress16?,
	val InstrPrty: Priority2Code?,
	val ChqMtrtyDt: LocalDate?,
	val FrmsCd: String?,
	val MemoFld: List<String>,
	val RgnlClrZone: String?,
	val PrtLctn: String?,
	val Sgntr: List<String>,
) {
	companion object {
		fun parse(k: Konsumer): Cheque11 = Cheque11(
			k.childOrNull("ChqTp") { ChequeType2Code.valueOf(text()) },
			k.childOrNull("ChqNb") { text() },
			k.childOrNull("ChqFr") { NameAndAddress16.parse(this) },
			k.childOrNull("DlvryMtd") { ChequeDeliveryMethod1Choice.parse(this) },
			k.childOrNull("DlvrTo") { NameAndAddress16.parse(this) },
			k.childOrNull("InstrPrty") { Priority2Code.valueOf(text()) },
			k.childOrNull("ChqMtrtyDt") { text().toDate() },
			k.childOrNull("FrmsCd") { text() },
			k.children("MemoFld", maxCount=2) { text() },
			k.childOrNull("RgnlClrZone") { text() },
			k.childOrNull("PrtLctn") { text() },
			k.children("Sgntr", maxCount=5) { text() },
		)
	}
}

enum class ChequeDelivery1Code {
	MLDB,
	MLCD,
	MLFA,
	CRDB,
	CRCD,
	CRFA,
	PUDB,
	PUCD,
	PUFA,
	RGDB,
	RGCD,
	RGFA,
}

sealed interface ChequeDeliveryMethod1Choice {
	@JvmInline
	value class Cd(val value: ChequeDelivery1Code): ChequeDeliveryMethod1Choice
	@JvmInline
	value class Prtry(val value: String): ChequeDeliveryMethod1Choice

	companion object {
		fun parse(k: Konsumer): ChequeDeliveryMethod1Choice = k.child(Names.of("Cd", "Prtry")) {
			when (localName) {
				"Cd" -> Cd(ChequeDelivery1Code.valueOf(text()))
				"Prtry" -> Prtry(text())
				else -> throw Error("Impossible")
			}
		}
	}
}

enum class ChequeType2Code {
	CCHQ,
	CCCH,
	BCHQ,
	DRFT,
	ELDR,
}

data class CreditTransferTransaction54(
	val PmtId: PaymentIdentification6,
	val PmtTpInf: PaymentTypeInformation26?,
	val Amt: AmountType4Choice,
	val XchgRateInf: ExchangeRate1?,
	val ChrgBr: ChargeBearerType1Code?,
	val MndtRltdInf: CreditTransferMandateData1?,
	val ChqInstr: Cheque11?,
	val UltmtDbtr: PartyIdentification135?,
	val IntrmyAgt1: BranchAndFinancialInstitutionIdentification6?,
	val IntrmyAgt1Acct: CashAccount40?,
	val IntrmyAgt2: BranchAndFinancialInstitutionIdentification6?,
	val IntrmyAgt2Acct: CashAccount40?,
	val IntrmyAgt3: BranchAndFinancialInstitutionIdentification6?,
	val IntrmyAgt3Acct: CashAccount40?,
	val CdtrAgt: BranchAndFinancialInstitutionIdentification6?,
	val CdtrAgtAcct: CashAccount40?,
	val Cdtr: PartyIdentification135?,
	val CdtrAcct: CashAccount40?,
	val UltmtCdtr: PartyIdentification135?,
	val InstrForCdtrAgt: List<InstructionForCreditorAgent3>,
	val InstrForDbtrAgt: InstructionForDebtorAgent1?,
	val Purp: Purpose2Choice?,
	val RgltryRptg: List<RegulatoryReporting3>,
	val Tax: TaxInformation10?,
	val RltdRmtInf: List<RemittanceLocation7>,
	val RmtInf: RemittanceInformation21?,
	val SplmtryData: List<SupplementaryData1>,
) {
	companion object {
		fun parse(k: Konsumer): CreditTransferTransaction54 = CreditTransferTransaction54(
			k.child("PmtId") { PaymentIdentification6.parse(this) },
			k.childOrNull("PmtTpInf") { PaymentTypeInformation26.parse(this) },
			k.child("Amt") { AmountType4Choice.parse(this) },
			k.childOrNull("XchgRateInf") { ExchangeRate1.parse(this) },
			k.childOrNull("ChrgBr") { ChargeBearerType1Code.valueOf(text()) },
			k.childOrNull("MndtRltdInf") { CreditTransferMandateData1.parse(this) },
			k.childOrNull("ChqInstr") { Cheque11.parse(this) },
			k.childOrNull("UltmtDbtr") { PartyIdentification135.parse(this) },
			k.childOrNull("IntrmyAgt1") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("IntrmyAgt1Acct") { CashAccount40.parse(this) },
			k.childOrNull("IntrmyAgt2") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("IntrmyAgt2Acct") { CashAccount40.parse(this) },
			k.childOrNull("IntrmyAgt3") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("IntrmyAgt3Acct") { CashAccount40.parse(this) },
			k.childOrNull("CdtrAgt") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("CdtrAgtAcct") { CashAccount40.parse(this) },
			k.childOrNull("Cdtr") { PartyIdentification135.parse(this) },
			k.childOrNull("CdtrAcct") { CashAccount40.parse(this) },
			k.childOrNull("UltmtCdtr") { PartyIdentification135.parse(this) },
			k.children("InstrForCdtrAgt") { InstructionForCreditorAgent3.parse(this) },
			k.childOrNull("InstrForDbtrAgt") { InstructionForDebtorAgent1.parse(this) },
			k.childOrNull("Purp") { Purpose2Choice.parse(this) },
			k.children("RgltryRptg", maxCount=10) { RegulatoryReporting3.parse(this) },
			k.childOrNull("Tax") { TaxInformation10.parse(this) },
			k.children("RltdRmtInf", maxCount=10) { RemittanceLocation7.parse(this) },
			k.childOrNull("RmtInf") { RemittanceInformation21.parse(this) },
			k.children("SplmtryData") { SupplementaryData1.parse(this) },
		)
	}
}

data class CustomerCreditTransferInitiationV11(
	val GrpHdr: GroupHeader95,
	val PmtInf: List<PaymentInstruction40>,
	val SplmtryData: List<SupplementaryData1>,
) {
	companion object {
		fun parse(k: Konsumer): CustomerCreditTransferInitiationV11 = CustomerCreditTransferInitiationV11(
			k.child("GrpHdr") { GroupHeader95.parse(this) },
			k.children("PmtInf", minCount=1, ) { PaymentInstruction40.parse(this) },
			k.children("SplmtryData") { SupplementaryData1.parse(this) },
		)
	}
}

data class pain_001_001_11(
	val CstmrCdtTrfInitn: CustomerCreditTransferInitiationV11,
) {
	companion object {
		fun parse(k: Konsumer): pain_001_001_11 = pain_001_001_11(
			k.child("CstmrCdtTrfInitn") { CustomerCreditTransferInitiationV11.parse(this) },
		)
	}
}

data class ExchangeRate1(
	val UnitCcy: String?,
	val XchgRate: Float?,
	val RateTp: ExchangeRateType1Code?,
	val CtrctId: String?,
) {
	companion object {
		fun parse(k: Konsumer): ExchangeRate1 = ExchangeRate1(
			k.childOrNull("UnitCcy") { text() },
			k.childOrNull("XchgRate") { text().xmlFloat() },
			k.childOrNull("RateTp") { ExchangeRateType1Code.valueOf(text()) },
			k.childOrNull("CtrctId") { text() },
		)
	}
}

enum class ExchangeRateType1Code {
	SPOT,
	SALE,
	AGRD,
}

data class GroupHeader95(
	val MsgId: String,
	val CreDtTm: LocalDateTime,
	val Authstn: List<Authorisation1Choice>,
	val NbOfTxs: String,
	val CtrlSum: Float?,
	val InitgPty: PartyIdentification135,
	val FwdgAgt: BranchAndFinancialInstitutionIdentification6?,
	val InitnSrc: PaymentInitiationSource1?,
) {
	companion object {
		fun parse(k: Konsumer): GroupHeader95 = GroupHeader95(
			k.child("MsgId") { text() },
			k.child("CreDtTm") { text().toDateTime() },
			k.children("Authstn", maxCount=2) { Authorisation1Choice.parse(this) },
			k.child("NbOfTxs") { text() },
			k.childOrNull("CtrlSum") { text().xmlFloat() },
			k.child("InitgPty") { PartyIdentification135.parse(this) },
			k.childOrNull("FwdgAgt") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("InitnSrc") { PaymentInitiationSource1.parse(this) },
		)
	}
}

data class InstructionForCreditorAgent3(
	val Cd: ExternalCreditorAgentInstruction1Code?,
	val InstrInf: String?,
) {
	companion object {
		fun parse(k: Konsumer): InstructionForCreditorAgent3 = InstructionForCreditorAgent3(
			k.childOrNull("Cd") { text().xmlCodeSet<ExternalCreditorAgentInstruction1Code>() },
			k.childOrNull("InstrInf") { text() },
		)
	}
}

data class InstructionForDebtorAgent1(
	val Cd: ExternalDebtorAgentInstruction1Code?,
	val InstrInf: String?,
) {
	companion object {
		fun parse(k: Konsumer): InstructionForDebtorAgent1 = InstructionForDebtorAgent1(
			k.childOrNull("Cd") { text().xmlCodeSet<ExternalDebtorAgentInstruction1Code>() },
			k.childOrNull("InstrInf") { text() },
		)
	}
}

data class PaymentIdentification6(
	val InstrId: String?,
	val EndToEndId: String,
	val UETR: String?,
) {
	companion object {
		fun parse(k: Konsumer): PaymentIdentification6 = PaymentIdentification6(
			k.childOrNull("InstrId") { text() },
			k.child("EndToEndId") { text() },
			k.childOrNull("UETR") { text() },
		)
	}
}

data class PaymentInitiationSource1(
	val Nm: String,
	val Prvdr: String?,
	val Vrsn: String?,
) {
	companion object {
		fun parse(k: Konsumer): PaymentInitiationSource1 = PaymentInitiationSource1(
			k.child("Nm") { text() },
			k.childOrNull("Prvdr") { text() },
			k.childOrNull("Vrsn") { text() },
		)
	}
}

data class PaymentInstruction40(
	val PmtInfId: String,
	val PmtMtd: PaymentMethod3Code,
	val ReqdAdvcTp: AdviceType1?,
	val BtchBookg: Boolean?,
	val NbOfTxs: String?,
	val CtrlSum: Float?,
	val PmtTpInf: PaymentTypeInformation26?,
	val ReqdExctnDt: DateAndDateTime2Choice,
	val PoolgAdjstmntDt: LocalDate?,
	val Dbtr: PartyIdentification135,
	val DbtrAcct: CashAccount40,
	val DbtrAgt: BranchAndFinancialInstitutionIdentification6,
	val DbtrAgtAcct: CashAccount40?,
	val InstrForDbtrAgt: String?,
	val UltmtDbtr: PartyIdentification135?,
	val ChrgBr: ChargeBearerType1Code?,
	val ChrgsAcct: CashAccount40?,
	val ChrgsAcctAgt: BranchAndFinancialInstitutionIdentification6?,
	val CdtTrfTxInf: List<CreditTransferTransaction54>,
) {
	companion object {
		fun parse(k: Konsumer): PaymentInstruction40 = PaymentInstruction40(
			k.child("PmtInfId") { text() },
			k.child("PmtMtd") { PaymentMethod3Code.valueOf(text()) },
			k.childOrNull("ReqdAdvcTp") { AdviceType1.parse(this) },
			k.childOrNull("BtchBookg") { text().xmlBoolean() },
			k.childOrNull("NbOfTxs") { text() },
			k.childOrNull("CtrlSum") { text().xmlFloat() },
			k.childOrNull("PmtTpInf") { PaymentTypeInformation26.parse(this) },
			k.child("ReqdExctnDt") { DateAndDateTime2Choice.parse(this) },
			k.childOrNull("PoolgAdjstmntDt") { text().toDate() },
			k.child("Dbtr") { PartyIdentification135.parse(this) },
			k.child("DbtrAcct") { CashAccount40.parse(this) },
			k.child("DbtrAgt") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.childOrNull("DbtrAgtAcct") { CashAccount40.parse(this) },
			k.childOrNull("InstrForDbtrAgt") { text() },
			k.childOrNull("UltmtDbtr") { PartyIdentification135.parse(this) },
			k.childOrNull("ChrgBr") { ChargeBearerType1Code.valueOf(text()) },
			k.childOrNull("ChrgsAcct") { CashAccount40.parse(this) },
			k.childOrNull("ChrgsAcctAgt") { BranchAndFinancialInstitutionIdentification6.parse(this) },
			k.children("CdtTrfTxInf", minCount=1, ) { CreditTransferTransaction54.parse(this) },
		)
	}
}

enum class PaymentMethod3Code {
	CHK,
	TRF,
	TRA,
}

data class PaymentTypeInformation26(
	val InstrPrty: Priority2Code?,
	val SvcLvl: List<ServiceLevel8Choice>,
	val LclInstrm: LocalInstrument2Choice?,
	val CtgyPurp: CategoryPurpose1Choice?,
) {
	companion object {
		fun parse(k: Konsumer): PaymentTypeInformation26 = PaymentTypeInformation26(
			k.childOrNull("InstrPrty") { Priority2Code.valueOf(text()) },
			k.children("SvcLvl") { ServiceLevel8Choice.parse(this) },
			k.childOrNull("LclInstrm") { LocalInstrument2Choice.parse(this) },
			k.childOrNull("CtgyPurp") { CategoryPurpose1Choice.parse(this) },
		)
	}
}

data class RegulatoryAuthority2(
	val Nm: String?,
	val Ctry: String?,
) {
	companion object {
		fun parse(k: Konsumer): RegulatoryAuthority2 = RegulatoryAuthority2(
			k.childOrNull("Nm") { text() },
			k.childOrNull("Ctry") { text() },
		)
	}
}

data class RegulatoryReporting3(
	val DbtCdtRptgInd: RegulatoryReportingType1Code?,
	val Authrty: RegulatoryAuthority2?,
	val Dtls: List<StructuredRegulatoryReporting3>,
) {
	companion object {
		fun parse(k: Konsumer): RegulatoryReporting3 = RegulatoryReporting3(
			k.childOrNull("DbtCdtRptgInd") { RegulatoryReportingType1Code.valueOf(text()) },
			k.childOrNull("Authrty") { RegulatoryAuthority2.parse(this) },
			k.children("Dtls") { StructuredRegulatoryReporting3.parse(this) },
		)
	}
}

enum class RegulatoryReportingType1Code {
	CRED,
	DEBT,
	BOTH,
}

data class StructuredRegulatoryReporting3(
	val Tp: String?,
	val Dt: LocalDate?,
	val Ctry: String?,
	val Cd: String?,
	val Amt: ActiveOrHistoricCurrencyAndAmount?,
	val Inf: List<String>,
) {
	companion object {
		fun parse(k: Konsumer): StructuredRegulatoryReporting3 = StructuredRegulatoryReporting3(
			k.childOrNull("Tp") { text() },
			k.childOrNull("Dt") { text().toDate() },
			k.childOrNull("Ctry") { text() },
			k.childOrNull("Cd") { text() },
			k.childOrNull("Amt") { ActiveOrHistoricCurrencyAndAmount.parse(this) },
			k.children("Inf") { text() },
		)
	}
}

data class TaxInformation10(
	val Cdtr: TaxParty1?,
	val Dbtr: TaxParty2?,
	val AdmstnZone: String?,
	val RefNb: String?,
	val Mtd: String?,
	val TtlTaxblBaseAmt: ActiveOrHistoricCurrencyAndAmount?,
	val TtlTaxAmt: ActiveOrHistoricCurrencyAndAmount?,
	val Dt: LocalDate?,
	val SeqNb: Float?,
	val Rcrd: List<TaxRecord3>,
) {
	companion object {
		fun parse(k: Konsumer): TaxInformation10 = TaxInformation10(
			k.childOrNull("Cdtr") { TaxParty1.parse(this) },
			k.childOrNull("Dbtr") { TaxParty2.parse(this) },
			k.childOrNull("AdmstnZone") { text() },
			k.childOrNull("RefNb") { text() },
			k.childOrNull("Mtd") { text() },
			k.childOrNull("TtlTaxblBaseAmt") { ActiveOrHistoricCurrencyAndAmount.parse(this) },
			k.childOrNull("TtlTaxAmt") { ActiveOrHistoricCurrencyAndAmount.parse(this) },
			k.childOrNull("Dt") { text().toDate() },
			k.childOrNull("SeqNb") { text().xmlFloat() },
			k.children("Rcrd") { TaxRecord3.parse(this) },
		)
	}
}