@lucianpacurar/iso20022.js 0.2.7 → 0.2.9
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 +250 -6
- package/dist/index.js +352 -5
- package/dist/index.mjs +352 -6
- package/dist/src/index.d.ts +2 -0
- package/dist/src/iso20022.d.ts +80 -0
- package/dist/src/pain/001/sepa-multi-credit-payment-initiation.d.ts +167 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -622,7 +622,7 @@ declare abstract class PaymentInitiation {
|
|
|
622
622
|
static getBuilder(): XMLBuilder;
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
-
type AtLeastOne$
|
|
625
|
+
type AtLeastOne$5<T> = [T, ...T[]];
|
|
626
626
|
/**
|
|
627
627
|
* Configuration for SWIFT Credit Payment Initiation.
|
|
628
628
|
*
|
|
@@ -635,7 +635,7 @@ interface SWIFTCreditPaymentInitiationConfig$1 {
|
|
|
635
635
|
/** The party initiating the payment. */
|
|
636
636
|
initiatingParty: Party;
|
|
637
637
|
/** An array of payment instructions. */
|
|
638
|
-
paymentInstructions: AtLeastOne$
|
|
638
|
+
paymentInstructions: AtLeastOne$5<SWIFTCreditPaymentInstruction>;
|
|
639
639
|
/** Optional unique identifier for the message. If not provided, a UUID will be generated. */
|
|
640
640
|
messageId?: string;
|
|
641
641
|
/** Optional creation date for the message. If not provided, current date will be used. */
|
|
@@ -692,7 +692,7 @@ declare class SWIFTCreditPaymentInitiation extends PaymentInitiation {
|
|
|
692
692
|
serialize(): string;
|
|
693
693
|
}
|
|
694
694
|
|
|
695
|
-
type AtLeastOne$
|
|
695
|
+
type AtLeastOne$4<T> = [T, ...T[]];
|
|
696
696
|
/**
|
|
697
697
|
* Configuration for SEPA Credit Payment Initiation.
|
|
698
698
|
*
|
|
@@ -706,7 +706,7 @@ interface SEPACreditPaymentInitiationConfig$1 {
|
|
|
706
706
|
/** The party initiating the SEPA credit transfer. */
|
|
707
707
|
initiatingParty: Party;
|
|
708
708
|
/** An array containing at least one payment instruction for SEPA credit transfer. */
|
|
709
|
-
paymentInstructions: AtLeastOne$
|
|
709
|
+
paymentInstructions: AtLeastOne$4<SEPACreditPaymentInstruction>;
|
|
710
710
|
/** Optional unique identifier for the message. If not provided, a UUID will be generated. */
|
|
711
711
|
messageId?: string;
|
|
712
712
|
/** Optional creation date for the message. If not provided, current date will be used. */
|
|
@@ -739,7 +739,7 @@ declare class SEPACreditPaymentInitiation extends PaymentInitiation {
|
|
|
739
739
|
initiatingParty: Party;
|
|
740
740
|
messageId: string;
|
|
741
741
|
creationDate: Date;
|
|
742
|
-
paymentInstructions: AtLeastOne$
|
|
742
|
+
paymentInstructions: AtLeastOne$4<SEPACreditPaymentInstruction>;
|
|
743
743
|
paymentInformationId: string;
|
|
744
744
|
categoryPurpose?: ExternalCategoryPurpose;
|
|
745
745
|
private formattedPaymentSum;
|
|
@@ -816,6 +816,171 @@ declare class SEPACreditPaymentInitiation extends PaymentInitiation {
|
|
|
816
816
|
static fromXML(rawXml: string): SEPACreditPaymentInitiation;
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
+
type AtLeastOne$3<T> = [T, ...T[]];
|
|
820
|
+
/**
|
|
821
|
+
* Represents a group of payment instructions for a single debtor (PmtInf block).
|
|
822
|
+
*
|
|
823
|
+
* @property {Party} initiatingParty - The party (debtor) for this specific payment information block.
|
|
824
|
+
* @property {AtLeastOne<SEPACreditPaymentInstruction>} payments - An array containing at least one payment instruction for this debtor.
|
|
825
|
+
* @property {ExternalCategoryPurpose} [categoryPurpose] - Optional category purpose code for this payment information block.
|
|
826
|
+
*/
|
|
827
|
+
interface SEPAMultiCreditPaymentInstructionGroup {
|
|
828
|
+
/** The party (debtor) for this specific payment information block. */
|
|
829
|
+
initiatingParty: Party;
|
|
830
|
+
/** An array containing at least one payment instruction for this debtor. */
|
|
831
|
+
payments: AtLeastOne$3<SEPACreditPaymentInstruction>;
|
|
832
|
+
/** Optional category purpose code for this payment information block. */
|
|
833
|
+
categoryPurpose?: ExternalCategoryPurpose;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Configuration for SEPA Multi Credit Payment Initiation.
|
|
837
|
+
*
|
|
838
|
+
* @property {Party} initiatingParty - The top-level party initiating the message (used in GrpHdr).
|
|
839
|
+
* @property {AtLeastOne<SEPAMultiCreditPaymentInstructionGroup>} paymentInstructions - An array containing at least one payment instruction group.
|
|
840
|
+
* @property {string} [messageId] - Optional unique identifier for the message. If not provided, a UUID will be generated.
|
|
841
|
+
* @property {Date} [creationDate] - Optional creation date for the message. If not provided, current date will be used.
|
|
842
|
+
*/
|
|
843
|
+
interface SEPAMultiCreditPaymentInitiationConfig$1 {
|
|
844
|
+
/** The top-level party initiating the message (used in GrpHdr). */
|
|
845
|
+
initiatingParty: Party;
|
|
846
|
+
/** An array containing at least one payment instruction group. */
|
|
847
|
+
paymentInstructions: AtLeastOne$3<SEPAMultiCreditPaymentInstructionGroup>;
|
|
848
|
+
/** Optional unique identifier for the message. If not provided, a UUID will be generated. */
|
|
849
|
+
messageId?: string;
|
|
850
|
+
/** Optional creation date for the message. If not provided, current date will be used. */
|
|
851
|
+
creationDate?: Date;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Represents a SEPA Multi Credit Payment Initiation.
|
|
855
|
+
* This class handles the creation and serialization of SEPA credit transfer messages
|
|
856
|
+
* with multiple payment information blocks (multiple debtors) according to the ISO20022 standard.
|
|
857
|
+
* @class
|
|
858
|
+
* @extends PaymentInitiation
|
|
859
|
+
* @param {SEPAMultiCreditPaymentInitiationConfig} config - The configuration for the SEPA Multi Credit Payment Initiation message.
|
|
860
|
+
* @example
|
|
861
|
+
* ```typescript
|
|
862
|
+
* // Creating a SEPA multi-payment message
|
|
863
|
+
* const payment = new SEPAMultiCreditPaymentInitiation({
|
|
864
|
+
* initiatingParty: { name: 'Company Ltd', id: '12345' },
|
|
865
|
+
* paymentInstructions: [
|
|
866
|
+
* {
|
|
867
|
+
* initiatingParty: debtor1,
|
|
868
|
+
* payments: [payment1, payment2]
|
|
869
|
+
* },
|
|
870
|
+
* {
|
|
871
|
+
* initiatingParty: debtor2,
|
|
872
|
+
* payments: [payment3]
|
|
873
|
+
* }
|
|
874
|
+
* ]
|
|
875
|
+
* });
|
|
876
|
+
* ```
|
|
877
|
+
*/
|
|
878
|
+
declare class SEPAMultiCreditPaymentInitiation extends PaymentInitiation {
|
|
879
|
+
initiatingParty: Party;
|
|
880
|
+
messageId: string;
|
|
881
|
+
creationDate: Date;
|
|
882
|
+
paymentInstructions: AtLeastOne$3<SEPAMultiCreditPaymentInstructionGroup>;
|
|
883
|
+
paymentInformationIdBase: string;
|
|
884
|
+
private formattedPaymentSum;
|
|
885
|
+
private totalTransactionCount;
|
|
886
|
+
/**
|
|
887
|
+
* Creates an instance of SEPAMultiCreditPaymentInitiation.
|
|
888
|
+
* @param {SEPAMultiCreditPaymentInitiationConfig} config - The configuration object for the SEPA multi credit transfer.
|
|
889
|
+
*/
|
|
890
|
+
constructor(config: SEPAMultiCreditPaymentInitiationConfig$1);
|
|
891
|
+
/**
|
|
892
|
+
* Counts the total number of transactions across all payment instruction groups.
|
|
893
|
+
* @private
|
|
894
|
+
* @returns {number} The total count of all transactions.
|
|
895
|
+
*/
|
|
896
|
+
private countAllTransactions;
|
|
897
|
+
/**
|
|
898
|
+
* Calculates the sum of all payment instructions across all groups.
|
|
899
|
+
* @private
|
|
900
|
+
* @returns {string} The total sum formatted as a string with 2 decimal places.
|
|
901
|
+
*/
|
|
902
|
+
private sumAllPayments;
|
|
903
|
+
/**
|
|
904
|
+
* Calculates the sum of payment instructions for a single group.
|
|
905
|
+
* @private
|
|
906
|
+
* @param {AtLeastOne<SEPACreditPaymentInstruction>} payments - Array of payment instructions.
|
|
907
|
+
* @returns {string} The total sum formatted as a string with 2 decimal places.
|
|
908
|
+
* @throws {Error} If payment instructions have different currencies.
|
|
909
|
+
*/
|
|
910
|
+
private sumPaymentInstructions;
|
|
911
|
+
/**
|
|
912
|
+
* Validates the payment initiation data according to SEPA requirements.
|
|
913
|
+
* @private
|
|
914
|
+
* @throws {Error} If messageId exceeds 35 characters.
|
|
915
|
+
* @throws {Error} If any group's payment instructions have different currencies.
|
|
916
|
+
*/
|
|
917
|
+
private validate;
|
|
918
|
+
/**
|
|
919
|
+
* Validates that all payment instructions in a group have the same currency.
|
|
920
|
+
* @private
|
|
921
|
+
* @param {AtLeastOne<SEPACreditPaymentInstruction>} payments - Array of payment instructions.
|
|
922
|
+
* @throws {Error} If payment instructions have different currencies.
|
|
923
|
+
*/
|
|
924
|
+
private validateGroupInstructionsHaveSameCurrency;
|
|
925
|
+
/**
|
|
926
|
+
* Generates payment information for a single SEPA credit transfer instruction.
|
|
927
|
+
* @param {SEPACreditPaymentInstruction} instruction - The payment instruction.
|
|
928
|
+
* @returns {Object} The payment information object formatted according to SEPA specifications.
|
|
929
|
+
*/
|
|
930
|
+
creditTransfer(instruction: SEPACreditPaymentInstruction): {
|
|
931
|
+
Cdtr: any;
|
|
932
|
+
CdtrAcct: {
|
|
933
|
+
Id: {
|
|
934
|
+
IBAN: string;
|
|
935
|
+
};
|
|
936
|
+
Ccy: "EUR";
|
|
937
|
+
};
|
|
938
|
+
RmtInf: {
|
|
939
|
+
Ustrd: string;
|
|
940
|
+
} | undefined;
|
|
941
|
+
CdtrAgt?: {
|
|
942
|
+
FinInstnId: {
|
|
943
|
+
BIC: string;
|
|
944
|
+
ClrSysMmbId?: undefined;
|
|
945
|
+
};
|
|
946
|
+
} | {
|
|
947
|
+
FinInstnId: {
|
|
948
|
+
ClrSysMmbId: {
|
|
949
|
+
ClrSysId: {
|
|
950
|
+
Cd: string;
|
|
951
|
+
};
|
|
952
|
+
MmbId: string;
|
|
953
|
+
};
|
|
954
|
+
BIC?: undefined;
|
|
955
|
+
};
|
|
956
|
+
} | undefined;
|
|
957
|
+
PmtId: {
|
|
958
|
+
InstrId: string;
|
|
959
|
+
EndToEndId: string;
|
|
960
|
+
};
|
|
961
|
+
Amt: {
|
|
962
|
+
InstdAmt: {
|
|
963
|
+
'#': string;
|
|
964
|
+
'@Ccy': "EUR";
|
|
965
|
+
};
|
|
966
|
+
};
|
|
967
|
+
};
|
|
968
|
+
/**
|
|
969
|
+
* Serializes the SEPA multi credit transfer initiation to an XML string.
|
|
970
|
+
* @returns {string} The XML representation of the SEPA multi credit transfer initiation.
|
|
971
|
+
*/
|
|
972
|
+
serialize(): string;
|
|
973
|
+
/**
|
|
974
|
+
* Parses an XML string and creates a SEPAMultiCreditPaymentInitiation instance.
|
|
975
|
+
* Supports multiple PmtInf blocks in the XML document.
|
|
976
|
+
* @param {string} rawXml - The XML string to parse.
|
|
977
|
+
* @returns {SEPAMultiCreditPaymentInitiation} A new instance created from the XML data.
|
|
978
|
+
* @throws {InvalidXmlError} If the XML format is invalid.
|
|
979
|
+
* @throws {InvalidXmlNamespaceError} If the namespace is not pain.001.001.03.
|
|
980
|
+
*/
|
|
981
|
+
static fromXML(rawXml: string): SEPAMultiCreditPaymentInitiation;
|
|
982
|
+
}
|
|
983
|
+
|
|
819
984
|
type AtLeastOne$2<T> = [T, ...T[]];
|
|
820
985
|
/**
|
|
821
986
|
* Configuration for RTP Credit Payment Initiation.
|
|
@@ -1394,6 +1559,53 @@ interface SEPACreditPaymentInitiationConfig {
|
|
|
1394
1559
|
*/
|
|
1395
1560
|
creationDate?: Date;
|
|
1396
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Configuration interface for SEPA Multi Credit Payment Initiation.
|
|
1564
|
+
* @interface SEPAMultiCreditPaymentInitiationConfig
|
|
1565
|
+
* @example
|
|
1566
|
+
* const config: SEPAMultiCreditPaymentInitiationConfig = {
|
|
1567
|
+
* paymentInstructions: [
|
|
1568
|
+
* {
|
|
1569
|
+
* initiatingParty: debtor1,
|
|
1570
|
+
* payments: [
|
|
1571
|
+
* {
|
|
1572
|
+
* type: 'sepa',
|
|
1573
|
+
* direction: 'credit',
|
|
1574
|
+
* amount: 1000, // €10.00 Euros
|
|
1575
|
+
* currency: 'EUR',
|
|
1576
|
+
* creditor: {
|
|
1577
|
+
* name: 'Hans Schneider',
|
|
1578
|
+
* account: {
|
|
1579
|
+
* iban: 'DE1234567890123456',
|
|
1580
|
+
* },
|
|
1581
|
+
* },
|
|
1582
|
+
* remittanceInformation: 'Invoice payment #123',
|
|
1583
|
+
* },
|
|
1584
|
+
* ],
|
|
1585
|
+
* categoryPurpose: 'SALA', // Optional
|
|
1586
|
+
* },
|
|
1587
|
+
* ],
|
|
1588
|
+
* messageId: 'MSGID123', // Optional
|
|
1589
|
+
* creationDate: new Date(), // Optional
|
|
1590
|
+
* };
|
|
1591
|
+
*/
|
|
1592
|
+
interface SEPAMultiCreditPaymentInitiationConfig {
|
|
1593
|
+
/**
|
|
1594
|
+
* An array of payment instruction groups, each with its own debtor.
|
|
1595
|
+
* @type {AtLeastOne<SEPAMultiCreditPaymentInstructionGroup>}
|
|
1596
|
+
*/
|
|
1597
|
+
paymentInstructions: AtLeastOne<SEPAMultiCreditPaymentInstructionGroup>;
|
|
1598
|
+
/**
|
|
1599
|
+
* Optional unique identifier for the message. If not provided, a UUID will be generated.
|
|
1600
|
+
* @type {string}
|
|
1601
|
+
*/
|
|
1602
|
+
messageId?: string;
|
|
1603
|
+
/**
|
|
1604
|
+
* Optional creation date for the message. If not provided, current date will be used.
|
|
1605
|
+
* @type {Date}
|
|
1606
|
+
*/
|
|
1607
|
+
creationDate?: Date;
|
|
1608
|
+
}
|
|
1397
1609
|
/**
|
|
1398
1610
|
* Configuration interface for RTP Credit Payment Initiation.
|
|
1399
1611
|
* @interface RTPCreditPaymentInitiationConfig
|
|
@@ -1575,6 +1787,38 @@ declare class ISO20022 {
|
|
|
1575
1787
|
* @returns {SEPACreditPaymentInitiation} A new SEPA Credit Payment Initiation object.
|
|
1576
1788
|
*/
|
|
1577
1789
|
createSEPACreditPaymentInitiation(config: SEPACreditPaymentInitiationConfig): SEPACreditPaymentInitiation;
|
|
1790
|
+
/**
|
|
1791
|
+
* Creates a SEPA Multi Credit Payment Initiation message with multiple payment information blocks.
|
|
1792
|
+
* @param {SEPAMultiCreditPaymentInitiationConfig} config - Configuration containing payment instruction groups and optional parameters.
|
|
1793
|
+
* @example
|
|
1794
|
+
* const payment = iso20022.createSEPAMultiCreditPaymentInitiation({
|
|
1795
|
+
* paymentInstructions: [
|
|
1796
|
+
* {
|
|
1797
|
+
* initiatingParty: debtor1,
|
|
1798
|
+
* payments: [
|
|
1799
|
+
* {
|
|
1800
|
+
* type: 'sepa',
|
|
1801
|
+
* direction: 'credit',
|
|
1802
|
+
* amount: 1000, // €10.00 Euros
|
|
1803
|
+
* currency: 'EUR',
|
|
1804
|
+
* creditor: {
|
|
1805
|
+
* name: 'Hans Schneider',
|
|
1806
|
+
* account: {
|
|
1807
|
+
* iban: 'DE1234567890123456',
|
|
1808
|
+
* },
|
|
1809
|
+
* },
|
|
1810
|
+
* remittanceInformation: 'Invoice payment #123',
|
|
1811
|
+
* },
|
|
1812
|
+
* ],
|
|
1813
|
+
* categoryPurpose: 'SALA', // Optional
|
|
1814
|
+
* },
|
|
1815
|
+
* ],
|
|
1816
|
+
* messageId: 'SEPA-MULTI-MSG-001', // Optional
|
|
1817
|
+
* creationDate: new Date('2025-03-01'), // Optional
|
|
1818
|
+
* });
|
|
1819
|
+
* @returns {SEPAMultiCreditPaymentInitiation} A new SEPA Multi Credit Payment Initiation object.
|
|
1820
|
+
*/
|
|
1821
|
+
createSEPAMultiCreditPaymentInitiation(config: SEPAMultiCreditPaymentInitiationConfig): SEPAMultiCreditPaymentInitiation;
|
|
1578
1822
|
/**
|
|
1579
1823
|
* Creates a RTP Credit Payment Initiation message.
|
|
1580
1824
|
* @param {RTPCreditPaymentInitiationConfig} config - Configuration containing payment instructions and optional parameters.
|
|
@@ -1893,4 +2137,4 @@ declare class InvalidXmlNamespaceError extends Iso20022JsError {
|
|
|
1893
2137
|
constructor(message: string);
|
|
1894
2138
|
}
|
|
1895
2139
|
|
|
1896
|
-
export { type ABAAgent, ACHCreditPaymentInitiation, type ACHCreditPaymentInitiationConfig$1 as ACHCreditPaymentInitiationConfig, type ACHCreditPaymentInstruction, type ACHLocalInstrument, ACHLocalInstrumentCode, ACHLocalInstrumentCodeDescriptionMap, type Account, type Agent, type BICAgent, type Balance, type BalanceType, BalanceTypeCode, BalanceTypeCodeDescriptionMap, type BaseAccount, type BaseStatusInformation as BaseStatus, CashManagementEndOfDayReport, type Entry, type GroupStatusInformation as GroupStatus, type IBANAccount, ISO20022, InvalidXmlError, InvalidXmlNamespaceError, Iso20022JsError, type OriginalGroupInformation, type Party, type PaymentStatusInformation as PaymentStatus, PaymentStatusCode, PaymentStatusReport, RTPCreditPaymentInitiation, type RTPCreditPaymentInitiationConfig$1 as RTPCreditPaymentInitiationConfig, type RTPCreditPaymentInstruction, SEPACreditPaymentInitiation, type SEPACreditPaymentInitiationConfig$1 as SEPACreditPaymentInitiationConfig, type SEPACreditPaymentInstruction, SWIFTCreditPaymentInitiation, type SWIFTCreditPaymentInitiationConfig$1 as SWIFTCreditPaymentInitiationConfig, type SWIFTCreditPaymentInstruction, type Statement, type PaymentStatus as Status, type StatusInformation, type StatusType, type StructuredAddress, type Transaction, type TransactionStatusInformation as TransactionStatus };
|
|
2140
|
+
export { type ABAAgent, ACHCreditPaymentInitiation, type ACHCreditPaymentInitiationConfig$1 as ACHCreditPaymentInitiationConfig, type ACHCreditPaymentInstruction, type ACHLocalInstrument, ACHLocalInstrumentCode, ACHLocalInstrumentCodeDescriptionMap, type Account, type Agent, type BICAgent, type Balance, type BalanceType, BalanceTypeCode, BalanceTypeCodeDescriptionMap, type BaseAccount, type BaseStatusInformation as BaseStatus, CashManagementEndOfDayReport, type Entry, type GroupStatusInformation as GroupStatus, type IBANAccount, ISO20022, InvalidXmlError, InvalidXmlNamespaceError, Iso20022JsError, type OriginalGroupInformation, type Party, type PaymentStatusInformation as PaymentStatus, PaymentStatusCode, PaymentStatusReport, RTPCreditPaymentInitiation, type RTPCreditPaymentInitiationConfig$1 as RTPCreditPaymentInitiationConfig, type RTPCreditPaymentInstruction, SEPACreditPaymentInitiation, type SEPACreditPaymentInitiationConfig$1 as SEPACreditPaymentInitiationConfig, type SEPACreditPaymentInstruction, SEPAMultiCreditPaymentInitiation, type SEPAMultiCreditPaymentInitiationConfig$1 as SEPAMultiCreditPaymentInitiationConfig, type SEPAMultiCreditPaymentInstructionGroup, SWIFTCreditPaymentInitiation, type SWIFTCreditPaymentInitiationConfig$1 as SWIFTCreditPaymentInitiationConfig, type SWIFTCreditPaymentInstruction, type Statement, type PaymentStatus as Status, type StatusInformation, type StatusType, type StructuredAddress, type Transaction, type TransactionStatusInformation as TransactionStatus };
|