@lucianpacurar/iso20022.js 0.2.15 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1425,6 +1425,34 @@ declare class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
1425
1425
  RmtInf?: {
1426
1426
  Ustrd: string;
1427
1427
  } | undefined;
1428
+ Dbtr: any;
1429
+ DbtrAcct: {
1430
+ Id: {
1431
+ IBAN: string;
1432
+ };
1433
+ } | {
1434
+ Id: {
1435
+ Othr: {
1436
+ Id: string;
1437
+ };
1438
+ };
1439
+ };
1440
+ DbtrAgt?: {
1441
+ FinInstnId: {
1442
+ BIC: string;
1443
+ ClrSysMmbId?: undefined;
1444
+ };
1445
+ } | {
1446
+ FinInstnId: {
1447
+ ClrSysMmbId: {
1448
+ ClrSysId: {
1449
+ Cd: string;
1450
+ };
1451
+ MmbId: string;
1452
+ };
1453
+ BIC?: undefined;
1454
+ };
1455
+ } | undefined;
1428
1456
  PmtId: {
1429
1457
  EndToEndId: string;
1430
1458
  };
@@ -1455,34 +1483,6 @@ declare class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
1455
1483
  AmdmntInd: boolean;
1456
1484
  };
1457
1485
  };
1458
- DbtrAgt: {
1459
- FinInstnId: {
1460
- BIC: string;
1461
- ClrSysMmbId?: undefined;
1462
- };
1463
- } | {
1464
- FinInstnId: {
1465
- ClrSysMmbId: {
1466
- ClrSysId: {
1467
- Cd: string;
1468
- };
1469
- MmbId: string;
1470
- };
1471
- BIC?: undefined;
1472
- };
1473
- };
1474
- Dbtr: any;
1475
- DbtrAcct: {
1476
- Id: {
1477
- IBAN: string;
1478
- };
1479
- } | {
1480
- Id: {
1481
- Othr: {
1482
- Id: string;
1483
- };
1484
- };
1485
- };
1486
1486
  };
1487
1487
  /**
1488
1488
  * Serializes the SEPA direct debit initiation to an XML string.
@@ -1528,7 +1528,7 @@ interface Statement {
1528
1528
  /** Account details for which the statement is generated. */
1529
1529
  account: Account;
1530
1530
  /** Financial institution details. */
1531
- agent: Agent;
1531
+ agent?: Agent;
1532
1532
  /** Total number of entries in the statement. */
1533
1533
  numOfEntries?: number;
1534
1534
  /** Sum of all entries in the statement. */
package/dist/index.js CHANGED
@@ -8178,7 +8178,9 @@ class SEPACreditPaymentInitiation extends PaymentInitiation {
8178
8178
  ReqdExctnDt: this.creationDate.toISOString().split('T').at(0),
8179
8179
  Dbtr: this.party(this.initiatingParty),
8180
8180
  DbtrAcct: this.account(this.initiatingParty.account),
8181
- DbtrAgt: this.agent(this.initiatingParty.agent),
8181
+ ...(this.initiatingParty.agent && {
8182
+ DbtrAgt: this.agent(this.initiatingParty.agent),
8183
+ }),
8182
8184
  ChrgBr: 'SLEV',
8183
8185
  // payments[]
8184
8186
  CdtTrfTxInf: this.paymentInstructions.map(p => this.creditTransfer(p)),
@@ -9373,7 +9375,9 @@ class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
9373
9375
  }),
9374
9376
  },
9375
9377
  },
9376
- DbtrAgt: this.agent(instruction.debtor.agent),
9378
+ ...(instruction.debtor.agent && {
9379
+ DbtrAgt: this.agent(instruction.debtor.agent),
9380
+ }),
9377
9381
  Dbtr: this.party(instruction.debtor),
9378
9382
  DbtrAcct: this.account(instruction.debtor.account),
9379
9383
  ...(instruction.remittanceInformation && {
@@ -9422,7 +9426,9 @@ class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
9422
9426
  .split('T')[0],
9423
9427
  Cdtr: this.party(group.creditor),
9424
9428
  CdtrAcct: this.account(group.creditor.account),
9425
- CdtrAgt: this.agent(group.creditor.agent),
9429
+ ...(group.creditor.agent && {
9430
+ CdtrAgt: this.agent(group.creditor.agent),
9431
+ }),
9426
9432
  ChrgBr: 'SLEV',
9427
9433
  CdtrSchmeId: {
9428
9434
  Id: {
@@ -9810,7 +9816,7 @@ const parseStatement = (stmt) => {
9810
9816
  // Get account information
9811
9817
  // TODO: Save account types here
9812
9818
  const account = parseAccount(stmt.Acct);
9813
- const agent = parseAgent(stmt.Acct.Svcr);
9819
+ const agent = stmt.Acct.Svcr ? parseAgent(stmt.Acct.Svcr) : undefined;
9814
9820
  let balances = [];
9815
9821
  if (Array.isArray(stmt.Bal)) {
9816
9822
  balances = stmt.Bal.map(parseBalance);
@@ -9876,7 +9882,7 @@ const exportStatement = (stmt) => {
9876
9882
  },
9877
9883
  Acct: {
9878
9884
  ...exportAccount(stmt.account),
9879
- Svcr: exportAgent(stmt.agent),
9885
+ Svcr: stmt.agent ? exportAgent(stmt.agent) : undefined,
9880
9886
  },
9881
9887
  Bal: stmt.balances.map(bal => exportBalance(bal)),
9882
9888
  Ntry: stmt.entries.map(entry => exportEntry(entry)),
package/dist/index.mjs CHANGED
@@ -8176,7 +8176,9 @@ class SEPACreditPaymentInitiation extends PaymentInitiation {
8176
8176
  ReqdExctnDt: this.creationDate.toISOString().split('T').at(0),
8177
8177
  Dbtr: this.party(this.initiatingParty),
8178
8178
  DbtrAcct: this.account(this.initiatingParty.account),
8179
- DbtrAgt: this.agent(this.initiatingParty.agent),
8179
+ ...(this.initiatingParty.agent && {
8180
+ DbtrAgt: this.agent(this.initiatingParty.agent),
8181
+ }),
8180
8182
  ChrgBr: 'SLEV',
8181
8183
  // payments[]
8182
8184
  CdtTrfTxInf: this.paymentInstructions.map(p => this.creditTransfer(p)),
@@ -9371,7 +9373,9 @@ class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
9371
9373
  }),
9372
9374
  },
9373
9375
  },
9374
- DbtrAgt: this.agent(instruction.debtor.agent),
9376
+ ...(instruction.debtor.agent && {
9377
+ DbtrAgt: this.agent(instruction.debtor.agent),
9378
+ }),
9375
9379
  Dbtr: this.party(instruction.debtor),
9376
9380
  DbtrAcct: this.account(instruction.debtor.account),
9377
9381
  ...(instruction.remittanceInformation && {
@@ -9420,7 +9424,9 @@ class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
9420
9424
  .split('T')[0],
9421
9425
  Cdtr: this.party(group.creditor),
9422
9426
  CdtrAcct: this.account(group.creditor.account),
9423
- CdtrAgt: this.agent(group.creditor.agent),
9427
+ ...(group.creditor.agent && {
9428
+ CdtrAgt: this.agent(group.creditor.agent),
9429
+ }),
9424
9430
  ChrgBr: 'SLEV',
9425
9431
  CdtrSchmeId: {
9426
9432
  Id: {
@@ -9808,7 +9814,7 @@ const parseStatement = (stmt) => {
9808
9814
  // Get account information
9809
9815
  // TODO: Save account types here
9810
9816
  const account = parseAccount(stmt.Acct);
9811
- const agent = parseAgent(stmt.Acct.Svcr);
9817
+ const agent = stmt.Acct.Svcr ? parseAgent(stmt.Acct.Svcr) : undefined;
9812
9818
  let balances = [];
9813
9819
  if (Array.isArray(stmt.Bal)) {
9814
9820
  balances = stmt.Bal.map(parseBalance);
@@ -9874,7 +9880,7 @@ const exportStatement = (stmt) => {
9874
9880
  },
9875
9881
  Acct: {
9876
9882
  ...exportAccount(stmt.account),
9877
- Svcr: exportAgent(stmt.agent),
9883
+ Svcr: stmt.agent ? exportAgent(stmt.agent) : undefined,
9878
9884
  },
9879
9885
  Bal: stmt.balances.map(bal => exportBalance(bal)),
9880
9886
  Ntry: stmt.entries.map(entry => exportEntry(entry)),
@@ -19,7 +19,7 @@ export interface Statement {
19
19
  /** Account details for which the statement is generated. */
20
20
  account: Account;
21
21
  /** Financial institution details. */
22
- agent: Agent;
22
+ agent?: Agent;
23
23
  /** Total number of entries in the statement. */
24
24
  numOfEntries?: number;
25
25
  /** Sum of all entries in the statement. */
@@ -120,6 +120,34 @@ export declare class SEPADirectDebitPaymentInitiation extends PaymentInitiation
120
120
  RmtInf?: {
121
121
  Ustrd: string;
122
122
  } | undefined;
123
+ Dbtr: any;
124
+ DbtrAcct: {
125
+ Id: {
126
+ IBAN: string;
127
+ };
128
+ } | {
129
+ Id: {
130
+ Othr: {
131
+ Id: string;
132
+ };
133
+ };
134
+ };
135
+ DbtrAgt?: {
136
+ FinInstnId: {
137
+ BIC: string;
138
+ ClrSysMmbId?: undefined;
139
+ };
140
+ } | {
141
+ FinInstnId: {
142
+ ClrSysMmbId: {
143
+ ClrSysId: {
144
+ Cd: string;
145
+ };
146
+ MmbId: string;
147
+ };
148
+ BIC?: undefined;
149
+ };
150
+ } | undefined;
123
151
  PmtId: {
124
152
  EndToEndId: string;
125
153
  };
@@ -150,34 +178,6 @@ export declare class SEPADirectDebitPaymentInitiation extends PaymentInitiation
150
178
  AmdmntInd: boolean;
151
179
  };
152
180
  };
153
- DbtrAgt: {
154
- FinInstnId: {
155
- BIC: string;
156
- ClrSysMmbId?: undefined;
157
- };
158
- } | {
159
- FinInstnId: {
160
- ClrSysMmbId: {
161
- ClrSysId: {
162
- Cd: string;
163
- };
164
- MmbId: string;
165
- };
166
- BIC?: undefined;
167
- };
168
- };
169
- Dbtr: any;
170
- DbtrAcct: {
171
- Id: {
172
- IBAN: string;
173
- };
174
- } | {
175
- Id: {
176
- Othr: {
177
- Id: string;
178
- };
179
- };
180
- };
181
181
  };
182
182
  /**
183
183
  * Serializes the SEPA direct debit initiation to an XML string.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucianpacurar/iso20022.js",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "readme": "README.md",
5
5
  "description": "Library to create payment messages.",
6
6
  "main": "dist/index.js",