@lucianpacurar/iso20022.js 0.2.10 → 0.2.12
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 +387 -18
- package/dist/index.js +978 -283
- package/dist/index.mjs +978 -284
- package/dist/src/camt/003/cash-management-get-account.d.ts +2 -2
- package/dist/src/camt/004/cash-management-return-account.d.ts +4 -4
- package/dist/src/camt/005/cash-management-get-transaction.d.ts +2 -2
- package/dist/src/camt/006/cash-management-return-transaction.d.ts +4 -4
- package/dist/src/camt/index.d.ts +5 -5
- package/dist/src/index.d.ts +5 -3
- package/dist/src/iso20022.d.ts +118 -0
- package/dist/src/lib/types.d.ts +56 -0
- package/dist/src/pain/001/payment-initiation.d.ts +2 -2
- package/dist/src/pain/001/sepa-credit-payment-initiation.d.ts +1 -1
- package/dist/src/pain/001/sepa-multi-credit-payment-initiation.d.ts +1 -1
- package/dist/src/pain/008/index.d.ts +2 -0
- package/dist/src/pain/008/sepa-direct-debit-payment-initiation.d.ts +198 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericISO20022Message, ISO20022MessageTypeName } from
|
|
2
|
-
import { AccountIdentification, MessageHeader } from
|
|
1
|
+
import { GenericISO20022Message, ISO20022MessageTypeName } from '../../lib/interfaces';
|
|
2
|
+
import { AccountIdentification, MessageHeader } from '../../lib/types';
|
|
3
3
|
export interface CashManagementGetAccountCriterium {
|
|
4
4
|
accountRegExp?: string;
|
|
5
5
|
accountEqualTo?: AccountIdentification;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BalanceInReport, BusinessError } from
|
|
2
|
-
import { GenericISO20022Message, ISO20022MessageTypeName } from
|
|
3
|
-
import { AccountIdentification, CashAccountType, MessageHeader } from
|
|
4
|
-
import { Currency } from
|
|
1
|
+
import { BalanceInReport, BusinessError } from '../types';
|
|
2
|
+
import { GenericISO20022Message, ISO20022MessageTypeName } from '../../lib/interfaces';
|
|
3
|
+
import { AccountIdentification, CashAccountType, MessageHeader } from '../../lib/types';
|
|
4
|
+
import { Currency } from 'dinero.js';
|
|
5
5
|
export interface AccountReport {
|
|
6
6
|
currency: Currency;
|
|
7
7
|
name?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericISO20022Message, ISO20022MessageTypeName } from
|
|
2
|
-
import { MessageHeader } from
|
|
1
|
+
import { GenericISO20022Message, ISO20022MessageTypeName } from '../../lib/interfaces';
|
|
2
|
+
import { MessageHeader } from '../../lib/types';
|
|
3
3
|
export interface CashManagementGetTransactionCriterium {
|
|
4
4
|
type: string;
|
|
5
5
|
msgIdsEqualTo?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BusinessError } from
|
|
2
|
-
import { GenericISO20022Message, ISO20022MessageTypeName } from
|
|
3
|
-
import { Agent, MessageHeader, Party } from
|
|
4
|
-
import { Currency } from
|
|
1
|
+
import { BusinessError } from '../types';
|
|
2
|
+
import { GenericISO20022Message, ISO20022MessageTypeName } from '../../lib/interfaces';
|
|
3
|
+
import { Agent, MessageHeader, Party } from '../../lib/types';
|
|
4
|
+
import { Currency } from 'dinero.js';
|
|
5
5
|
export interface TransactionReport {
|
|
6
6
|
msgId?: string;
|
|
7
7
|
reqExecutionDate?: Date;
|
package/dist/src/camt/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './003/cash-management-get-account';
|
|
2
|
+
export * from './004/cash-management-return-account';
|
|
3
|
+
export * from './005/cash-management-get-transaction';
|
|
4
|
+
export * from './006/cash-management-return-transaction';
|
|
5
|
+
export * from './types';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
* @see {@link https://iso20022js.com} for more information.
|
|
43
43
|
*/
|
|
44
44
|
export { default as ISO20022 } from './iso20022';
|
|
45
|
-
export type { Party, Account, Agent, SWIFTCreditPaymentInstruction, SEPACreditPaymentInstruction, RTPCreditPaymentInstruction, ACHCreditPaymentInstruction, StructuredAddress, IBANAccount, BaseAccount, BICAgent, ABAAgent, ACHLocalInstrument, } from './lib/types';
|
|
46
|
-
export { ACHLocalInstrumentCode, ACHLocalInstrumentCodeDescriptionMap } from './lib/types';
|
|
45
|
+
export type { Party, Account, Agent, SWIFTCreditPaymentInstruction, SEPACreditPaymentInstruction, RTPCreditPaymentInstruction, ACHCreditPaymentInstruction, SEPADirectDebitPaymentInstruction, StructuredAddress, IBANAccount, BaseAccount, BICAgent, ABAAgent, ACHLocalInstrument, SEPALocalInstrument, SEPASequenceType, MandateInformation, MandateAmendmentInformation, } from './lib/types';
|
|
46
|
+
export { ACHLocalInstrumentCode, ACHLocalInstrumentCodeDescriptionMap, } from './lib/types';
|
|
47
47
|
export type { SWIFTCreditPaymentInitiationConfig } from './pain/001/swift-credit-payment-initiation';
|
|
48
48
|
export { SWIFTCreditPaymentInitiation } from './pain/001/swift-credit-payment-initiation';
|
|
49
49
|
export type { SEPACreditPaymentInitiationConfig } from './pain/001/sepa-credit-payment-initiation';
|
|
50
50
|
export { SEPACreditPaymentInitiation } from './pain/001/sepa-credit-payment-initiation';
|
|
51
|
-
export type { SEPAMultiCreditPaymentInitiationConfig, SEPAMultiCreditPaymentInstructionGroup } from './pain/001/sepa-multi-credit-payment-initiation';
|
|
51
|
+
export type { SEPAMultiCreditPaymentInitiationConfig, SEPAMultiCreditPaymentInstructionGroup, } from './pain/001/sepa-multi-credit-payment-initiation';
|
|
52
52
|
export { SEPAMultiCreditPaymentInitiation } from './pain/001/sepa-multi-credit-payment-initiation';
|
|
53
53
|
export type { RTPCreditPaymentInitiationConfig } from './pain/001/rtp-credit-payment-initiation';
|
|
54
54
|
export { RTPCreditPaymentInitiation } from './pain/001/rtp-credit-payment-initiation';
|
|
@@ -57,6 +57,8 @@ export { ACHCreditPaymentInitiation } from './pain/001/ach-credit-payment-initia
|
|
|
57
57
|
export type { OriginalGroupInformation, StatusType, PaymentStatus as Status, BaseStatusInformation as BaseStatus, GroupStatusInformation as GroupStatus, PaymentStatusInformation as PaymentStatus, TransactionStatusInformation as TransactionStatus, StatusInformation, } from './pain/002/types';
|
|
58
58
|
export { PaymentStatusCode } from './pain/002/types';
|
|
59
59
|
export { PaymentStatusReport } from './pain/002/payment-status-report';
|
|
60
|
+
export type { SEPADirectDebitPaymentInitiationConfig, SEPADirectDebitPaymentInstructionGroup, } from './pain/008/sepa-direct-debit-payment-initiation';
|
|
61
|
+
export { SEPADirectDebitPaymentInitiation } from './pain/008/sepa-direct-debit-payment-initiation';
|
|
60
62
|
export type { Statement, Balance, Entry, Transaction, BalanceType, } from './camt/types';
|
|
61
63
|
export { BalanceTypeCode, BalanceTypeCodeDescriptionMap } from './camt/types';
|
|
62
64
|
export { CashManagementEndOfDayReport } from './camt/053/cash-management-end-of-day-report';
|
package/dist/src/iso20022.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SEPACreditPaymentInitiation } from './pain/001/sepa-credit-payment-init
|
|
|
4
4
|
import { SEPAMultiCreditPaymentInitiation, SEPAMultiCreditPaymentInstructionGroup } from './pain/001/sepa-multi-credit-payment-initiation';
|
|
5
5
|
import { RTPCreditPaymentInitiation } from './pain/001/rtp-credit-payment-initiation';
|
|
6
6
|
import { ACHCreditPaymentInitiation } from './pain/001/ach-credit-payment-initiation';
|
|
7
|
+
import { SEPADirectDebitPaymentInitiation, SEPADirectDebitPaymentInstructionGroup } from './pain/008/sepa-direct-debit-payment-initiation';
|
|
7
8
|
import { GenericISO20022Message, ISO20022MessageTypeName } from './lib/interfaces';
|
|
8
9
|
export * from './camt';
|
|
9
10
|
export * from './lib';
|
|
@@ -266,6 +267,72 @@ export interface ACHCreditPaymentInitiationConfig {
|
|
|
266
267
|
*/
|
|
267
268
|
creationDate?: Date;
|
|
268
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Configuration interface for SEPA Direct Debit Payment Initiation.
|
|
272
|
+
* @interface SEPADirectDebitPaymentInitiationConfig
|
|
273
|
+
* @example
|
|
274
|
+
* const config: SEPADirectDebitPaymentInitiationConfig = {
|
|
275
|
+
* paymentInstructions: [
|
|
276
|
+
* {
|
|
277
|
+
* creditor: {
|
|
278
|
+
* name: 'Landlord Company Ltd',
|
|
279
|
+
* account: {
|
|
280
|
+
* iban: 'DE54120300001030860744',
|
|
281
|
+
* },
|
|
282
|
+
* agent: {
|
|
283
|
+
* bic: 'BYLADEM1001',
|
|
284
|
+
* },
|
|
285
|
+
* },
|
|
286
|
+
* creditorSchemeId: 'DE96ZZZ00000345986',
|
|
287
|
+
* requestedCollectionDate: new Date('2025-11-22'),
|
|
288
|
+
* sequenceType: 'RCUR',
|
|
289
|
+
* payments: [
|
|
290
|
+
* {
|
|
291
|
+
* type: 'sepa',
|
|
292
|
+
* direction: 'debit',
|
|
293
|
+
* amount: 31700, // €317.00 Euros
|
|
294
|
+
* currency: 'EUR',
|
|
295
|
+
* debtor: {
|
|
296
|
+
* name: 'John Doe',
|
|
297
|
+
* account: {
|
|
298
|
+
* iban: 'DE20120300001088243355',
|
|
299
|
+
* },
|
|
300
|
+
* agent: {
|
|
301
|
+
* bic: 'BYLADEM1001',
|
|
302
|
+
* },
|
|
303
|
+
* },
|
|
304
|
+
* mandate: {
|
|
305
|
+
* mandateId: 'MR-12345-001',
|
|
306
|
+
* dateOfSignature: new Date('2024-01-15'),
|
|
307
|
+
* amendmentIndicator: false,
|
|
308
|
+
* },
|
|
309
|
+
* remittanceInformation: 'Rent payment November 2024',
|
|
310
|
+
* },
|
|
311
|
+
* ],
|
|
312
|
+
* localInstrument: 'CORE', // Optional, defaults to CORE
|
|
313
|
+
* },
|
|
314
|
+
* ],
|
|
315
|
+
* messageId: 'MSGID123', // Optional
|
|
316
|
+
* creationDate: new Date(), // Optional
|
|
317
|
+
* };
|
|
318
|
+
*/
|
|
319
|
+
export interface SEPADirectDebitPaymentInitiationConfig {
|
|
320
|
+
/**
|
|
321
|
+
* An array of payment instruction groups, each with its own creditor.
|
|
322
|
+
* @type {AtLeastOne<SEPADirectDebitPaymentInstructionGroup>}
|
|
323
|
+
*/
|
|
324
|
+
paymentInstructions: AtLeastOne<SEPADirectDebitPaymentInstructionGroup>;
|
|
325
|
+
/**
|
|
326
|
+
* Optional unique identifier for the message. If not provided, a UUID will be generated.
|
|
327
|
+
* @type {string}
|
|
328
|
+
*/
|
|
329
|
+
messageId?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Optional creation date for the message. If not provided, current date will be used.
|
|
332
|
+
* @type {Date}
|
|
333
|
+
*/
|
|
334
|
+
creationDate?: Date;
|
|
335
|
+
}
|
|
269
336
|
/**
|
|
270
337
|
* Represents an ISO20022 core message creator.
|
|
271
338
|
* This class provides methods to create various basic ISO20022 compliant messages.
|
|
@@ -449,6 +516,57 @@ declare class ISO20022 {
|
|
|
449
516
|
* @returns {ACHCreditPaymentInitiation} A new ACH Credit Payment Initiation object.
|
|
450
517
|
*/
|
|
451
518
|
createACHCreditPaymentInitiation(config: ACHCreditPaymentInitiationConfig): ACHCreditPaymentInitiation;
|
|
519
|
+
/**
|
|
520
|
+
* Creates a SEPA Direct Debit Payment Initiation message.
|
|
521
|
+
* @param {SEPADirectDebitPaymentInitiationConfig} config - Configuration containing payment instruction groups and optional parameters.
|
|
522
|
+
* @example
|
|
523
|
+
* const payment = iso20022.createSEPADirectDebitPaymentInitiation({
|
|
524
|
+
* paymentInstructions: [
|
|
525
|
+
* {
|
|
526
|
+
* creditor: {
|
|
527
|
+
* name: 'Landlord Company Ltd',
|
|
528
|
+
* account: {
|
|
529
|
+
* iban: 'DE54120300001030860744',
|
|
530
|
+
* },
|
|
531
|
+
* agent: {
|
|
532
|
+
* bic: 'BYLADEM1001',
|
|
533
|
+
* },
|
|
534
|
+
* },
|
|
535
|
+
* creditorSchemeId: 'DE96ZZZ00000345986',
|
|
536
|
+
* requestedCollectionDate: new Date('2025-11-22'),
|
|
537
|
+
* sequenceType: 'RCUR',
|
|
538
|
+
* payments: [
|
|
539
|
+
* {
|
|
540
|
+
* type: 'sepa',
|
|
541
|
+
* direction: 'debit',
|
|
542
|
+
* amount: 31700, // €317.00 Euros
|
|
543
|
+
* currency: 'EUR',
|
|
544
|
+
* debtor: {
|
|
545
|
+
* name: 'John Doe',
|
|
546
|
+
* account: {
|
|
547
|
+
* iban: 'DE20120300001088243355',
|
|
548
|
+
* },
|
|
549
|
+
* agent: {
|
|
550
|
+
* bic: 'BYLADEM1001',
|
|
551
|
+
* },
|
|
552
|
+
* },
|
|
553
|
+
* mandate: {
|
|
554
|
+
* mandateId: 'MR-12345-001',
|
|
555
|
+
* dateOfSignature: new Date('2024-01-15'),
|
|
556
|
+
* amendmentIndicator: false,
|
|
557
|
+
* },
|
|
558
|
+
* remittanceInformation: 'Rent payment November 2024',
|
|
559
|
+
* },
|
|
560
|
+
* ],
|
|
561
|
+
* localInstrument: 'CORE', // Optional
|
|
562
|
+
* },
|
|
563
|
+
* ],
|
|
564
|
+
* messageId: 'DD-MSG-001', // Optional
|
|
565
|
+
* creationDate: new Date('2025-03-01'), // Optional
|
|
566
|
+
* });
|
|
567
|
+
* @returns {SEPADirectDebitPaymentInitiation} A new SEPA Direct Debit Payment Initiation object.
|
|
568
|
+
*/
|
|
569
|
+
createSEPADirectDebitPaymentInitiation(config: SEPADirectDebitPaymentInitiationConfig): SEPADirectDebitPaymentInitiation;
|
|
452
570
|
/** Create a message CAMT or other */
|
|
453
571
|
createMessage(type: ISO20022MessageTypeName, config: any): GenericISO20022Message;
|
|
454
572
|
}
|
package/dist/src/lib/types.d.ts
CHANGED
|
@@ -376,3 +376,59 @@ export declare const CashAccountTypeCodeDescriptionMap: {
|
|
|
376
376
|
readonly TRAN: "Transacting Account";
|
|
377
377
|
readonly TRAS: "Cash Trading";
|
|
378
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* SEPA Direct Debit Local Instrument Codes.
|
|
381
|
+
* Defines the type of SEPA direct debit scheme.
|
|
382
|
+
*/
|
|
383
|
+
export type SEPALocalInstrument = 'CORE' | 'B2B';
|
|
384
|
+
/**
|
|
385
|
+
* SEPA Direct Debit Sequence Type Codes.
|
|
386
|
+
* Indicates the position of a direct debit transaction in a series of recurring direct debits.
|
|
387
|
+
* - FRST: First collection in a series of recurring direct debits
|
|
388
|
+
* - RCUR: Recurring collection in a series of recurring direct debits
|
|
389
|
+
* - OOFF: One-off direct debit collection
|
|
390
|
+
* - FNAL: Final collection in a series of recurring direct debits
|
|
391
|
+
*/
|
|
392
|
+
export type SEPASequenceType = 'FRST' | 'RCUR' | 'OOFF' | 'FNAL';
|
|
393
|
+
/**
|
|
394
|
+
* Information about amendments made to a direct debit mandate.
|
|
395
|
+
*/
|
|
396
|
+
export interface MandateAmendmentInformation {
|
|
397
|
+
/** Original mandate identification before amendment */
|
|
398
|
+
originalMandateId?: string;
|
|
399
|
+
/** Original creditor scheme identification before amendment */
|
|
400
|
+
originalCreditorSchemeId?: {
|
|
401
|
+
name?: string;
|
|
402
|
+
id?: string;
|
|
403
|
+
};
|
|
404
|
+
/** Original debtor before amendment */
|
|
405
|
+
originalDebtor?: Party;
|
|
406
|
+
/** Original debtor account before amendment */
|
|
407
|
+
originalDebtorAccount?: Account;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Direct debit mandate information.
|
|
411
|
+
* A mandate is an authorization from a debtor allowing a creditor to collect payments.
|
|
412
|
+
*/
|
|
413
|
+
export interface MandateInformation {
|
|
414
|
+
/** Unique mandate identification */
|
|
415
|
+
mandateId: string;
|
|
416
|
+
/** Date when the mandate was signed by the debtor */
|
|
417
|
+
dateOfSignature: Date;
|
|
418
|
+
/** Indicates whether the mandate has been amended */
|
|
419
|
+
amendmentIndicator: boolean;
|
|
420
|
+
/** Amendment details if the mandate has been amended */
|
|
421
|
+
amendmentInformation?: MandateAmendmentInformation;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Represents a SEPA direct debit payment instruction.
|
|
425
|
+
*/
|
|
426
|
+
export interface SEPADirectDebitPaymentInstruction extends PaymentInstruction {
|
|
427
|
+
type?: 'sepa';
|
|
428
|
+
direction?: 'debit';
|
|
429
|
+
currency: 'EUR';
|
|
430
|
+
/** The party being debited (money is collected from this party) */
|
|
431
|
+
debtor: Party;
|
|
432
|
+
/** Mandate information authorizing the direct debit */
|
|
433
|
+
mandate: MandateInformation;
|
|
434
|
+
}
|
|
@@ -5,9 +5,9 @@ import { Party, IBANAccount, Account, Agent } from '../../lib/types';
|
|
|
5
5
|
* @abstract
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class PaymentInitiation {
|
|
8
|
-
type:
|
|
8
|
+
type: 'swift' | 'rtp' | 'sepa' | 'ach';
|
|
9
9
|
constructor({ type }: {
|
|
10
|
-
type:
|
|
10
|
+
type: 'swift' | 'rtp' | 'sepa' | 'ach';
|
|
11
11
|
});
|
|
12
12
|
/**
|
|
13
13
|
* Serializes the payment initiation to a string format.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalCategoryPurpose, Party, SEPACreditPaymentInstruction } from
|
|
1
|
+
import { ExternalCategoryPurpose, Party, SEPACreditPaymentInstruction } from '../../lib/types';
|
|
2
2
|
import { PaymentInitiation } from './payment-initiation';
|
|
3
3
|
type AtLeastOne<T> = [T, ...T[]];
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExternalCategoryPurpose, Party, SEPACreditPaymentInstruction } from
|
|
1
|
+
import type { ExternalCategoryPurpose, Party, SEPACreditPaymentInstruction } from '../../lib/types';
|
|
2
2
|
import { PaymentInitiation } from './payment-initiation';
|
|
3
3
|
type AtLeastOne<T> = [T, ...T[]];
|
|
4
4
|
/**
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { ExternalCategoryPurpose, Party, SEPADirectDebitPaymentInstruction, SEPALocalInstrument, SEPASequenceType } from '../../lib/types';
|
|
2
|
+
import { PaymentInitiation } from '../001/payment-initiation';
|
|
3
|
+
type AtLeastOne<T> = [T, ...T[]];
|
|
4
|
+
/**
|
|
5
|
+
* Represents a group of direct debit payment instructions for a single creditor (PmtInf block).
|
|
6
|
+
*
|
|
7
|
+
* @property {Party} creditor - The party collecting money from debtors.
|
|
8
|
+
* @property {string} creditorSchemeId - The creditor's SEPA scheme identifier (e.g., "DE96ZZZ00000345986").
|
|
9
|
+
* @property {AtLeastOne<SEPADirectDebitPaymentInstruction>} payments - An array containing at least one payment instruction for this creditor.
|
|
10
|
+
* @property {Date} requestedCollectionDate - The date when funds should be collected from all debtors in this group.
|
|
11
|
+
* @property {SEPASequenceType} sequenceType - Sequence type indicating the position in a series of direct debits (FRST, RCUR, OOFF, FNAL).
|
|
12
|
+
* @property {SEPALocalInstrument} [localInstrument] - The SEPA direct debit scheme (CORE or B2B). Defaults to 'CORE'.
|
|
13
|
+
* @property {ExternalCategoryPurpose} [categoryPurpose] - Optional category purpose code for this payment information block.
|
|
14
|
+
* @property {boolean} [batchBooking] - Indicates whether transactions should be booked in batch. Defaults to false.
|
|
15
|
+
*/
|
|
16
|
+
export interface SEPADirectDebitPaymentInstructionGroup {
|
|
17
|
+
/** The party collecting money from debtors. */
|
|
18
|
+
creditor: Party;
|
|
19
|
+
/** The creditor's SEPA scheme identifier. */
|
|
20
|
+
creditorSchemeId: string;
|
|
21
|
+
/** An array containing at least one direct debit instruction. */
|
|
22
|
+
payments: AtLeastOne<SEPADirectDebitPaymentInstruction>;
|
|
23
|
+
/** The date when funds should be collected from all debtors. */
|
|
24
|
+
requestedCollectionDate: Date;
|
|
25
|
+
/** Sequence type for all transactions in this group (FRST, RCUR, OOFF, FNAL). */
|
|
26
|
+
sequenceType: SEPASequenceType;
|
|
27
|
+
/** The SEPA direct debit scheme (CORE or B2B). Defaults to 'CORE'. */
|
|
28
|
+
localInstrument?: SEPALocalInstrument;
|
|
29
|
+
/** Optional category purpose code for this payment information block. */
|
|
30
|
+
categoryPurpose?: ExternalCategoryPurpose;
|
|
31
|
+
/** Indicates whether transactions should be booked in batch. Defaults to false. */
|
|
32
|
+
batchBooking?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for SEPA Direct Debit Payment Initiation.
|
|
36
|
+
*
|
|
37
|
+
* @property {Party} initiatingParty - The top-level party initiating the message (used in GrpHdr).
|
|
38
|
+
* @property {AtLeastOne<SEPADirectDebitPaymentInstructionGroup>} paymentInstructions - An array containing at least one payment instruction group.
|
|
39
|
+
* @property {string} [messageId] - Optional unique identifier for the message. If not provided, a UUID will be generated.
|
|
40
|
+
* @property {Date} [creationDate] - Optional creation date for the message. If not provided, current date will be used.
|
|
41
|
+
*/
|
|
42
|
+
export interface SEPADirectDebitPaymentInitiationConfig {
|
|
43
|
+
/** The top-level party initiating the message (used in GrpHdr). */
|
|
44
|
+
initiatingParty: Party;
|
|
45
|
+
/** An array containing at least one payment instruction group. */
|
|
46
|
+
paymentInstructions: AtLeastOne<SEPADirectDebitPaymentInstructionGroup>;
|
|
47
|
+
/** Optional unique identifier for the message. If not provided, a UUID will be generated. */
|
|
48
|
+
messageId?: string;
|
|
49
|
+
/** Optional creation date for the message. If not provided, current date will be used. */
|
|
50
|
+
creationDate?: Date;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Represents a SEPA Direct Debit Payment Initiation.
|
|
54
|
+
* This class handles the creation and serialization of SEPA direct debit messages
|
|
55
|
+
* with multiple payment information blocks (multiple creditors) according to the ISO20022 pain.008 standard.
|
|
56
|
+
* @class
|
|
57
|
+
* @extends PaymentInitiation
|
|
58
|
+
* @param {SEPADirectDebitPaymentInitiationConfig} config - The configuration for the SEPA Direct Debit Payment Initiation message.
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Creating a SEPA direct debit message
|
|
62
|
+
* const payment = new SEPADirectDebitPaymentInitiation({
|
|
63
|
+
* initiatingParty: { name: 'Company Ltd', id: '12345' },
|
|
64
|
+
* paymentInstructions: [
|
|
65
|
+
* {
|
|
66
|
+
* creditor: creditor1,
|
|
67
|
+
* creditorSchemeId: 'DE96ZZZ00000345986',
|
|
68
|
+
* requestedCollectionDate: new Date('2025-11-22'),
|
|
69
|
+
* sequenceType: 'RCUR',
|
|
70
|
+
* payments: [debit1, debit2]
|
|
71
|
+
* }
|
|
72
|
+
* ]
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class SEPADirectDebitPaymentInitiation extends PaymentInitiation {
|
|
77
|
+
initiatingParty: Party;
|
|
78
|
+
messageId: string;
|
|
79
|
+
creationDate: Date;
|
|
80
|
+
paymentInstructions: AtLeastOne<SEPADirectDebitPaymentInstructionGroup>;
|
|
81
|
+
paymentInformationIdBase: string;
|
|
82
|
+
private formattedPaymentSum;
|
|
83
|
+
private totalTransactionCount;
|
|
84
|
+
/**
|
|
85
|
+
* Creates an instance of SEPADirectDebitPaymentInitiation.
|
|
86
|
+
* @param {SEPADirectDebitPaymentInitiationConfig} config - The configuration object for the SEPA direct debit.
|
|
87
|
+
*/
|
|
88
|
+
constructor(config: SEPADirectDebitPaymentInitiationConfig);
|
|
89
|
+
/**
|
|
90
|
+
* Counts the total number of transactions across all payment instruction groups.
|
|
91
|
+
* @private
|
|
92
|
+
* @returns {number} The total count of all transactions.
|
|
93
|
+
*/
|
|
94
|
+
private countAllTransactions;
|
|
95
|
+
/**
|
|
96
|
+
* Calculates the sum of all payment instructions across all groups.
|
|
97
|
+
* @private
|
|
98
|
+
* @returns {string} The total sum formatted as a string with 2 decimal places.
|
|
99
|
+
*/
|
|
100
|
+
private sumAllPayments;
|
|
101
|
+
/**
|
|
102
|
+
* Validates the payment initiation data according to SEPA requirements.
|
|
103
|
+
* @private
|
|
104
|
+
* @throws {Error} If messageId exceeds 35 characters.
|
|
105
|
+
* @throws {Error} If any group's payment instructions have different currencies.
|
|
106
|
+
*/
|
|
107
|
+
private validate;
|
|
108
|
+
/**
|
|
109
|
+
* Validates that all payment instructions in a group have the same currency (EUR).
|
|
110
|
+
* @private
|
|
111
|
+
* @param {AtLeastOne<SEPADirectDebitPaymentInstruction>} payments - Array of payment instructions.
|
|
112
|
+
* @throws {Error} If payment instructions have different currencies.
|
|
113
|
+
*/
|
|
114
|
+
private validateGroupInstructionsHaveSameCurrency;
|
|
115
|
+
/**
|
|
116
|
+
* Generates payment information for a single SEPA direct debit transfer instruction.
|
|
117
|
+
* @param {SEPADirectDebitPaymentInstruction} instruction - The payment instruction.
|
|
118
|
+
* @returns {Object} The payment information object formatted according to SEPA direct debit specifications.
|
|
119
|
+
*/
|
|
120
|
+
directDebitTransfer(instruction: SEPADirectDebitPaymentInstruction): {
|
|
121
|
+
RmtInf?: {
|
|
122
|
+
Ustrd: string;
|
|
123
|
+
} | undefined;
|
|
124
|
+
PmtId: {
|
|
125
|
+
EndToEndId: string;
|
|
126
|
+
};
|
|
127
|
+
InstdAmt: {
|
|
128
|
+
'#': string;
|
|
129
|
+
'@Ccy': "EUR";
|
|
130
|
+
};
|
|
131
|
+
DrctDbtTx: {
|
|
132
|
+
MndtRltdInf: {
|
|
133
|
+
AmdmntInfDtls?: {
|
|
134
|
+
OrgnlCdtrSchmeId?: {
|
|
135
|
+
Id?: {
|
|
136
|
+
PrvtId: {
|
|
137
|
+
Othr: {
|
|
138
|
+
Id: string;
|
|
139
|
+
SchmeNm: {
|
|
140
|
+
Prtry: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
} | undefined;
|
|
145
|
+
Nm?: string | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
OrgnlMndtId?: string | undefined;
|
|
148
|
+
} | undefined;
|
|
149
|
+
MndtId: string;
|
|
150
|
+
DtOfSgntr: string;
|
|
151
|
+
AmdmntInd: boolean;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
DbtrAgt: {
|
|
155
|
+
FinInstnId: {
|
|
156
|
+
BIC: string;
|
|
157
|
+
ClrSysMmbId?: undefined;
|
|
158
|
+
};
|
|
159
|
+
} | {
|
|
160
|
+
FinInstnId: {
|
|
161
|
+
ClrSysMmbId: {
|
|
162
|
+
ClrSysId: {
|
|
163
|
+
Cd: string;
|
|
164
|
+
};
|
|
165
|
+
MmbId: string;
|
|
166
|
+
};
|
|
167
|
+
BIC?: undefined;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
Dbtr: any;
|
|
171
|
+
DbtrAcct: {
|
|
172
|
+
Id: {
|
|
173
|
+
IBAN: string;
|
|
174
|
+
};
|
|
175
|
+
} | {
|
|
176
|
+
Id: {
|
|
177
|
+
Othr: {
|
|
178
|
+
Id: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Serializes the SEPA direct debit initiation to an XML string.
|
|
185
|
+
* @returns {string} The XML representation of the SEPA direct debit initiation.
|
|
186
|
+
*/
|
|
187
|
+
serialize(): string;
|
|
188
|
+
/**
|
|
189
|
+
* Parses an XML string and creates a SEPADirectDebitPaymentInitiation instance.
|
|
190
|
+
* Supports multiple PmtInf blocks in the XML document.
|
|
191
|
+
* @param {string} rawXml - The XML string to parse.
|
|
192
|
+
* @returns {SEPADirectDebitPaymentInitiation} A new instance created from the XML data.
|
|
193
|
+
* @throws {InvalidXmlError} If the XML format is invalid.
|
|
194
|
+
* @throws {InvalidXmlNamespaceError} If the namespace is not pain.008.
|
|
195
|
+
*/
|
|
196
|
+
static fromXML(rawXml: string): SEPADirectDebitPaymentInitiation;
|
|
197
|
+
}
|
|
198
|
+
export {};
|