@davidvornholt/lib-fints 0.0.0-stage → 1.5.401
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/FORK.md +40 -0
- package/LICENSE +504 -0
- package/README.md +423 -2
- package/biome.json +35 -0
- package/dist/accountBalance.js +1 -0
- package/dist/accountDescriptor.js +65 -0
- package/dist/bankAccount.js +42 -0
- package/dist/bankAnswer.js +1 -0
- package/dist/bankTransaction.js +1 -0
- package/dist/bankingInformation.js +1 -0
- package/dist/bpd.js +1 -0
- package/dist/camtParser.js +443 -0
- package/dist/client.js +740 -0
- package/dist/codes.js +87 -0
- package/dist/config.js +241 -0
- package/dist/creditCardStatement.js +1 -0
- package/dist/dataElements/AlphaNumeric.js +24 -0
- package/dist/dataElements/Amount.js +6 -0
- package/dist/dataElements/Binary.js +37 -0
- package/dist/dataElements/Country.js +6 -0
- package/dist/dataElements/Currency.js +6 -0
- package/dist/dataElements/Dat.js +18 -0
- package/dist/dataElements/DataElement.js +38 -0
- package/dist/dataElements/Digits.js +23 -0
- package/dist/dataElements/Float.js +21 -0
- package/dist/dataElements/Identification.js +6 -0
- package/dist/dataElements/Numeric.js +26 -0
- package/dist/dataElements/Text.js +21 -0
- package/dist/dataElements/Time.js +18 -0
- package/dist/dataElements/YesNo.js +18 -0
- package/dist/dataGroups/Account.js +12 -0
- package/dist/dataGroups/Balance.js +15 -0
- package/dist/dataGroups/BankIdentification.js +8 -0
- package/dist/dataGroups/DataGroup.js +61 -0
- package/dist/dataGroups/InternationalAccount.js +15 -0
- package/dist/dataGroups/Money.js +8 -0
- package/dist/dataGroups/RefMessage.js +8 -0
- package/dist/dataGroups/SepaAccount.js +17 -0
- package/dist/dataGroups/TimeStamp.js +8 -0
- package/dist/decoder.js +100 -0
- package/dist/dialog.js +469 -0
- package/dist/electronicStatement.js +1 -0
- package/dist/encoder.js +59 -0
- package/dist/format.js +6 -0
- package/dist/httpClient.js +84 -0
- package/dist/index.js +22 -0
- package/dist/interactions/balanceInteraction.js +46 -0
- package/dist/interactions/creditTransferInteraction.js +499 -0
- package/dist/interactions/creditcardStatementInteraction.js +115 -0
- package/dist/interactions/creditcardStatementInteractionHKKKU.js +141 -0
- package/dist/interactions/customerInteraction.js +121 -0
- package/dist/interactions/electronicStatementInteraction.js +89 -0
- package/dist/interactions/endDialogInteraction.js +17 -0
- package/dist/interactions/initDialogInteraction.js +232 -0
- package/dist/interactions/portfolioInteraction.js +65 -0
- package/dist/interactions/sepaAccountInteraction.js +51 -0
- package/dist/interactions/statementInteractionCAMT.js +71 -0
- package/dist/interactions/statementInteractionMT940.js +50 -0
- package/dist/interactions/tanMediaInteraction.js +37 -0
- package/dist/interactions/transferOutcome.js +364 -0
- package/dist/interactions/vopCheck.js +346 -0
- package/dist/message.js +239 -0
- package/dist/mt535parser.js +151 -0
- package/dist/mt940parser.js +313 -0
- package/dist/pain001Builder.js +308 -0
- package/dist/pain002Parser.js +140 -0
- package/dist/parser.js +28 -0
- package/dist/partedSegment.js +11 -0
- package/dist/segment.js +81 -0
- package/dist/segmentDefinition.js +20 -0
- package/dist/segmentHeader.js +13 -0
- package/dist/segments/DIKKU.js +23 -0
- package/dist/segments/DKKKU.js +25 -0
- package/dist/segments/HIBPA.js +26 -0
- package/dist/segments/HICAZ.js +22 -0
- package/dist/segments/HICAZS.js +19 -0
- package/dist/segments/HICCSS.js +23 -0
- package/dist/segments/HIEKA.js +45 -0
- package/dist/segments/HIEKAS.js +18 -0
- package/dist/segments/HIKAZ.js +16 -0
- package/dist/segments/HIKAZS.js +17 -0
- package/dist/segments/HIKIM.js +14 -0
- package/dist/segments/HIKKU.js +23 -0
- package/dist/segments/HIKKUS.js +18 -0
- package/dist/segments/HIKOM.js +26 -0
- package/dist/segments/HIPINS.js +22 -0
- package/dist/segments/HIRMG.js +23 -0
- package/dist/segments/HIRMS.js +23 -0
- package/dist/segments/HISAL.js +34 -0
- package/dist/segments/HISPA.js +14 -0
- package/dist/segments/HISPAS.js +22 -0
- package/dist/segments/HISYN.js +19 -0
- package/dist/segments/HITAB.js +40 -0
- package/dist/segments/HITAN.js +25 -0
- package/dist/segments/HITANS.js +53 -0
- package/dist/segments/HIUPA.js +21 -0
- package/dist/segments/HIUPD.js +41 -0
- package/dist/segments/HIVPAS.js +21 -0
- package/dist/segments/HIVPP.js +35 -0
- package/dist/segments/HIVPPS.js +23 -0
- package/dist/segments/HIWPD.js +15 -0
- package/dist/segments/HKCAZ.js +28 -0
- package/dist/segments/HKCCS.js +30 -0
- package/dist/segments/HKEKA.js +43 -0
- package/dist/segments/HKEND.js +14 -0
- package/dist/segments/HKIDN.js +21 -0
- package/dist/segments/HKKAZ.js +27 -0
- package/dist/segments/HKKKU.js +26 -0
- package/dist/segments/HKSAL.js +24 -0
- package/dist/segments/HKSPA.js +21 -0
- package/dist/segments/HKSYN.js +14 -0
- package/dist/segments/HKTAB.js +15 -0
- package/dist/segments/HKTAN.js +38 -0
- package/dist/segments/HKVPA.js +19 -0
- package/dist/segments/HKVPP.js +33 -0
- package/dist/segments/HKVVB.js +21 -0
- package/dist/segments/HKWPD.js +23 -0
- package/dist/segments/HNHBK.js +23 -0
- package/dist/segments/HNHBS.js +14 -0
- package/dist/segments/HNSHA.js +20 -0
- package/dist/segments/HNSHK.js +54 -0
- package/dist/segments/HNVSD.js +14 -0
- package/dist/segments/HNVSK.js +52 -0
- package/dist/segments/businessTransactionParameter.js +20 -0
- package/dist/segments/registry.js +120 -0
- package/dist/statement.js +1 -0
- package/dist/tanMethod.js +1 -0
- package/dist/tests/HIBPA.test.js +26 -0
- package/dist/tests/HICAZS.test.js +18 -0
- package/dist/tests/HICCSS.test.js +16 -0
- package/dist/tests/HIPINS.test.js +14 -0
- package/dist/tests/HIRMG.test.js +24 -0
- package/dist/tests/HITAB.test.js +26 -0
- package/dist/tests/HITANS.test.js +19 -0
- package/dist/tests/HIUPA.test.js +11 -0
- package/dist/tests/HIUPD.test.js +11 -0
- package/dist/tests/HIVPAS.test.js +16 -0
- package/dist/tests/HIVPP.test.js +58 -0
- package/dist/tests/HIVPPS.test.js +29 -0
- package/dist/tests/HIWPD.test.js +25 -0
- package/dist/tests/HKCAZ.test.js +43 -0
- package/dist/tests/HKCCS.test.js +52 -0
- package/dist/tests/HKEKA.test.js +198 -0
- package/dist/tests/HKIDN.test.js +22 -0
- package/dist/tests/HKKKU.test.js +207 -0
- package/dist/tests/HKSAL.test.js +45 -0
- package/dist/tests/HKTAN.test.js +22 -0
- package/dist/tests/HKVPA.test.js +21 -0
- package/dist/tests/HKVPP.test.js +40 -0
- package/dist/tests/HKWPD.test.js +38 -0
- package/dist/tests/HNSHK.test.js +11 -0
- package/dist/tests/HNVSK.test.js +11 -0
- package/dist/tests/accountDescriptor.test.js +99 -0
- package/dist/tests/accountReference.test.js +126 -0
- package/dist/tests/bankReplyChecks.test.js +37 -0
- package/dist/tests/camtParser.test.js +988 -0
- package/dist/tests/client.test.js +690 -0
- package/dist/tests/credentialRedaction.test.js +59 -0
- package/dist/tests/creditTransfer.test.js +1475 -0
- package/dist/tests/creditTransferBank.js +205 -0
- package/dist/tests/creditTransferSafety.test.js +319 -0
- package/dist/tests/datatypes.test.js +8 -0
- package/dist/tests/dialog.test.js +435 -0
- package/dist/tests/httpClientErrorLog.test.js +27 -0
- package/dist/tests/interactionAccountDescriptor.test.js +153 -0
- package/dist/tests/message.test.js +98 -0
- package/dist/tests/mt535parser.test.js +245 -0
- package/dist/tests/mt940parser.test.js +82 -0
- package/dist/tests/pain001Builder.test.js +291 -0
- package/dist/tests/pain002Parser.test.js +152 -0
- package/dist/tests/parser.test.js +25 -0
- package/dist/tests/partedDialog.test.js +203 -0
- package/dist/tests/partedResponse.test.js +181 -0
- package/dist/tests/statementParseFailure.test.js +18 -0
- package/dist/tests/tanMedia.test.js +125 -0
- package/dist/types/accountBalance.d.ts +9 -0
- package/dist/types/accountBalance.d.ts.map +1 -0
- package/dist/types/accountDescriptor.d.ts +49 -0
- package/dist/types/accountDescriptor.d.ts.map +1 -0
- package/dist/types/bankAccount.d.ts +39 -0
- package/dist/types/bankAccount.d.ts.map +1 -0
- package/dist/types/bankAnswer.d.ts +6 -0
- package/dist/types/bankAnswer.d.ts.map +1 -0
- package/dist/types/bankTransaction.d.ts +22 -0
- package/dist/types/bankTransaction.d.ts.map +1 -0
- package/dist/types/bankingInformation.d.ts +20 -0
- package/dist/types/bankingInformation.d.ts.map +1 -0
- package/dist/types/bpd.d.ts +17 -0
- package/dist/types/bpd.d.ts.map +1 -0
- package/dist/types/camtParser.d.ts +31 -0
- package/dist/types/camtParser.d.ts.map +1 -0
- package/dist/types/client.d.ts +302 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/codes.d.ts +75 -0
- package/dist/types/codes.d.ts.map +1 -0
- package/dist/types/config.d.ts +127 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/creditCardStatement.d.ts +16 -0
- package/dist/types/creditCardStatement.d.ts.map +1 -0
- package/dist/types/dataElements/AlphaNumeric.d.ts +8 -0
- package/dist/types/dataElements/AlphaNumeric.d.ts.map +1 -0
- package/dist/types/dataElements/Amount.d.ts +5 -0
- package/dist/types/dataElements/Amount.d.ts.map +1 -0
- package/dist/types/dataElements/Binary.d.ts +15 -0
- package/dist/types/dataElements/Binary.d.ts.map +1 -0
- package/dist/types/dataElements/Country.d.ts +5 -0
- package/dist/types/dataElements/Country.d.ts.map +1 -0
- package/dist/types/dataElements/Currency.d.ts +5 -0
- package/dist/types/dataElements/Currency.d.ts.map +1 -0
- package/dist/types/dataElements/Dat.d.ts +8 -0
- package/dist/types/dataElements/Dat.d.ts.map +1 -0
- package/dist/types/dataElements/DataElement.d.ts +14 -0
- package/dist/types/dataElements/DataElement.d.ts.map +1 -0
- package/dist/types/dataElements/Digits.d.ts +8 -0
- package/dist/types/dataElements/Digits.d.ts.map +1 -0
- package/dist/types/dataElements/Float.d.ts +8 -0
- package/dist/types/dataElements/Float.d.ts.map +1 -0
- package/dist/types/dataElements/Identification.d.ts +5 -0
- package/dist/types/dataElements/Identification.d.ts.map +1 -0
- package/dist/types/dataElements/Numeric.d.ts +9 -0
- package/dist/types/dataElements/Numeric.d.ts.map +1 -0
- package/dist/types/dataElements/Text.d.ts +8 -0
- package/dist/types/dataElements/Text.d.ts.map +1 -0
- package/dist/types/dataElements/Time.d.ts +8 -0
- package/dist/types/dataElements/Time.d.ts.map +1 -0
- package/dist/types/dataElements/YesNo.d.ts +7 -0
- package/dist/types/dataElements/YesNo.d.ts.map +1 -0
- package/dist/types/dataGroups/Account.d.ts +14 -0
- package/dist/types/dataGroups/Account.d.ts.map +1 -0
- package/dist/types/dataGroups/Balance.d.ts +12 -0
- package/dist/types/dataGroups/Balance.d.ts.map +1 -0
- package/dist/types/dataGroups/BankIdentification.d.ts +5 -0
- package/dist/types/dataGroups/BankIdentification.d.ts.map +1 -0
- package/dist/types/dataGroups/DataGroup.d.ts +10 -0
- package/dist/types/dataGroups/DataGroup.d.ts.map +1 -0
- package/dist/types/dataGroups/InternationalAccount.d.ts +13 -0
- package/dist/types/dataGroups/InternationalAccount.d.ts.map +1 -0
- package/dist/types/dataGroups/Money.d.ts +9 -0
- package/dist/types/dataGroups/Money.d.ts.map +1 -0
- package/dist/types/dataGroups/RefMessage.d.ts +9 -0
- package/dist/types/dataGroups/RefMessage.d.ts.map +1 -0
- package/dist/types/dataGroups/SepaAccount.d.ts +11 -0
- package/dist/types/dataGroups/SepaAccount.d.ts.map +1 -0
- package/dist/types/dataGroups/TimeStamp.d.ts +9 -0
- package/dist/types/dataGroups/TimeStamp.d.ts.map +1 -0
- package/dist/types/decoder.d.ts +4 -0
- package/dist/types/decoder.d.ts.map +1 -0
- package/dist/types/dialog.d.ts +106 -0
- package/dist/types/dialog.d.ts.map +1 -0
- package/dist/types/electronicStatement.d.ts +40 -0
- package/dist/types/electronicStatement.d.ts.map +1 -0
- package/dist/types/encoder.d.ts +3 -0
- package/dist/types/encoder.d.ts.map +1 -0
- package/dist/types/format.d.ts +3 -0
- package/dist/types/format.d.ts.map +1 -0
- package/dist/types/httpClient.d.ts +14 -0
- package/dist/types/httpClient.d.ts.map +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interactions/balanceInteraction.d.ts +16 -0
- package/dist/types/interactions/balanceInteraction.d.ts.map +1 -0
- package/dist/types/interactions/creditTransferInteraction.d.ts +228 -0
- package/dist/types/interactions/creditTransferInteraction.d.ts.map +1 -0
- package/dist/types/interactions/creditcardStatementInteraction.d.ts +19 -0
- package/dist/types/interactions/creditcardStatementInteraction.d.ts.map +1 -0
- package/dist/types/interactions/creditcardStatementInteractionHKKKU.d.ts +23 -0
- package/dist/types/interactions/creditcardStatementInteractionHKKKU.d.ts.map +1 -0
- package/dist/types/interactions/customerInteraction.d.ts +84 -0
- package/dist/types/interactions/customerInteraction.d.ts.map +1 -0
- package/dist/types/interactions/electronicStatementInteraction.d.ts +34 -0
- package/dist/types/interactions/electronicStatementInteraction.d.ts.map +1 -0
- package/dist/types/interactions/endDialogInteraction.d.ts +13 -0
- package/dist/types/interactions/endDialogInteraction.d.ts.map +1 -0
- package/dist/types/interactions/initDialogInteraction.d.ts +23 -0
- package/dist/types/interactions/initDialogInteraction.d.ts.map +1 -0
- package/dist/types/interactions/portfolioInteraction.d.ts +40 -0
- package/dist/types/interactions/portfolioInteraction.d.ts.map +1 -0
- package/dist/types/interactions/sepaAccountInteraction.d.ts +18 -0
- package/dist/types/interactions/sepaAccountInteraction.d.ts.map +1 -0
- package/dist/types/interactions/statementInteractionCAMT.d.ts +14 -0
- package/dist/types/interactions/statementInteractionCAMT.d.ts.map +1 -0
- package/dist/types/interactions/statementInteractionMT940.d.ts +14 -0
- package/dist/types/interactions/statementInteractionMT940.d.ts.map +1 -0
- package/dist/types/interactions/tanMediaInteraction.d.ts +13 -0
- package/dist/types/interactions/tanMediaInteraction.d.ts.map +1 -0
- package/dist/types/interactions/transferOutcome.d.ts +129 -0
- package/dist/types/interactions/transferOutcome.d.ts.map +1 -0
- package/dist/types/interactions/vopCheck.d.ts +107 -0
- package/dist/types/interactions/vopCheck.d.ts.map +1 -0
- package/dist/types/message.d.ts +30 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/mt535parser.d.ts +23 -0
- package/dist/types/mt535parser.d.ts.map +1 -0
- package/dist/types/mt940parser.d.ts +46 -0
- package/dist/types/mt940parser.d.ts.map +1 -0
- package/dist/types/pain001Builder.d.ts +96 -0
- package/dist/types/pain001Builder.d.ts.map +1 -0
- package/dist/types/pain002Parser.d.ts +77 -0
- package/dist/types/pain002Parser.d.ts.map +1 -0
- package/dist/types/parser.d.ts +2 -0
- package/dist/types/parser.d.ts.map +1 -0
- package/dist/types/partedSegment.d.ts +15 -0
- package/dist/types/partedSegment.d.ts.map +1 -0
- package/dist/types/segment.d.ts +11 -0
- package/dist/types/segment.d.ts.map +1 -0
- package/dist/types/segmentDefinition.d.ts +13 -0
- package/dist/types/segmentDefinition.d.ts.map +1 -0
- package/dist/types/segmentHeader.d.ts +11 -0
- package/dist/types/segmentHeader.d.ts.map +1 -0
- package/dist/types/segments/DIKKU.d.ts +20 -0
- package/dist/types/segments/DIKKU.d.ts.map +1 -0
- package/dist/types/segments/DKKKU.d.ts +24 -0
- package/dist/types/segments/DKKKU.d.ts.map +1 -0
- package/dist/types/segments/HIBPA.d.ts +28 -0
- package/dist/types/segments/HIBPA.d.ts.map +1 -0
- package/dist/types/segments/HICAZ.d.ts +22 -0
- package/dist/types/segments/HICAZ.d.ts.map +1 -0
- package/dist/types/segments/HICAZS.d.ts +17 -0
- package/dist/types/segments/HICAZS.d.ts.map +1 -0
- package/dist/types/segments/HICCSS.d.ts +23 -0
- package/dist/types/segments/HICCSS.d.ts.map +1 -0
- package/dist/types/segments/HIEKA.d.ts +52 -0
- package/dist/types/segments/HIEKA.d.ts.map +1 -0
- package/dist/types/segments/HIEKAS.d.ts +21 -0
- package/dist/types/segments/HIEKAS.d.ts.map +1 -0
- package/dist/types/segments/HIKAZ.d.ts +17 -0
- package/dist/types/segments/HIKAZ.d.ts.map +1 -0
- package/dist/types/segments/HIKAZS.d.ts +16 -0
- package/dist/types/segments/HIKAZS.d.ts.map +1 -0
- package/dist/types/segments/HIKIM.d.ts +18 -0
- package/dist/types/segments/HIKIM.d.ts.map +1 -0
- package/dist/types/segments/HIKKU.d.ts +25 -0
- package/dist/types/segments/HIKKU.d.ts.map +1 -0
- package/dist/types/segments/HIKKUS.d.ts +21 -0
- package/dist/types/segments/HIKKUS.d.ts.map +1 -0
- package/dist/types/segments/HIKOM.d.ts +28 -0
- package/dist/types/segments/HIKOM.d.ts.map +1 -0
- package/dist/types/segments/HIPINS.d.ts +23 -0
- package/dist/types/segments/HIPINS.d.ts.map +1 -0
- package/dist/types/segments/HIRMG.d.ts +23 -0
- package/dist/types/segments/HIRMG.d.ts.map +1 -0
- package/dist/types/segments/HIRMS.d.ts +18 -0
- package/dist/types/segments/HIRMS.d.ts.map +1 -0
- package/dist/types/segments/HISAL.d.ts +33 -0
- package/dist/types/segments/HISAL.d.ts.map +1 -0
- package/dist/types/segments/HISPA.d.ts +17 -0
- package/dist/types/segments/HISPA.d.ts.map +1 -0
- package/dist/types/segments/HISPAS.d.ts +20 -0
- package/dist/types/segments/HISPAS.d.ts.map +1 -0
- package/dist/types/segments/HISYN.d.ts +20 -0
- package/dist/types/segments/HISYN.d.ts.map +1 -0
- package/dist/types/segments/HITAB.d.ts +40 -0
- package/dist/types/segments/HITAB.d.ts.map +1 -0
- package/dist/types/segments/HITAN.d.ts +26 -0
- package/dist/types/segments/HITAN.d.ts.map +1 -0
- package/dist/types/segments/HITANS.d.ts +46 -0
- package/dist/types/segments/HITANS.d.ts.map +1 -0
- package/dist/types/segments/HIUPA.d.ts +22 -0
- package/dist/types/segments/HIUPA.d.ts.map +1 -0
- package/dist/types/segments/HIUPD.d.ts +43 -0
- package/dist/types/segments/HIUPD.d.ts.map +1 -0
- package/dist/types/segments/HIVPAS.d.ts +21 -0
- package/dist/types/segments/HIVPAS.d.ts.map +1 -0
- package/dist/types/segments/HIVPP.d.ts +49 -0
- package/dist/types/segments/HIVPP.d.ts.map +1 -0
- package/dist/types/segments/HIVPPS.d.ts +27 -0
- package/dist/types/segments/HIVPPS.d.ts.map +1 -0
- package/dist/types/segments/HIWPD.d.ts +22 -0
- package/dist/types/segments/HIWPD.d.ts.map +1 -0
- package/dist/types/segments/HKCAZ.d.ts +27 -0
- package/dist/types/segments/HKCAZ.d.ts.map +1 -0
- package/dist/types/segments/HKCCS.d.ts +32 -0
- package/dist/types/segments/HKCCS.d.ts.map +1 -0
- package/dist/types/segments/HKEKA.d.ts +54 -0
- package/dist/types/segments/HKEKA.d.ts.map +1 -0
- package/dist/types/segments/HKEND.d.ts +17 -0
- package/dist/types/segments/HKEND.d.ts.map +1 -0
- package/dist/types/segments/HKIDN.d.ts +23 -0
- package/dist/types/segments/HKIDN.d.ts.map +1 -0
- package/dist/types/segments/HKKAZ.d.ts +26 -0
- package/dist/types/segments/HKKAZ.d.ts.map +1 -0
- package/dist/types/segments/HKKKU.d.ts +26 -0
- package/dist/types/segments/HKKKU.d.ts.map +1 -0
- package/dist/types/segments/HKSAL.d.ts +23 -0
- package/dist/types/segments/HKSAL.d.ts.map +1 -0
- package/dist/types/segments/HKSPA.d.ts +21 -0
- package/dist/types/segments/HKSPA.d.ts.map +1 -0
- package/dist/types/segments/HKSYN.d.ts +18 -0
- package/dist/types/segments/HKSYN.d.ts.map +1 -0
- package/dist/types/segments/HKTAB.d.ts +20 -0
- package/dist/types/segments/HKTAB.d.ts.map +1 -0
- package/dist/types/segments/HKTAN.d.ts +41 -0
- package/dist/types/segments/HKTAN.d.ts.map +1 -0
- package/dist/types/segments/HKVPA.d.ts +22 -0
- package/dist/types/segments/HKVPA.d.ts.map +1 -0
- package/dist/types/segments/HKVPP.d.ts +37 -0
- package/dist/types/segments/HKVPP.d.ts.map +1 -0
- package/dist/types/segments/HKVVB.d.ts +23 -0
- package/dist/types/segments/HKVVB.d.ts.map +1 -0
- package/dist/types/segments/HKWPD.d.ts +43 -0
- package/dist/types/segments/HKWPD.d.ts.map +1 -0
- package/dist/types/segments/HNHBK.d.ts +24 -0
- package/dist/types/segments/HNHBK.d.ts.map +1 -0
- package/dist/types/segments/HNHBS.d.ts +17 -0
- package/dist/types/segments/HNHBS.d.ts.map +1 -0
- package/dist/types/segments/HNSHA.d.ts +25 -0
- package/dist/types/segments/HNSHA.d.ts.map +1 -0
- package/dist/types/segments/HNSHK.d.ts +67 -0
- package/dist/types/segments/HNSHK.d.ts.map +1 -0
- package/dist/types/segments/HNVSD.d.ts +21 -0
- package/dist/types/segments/HNVSD.d.ts.map +1 -0
- package/dist/types/segments/HNVSK.d.ts +41 -0
- package/dist/types/segments/HNVSK.d.ts.map +1 -0
- package/dist/types/segments/businessTransactionParameter.d.ts +18 -0
- package/dist/types/segments/businessTransactionParameter.d.ts.map +1 -0
- package/dist/types/segments/registry.d.ts +4 -0
- package/dist/types/segments/registry.d.ts.map +1 -0
- package/dist/types/statement.d.ts +39 -0
- package/dist/types/statement.d.ts.map +1 -0
- package/dist/types/tanMethod.d.ts +31 -0
- package/dist/types/tanMethod.d.ts.map +1 -0
- package/dist/types/tests/HIBPA.test.d.ts +2 -0
- package/dist/types/tests/HIBPA.test.d.ts.map +1 -0
- package/dist/types/tests/HICAZS.test.d.ts +2 -0
- package/dist/types/tests/HICAZS.test.d.ts.map +1 -0
- package/dist/types/tests/HICCSS.test.d.ts +2 -0
- package/dist/types/tests/HICCSS.test.d.ts.map +1 -0
- package/dist/types/tests/HIPINS.test.d.ts +2 -0
- package/dist/types/tests/HIPINS.test.d.ts.map +1 -0
- package/dist/types/tests/HIRMG.test.d.ts +2 -0
- package/dist/types/tests/HIRMG.test.d.ts.map +1 -0
- package/dist/types/tests/HITAB.test.d.ts +2 -0
- package/dist/types/tests/HITAB.test.d.ts.map +1 -0
- package/dist/types/tests/HITANS.test.d.ts +2 -0
- package/dist/types/tests/HITANS.test.d.ts.map +1 -0
- package/dist/types/tests/HIUPA.test.d.ts +2 -0
- package/dist/types/tests/HIUPA.test.d.ts.map +1 -0
- package/dist/types/tests/HIUPD.test.d.ts +2 -0
- package/dist/types/tests/HIUPD.test.d.ts.map +1 -0
- package/dist/types/tests/HIVPAS.test.d.ts +2 -0
- package/dist/types/tests/HIVPAS.test.d.ts.map +1 -0
- package/dist/types/tests/HIVPP.test.d.ts +2 -0
- package/dist/types/tests/HIVPP.test.d.ts.map +1 -0
- package/dist/types/tests/HIVPPS.test.d.ts +2 -0
- package/dist/types/tests/HIVPPS.test.d.ts.map +1 -0
- package/dist/types/tests/HIWPD.test.d.ts +2 -0
- package/dist/types/tests/HIWPD.test.d.ts.map +1 -0
- package/dist/types/tests/HKCAZ.test.d.ts +2 -0
- package/dist/types/tests/HKCAZ.test.d.ts.map +1 -0
- package/dist/types/tests/HKCCS.test.d.ts +2 -0
- package/dist/types/tests/HKCCS.test.d.ts.map +1 -0
- package/dist/types/tests/HKEKA.test.d.ts +2 -0
- package/dist/types/tests/HKEKA.test.d.ts.map +1 -0
- package/dist/types/tests/HKIDN.test.d.ts +2 -0
- package/dist/types/tests/HKIDN.test.d.ts.map +1 -0
- package/dist/types/tests/HKKKU.test.d.ts +2 -0
- package/dist/types/tests/HKKKU.test.d.ts.map +1 -0
- package/dist/types/tests/HKSAL.test.d.ts +2 -0
- package/dist/types/tests/HKSAL.test.d.ts.map +1 -0
- package/dist/types/tests/HKTAN.test.d.ts +2 -0
- package/dist/types/tests/HKTAN.test.d.ts.map +1 -0
- package/dist/types/tests/HKVPA.test.d.ts +2 -0
- package/dist/types/tests/HKVPA.test.d.ts.map +1 -0
- package/dist/types/tests/HKVPP.test.d.ts +2 -0
- package/dist/types/tests/HKVPP.test.d.ts.map +1 -0
- package/dist/types/tests/HKWPD.test.d.ts +2 -0
- package/dist/types/tests/HKWPD.test.d.ts.map +1 -0
- package/dist/types/tests/HNSHK.test.d.ts +2 -0
- package/dist/types/tests/HNSHK.test.d.ts.map +1 -0
- package/dist/types/tests/HNVSK.test.d.ts +2 -0
- package/dist/types/tests/HNVSK.test.d.ts.map +1 -0
- package/dist/types/tests/accountDescriptor.test.d.ts +2 -0
- package/dist/types/tests/accountDescriptor.test.d.ts.map +1 -0
- package/dist/types/tests/accountReference.test.d.ts +2 -0
- package/dist/types/tests/accountReference.test.d.ts.map +1 -0
- package/dist/types/tests/bankReplyChecks.test.d.ts +2 -0
- package/dist/types/tests/bankReplyChecks.test.d.ts.map +1 -0
- package/dist/types/tests/camtParser.test.d.ts +2 -0
- package/dist/types/tests/camtParser.test.d.ts.map +1 -0
- package/dist/types/tests/client.test.d.ts +2 -0
- package/dist/types/tests/client.test.d.ts.map +1 -0
- package/dist/types/tests/credentialRedaction.test.d.ts +2 -0
- package/dist/types/tests/credentialRedaction.test.d.ts.map +1 -0
- package/dist/types/tests/creditTransfer.test.d.ts +2 -0
- package/dist/types/tests/creditTransfer.test.d.ts.map +1 -0
- package/dist/types/tests/creditTransferBank.d.ts +63 -0
- package/dist/types/tests/creditTransferBank.d.ts.map +1 -0
- package/dist/types/tests/creditTransferSafety.test.d.ts +2 -0
- package/dist/types/tests/creditTransferSafety.test.d.ts.map +1 -0
- package/dist/types/tests/datatypes.test.d.ts +2 -0
- package/dist/types/tests/datatypes.test.d.ts.map +1 -0
- package/dist/types/tests/dialog.test.d.ts +2 -0
- package/dist/types/tests/dialog.test.d.ts.map +1 -0
- package/dist/types/tests/httpClientErrorLog.test.d.ts +2 -0
- package/dist/types/tests/httpClientErrorLog.test.d.ts.map +1 -0
- package/dist/types/tests/interactionAccountDescriptor.test.d.ts +2 -0
- package/dist/types/tests/interactionAccountDescriptor.test.d.ts.map +1 -0
- package/dist/types/tests/message.test.d.ts +2 -0
- package/dist/types/tests/message.test.d.ts.map +1 -0
- package/dist/types/tests/mt535parser.test.d.ts +2 -0
- package/dist/types/tests/mt535parser.test.d.ts.map +1 -0
- package/dist/types/tests/mt940parser.test.d.ts +2 -0
- package/dist/types/tests/mt940parser.test.d.ts.map +1 -0
- package/dist/types/tests/pain001Builder.test.d.ts +2 -0
- package/dist/types/tests/pain001Builder.test.d.ts.map +1 -0
- package/dist/types/tests/pain002Parser.test.d.ts +2 -0
- package/dist/types/tests/pain002Parser.test.d.ts.map +1 -0
- package/dist/types/tests/parser.test.d.ts +2 -0
- package/dist/types/tests/parser.test.d.ts.map +1 -0
- package/dist/types/tests/partedDialog.test.d.ts +2 -0
- package/dist/types/tests/partedDialog.test.d.ts.map +1 -0
- package/dist/types/tests/partedResponse.test.d.ts +2 -0
- package/dist/types/tests/partedResponse.test.d.ts.map +1 -0
- package/dist/types/tests/statementParseFailure.test.d.ts +2 -0
- package/dist/types/tests/statementParseFailure.test.d.ts.map +1 -0
- package/dist/types/tests/tanMedia.test.d.ts +2 -0
- package/dist/types/tests/tanMedia.test.d.ts.map +1 -0
- package/dist/types/unknownSegment.d.ts +15 -0
- package/dist/types/unknownSegment.d.ts.map +1 -0
- package/dist/types/upd.d.ts +8 -0
- package/dist/types/upd.d.ts.map +1 -0
- package/dist/unknownSegment.js +11 -0
- package/dist/upd.js +1 -0
- package/package.json +59 -5
- package/pnpm-workspace.yaml +8 -0
- package/src/accountBalance.ts +8 -0
- package/src/accountDescriptor.ts +78 -0
- package/src/bankAccount.ts +59 -0
- package/src/bankAnswer.ts +5 -0
- package/src/bankTransaction.ts +25 -0
- package/src/bankingInformation.ts +21 -0
- package/src/bpd.ts +17 -0
- package/src/camtParser.ts +698 -0
- package/src/client.ts +1005 -0
- package/src/codes.ts +86 -0
- package/src/config.ts +338 -0
- package/src/creditCardStatement.ts +26 -0
- package/src/dataElements/AlphaNumeric.ts +35 -0
- package/src/dataElements/Amount.ts +7 -0
- package/src/dataElements/Binary.ts +50 -0
- package/src/dataElements/Country.ts +7 -0
- package/src/dataElements/Currency.ts +7 -0
- package/src/dataElements/Dat.ts +22 -0
- package/src/dataElements/DataElement.ts +41 -0
- package/src/dataElements/Digits.ts +34 -0
- package/src/dataElements/Float.ts +31 -0
- package/src/dataElements/Identification.ts +7 -0
- package/src/dataElements/Numeric.ts +38 -0
- package/src/dataElements/Text.ts +31 -0
- package/src/dataElements/Time.ts +24 -0
- package/src/dataElements/YesNo.ts +23 -0
- package/src/dataGroups/Account.ts +31 -0
- package/src/dataGroups/Balance.ts +30 -0
- package/src/dataGroups/BankIdentification.ts +16 -0
- package/src/dataGroups/DataGroup.ts +76 -0
- package/src/dataGroups/InternationalAccount.ts +32 -0
- package/src/dataGroups/Money.ts +21 -0
- package/src/dataGroups/RefMessage.ts +21 -0
- package/src/dataGroups/SepaAccount.ts +32 -0
- package/src/dataGroups/TimeStamp.ts +21 -0
- package/src/decoder.ts +125 -0
- package/src/dialog.ts +625 -0
- package/src/electronicStatement.ts +51 -0
- package/src/encoder.ts +87 -0
- package/src/format.ts +7 -0
- package/src/httpClient.ts +90 -0
- package/src/index.ts +53 -0
- package/src/interactions/balanceInteraction.ts +65 -0
- package/src/interactions/creditTransferInteraction.ts +667 -0
- package/src/interactions/creditcardStatementInteraction.ts +134 -0
- package/src/interactions/creditcardStatementInteractionHKKKU.ts +163 -0
- package/src/interactions/customerInteraction.ts +191 -0
- package/src/interactions/electronicStatementInteraction.ts +132 -0
- package/src/interactions/endDialogInteraction.ts +28 -0
- package/src/interactions/initDialogInteraction.ts +300 -0
- package/src/interactions/portfolioInteraction.ts +97 -0
- package/src/interactions/sepaAccountInteraction.ts +68 -0
- package/src/interactions/statementInteractionCAMT.ts +87 -0
- package/src/interactions/statementInteractionMT940.ts +60 -0
- package/src/interactions/tanMediaInteraction.ts +54 -0
- package/src/interactions/transferOutcome.ts +513 -0
- package/src/interactions/vopCheck.ts +502 -0
- package/src/message.ts +305 -0
- package/src/mt535parser.ts +199 -0
- package/src/mt940parser.ts +395 -0
- package/src/pain001Builder.ts +446 -0
- package/src/pain002Parser.ts +233 -0
- package/src/parser.ts +31 -0
- package/src/partedSegment.ts +19 -0
- package/src/segment.ts +114 -0
- package/src/segmentDefinition.ts +36 -0
- package/src/segmentHeader.ts +26 -0
- package/src/segments/DIKKU.ts +30 -0
- package/src/segments/DKKKU.ts +35 -0
- package/src/segments/HIBPA.ts +42 -0
- package/src/segments/HICAZ.ts +34 -0
- package/src/segments/HICAZS.ts +33 -0
- package/src/segments/HICCSS.ts +31 -0
- package/src/segments/HIEKA.ts +68 -0
- package/src/segments/HIEKAS.ts +36 -0
- package/src/segments/HIKAZ.ts +23 -0
- package/src/segments/HIKAZS.ts +34 -0
- package/src/segments/HIKIM.ts +21 -0
- package/src/segments/HIKKU.ts +35 -0
- package/src/segments/HIKKUS.ts +36 -0
- package/src/segments/HIKOM.ts +49 -0
- package/src/segments/HIPINS.ts +48 -0
- package/src/segments/HIRMG.ts +41 -0
- package/src/segments/HIRMS.ts +35 -0
- package/src/segments/HISAL.ts +51 -0
- package/src/segments/HISPA.ts +20 -0
- package/src/segments/HISPAS.ts +42 -0
- package/src/segments/HISYN.ts +28 -0
- package/src/segments/HITAB.ts +76 -0
- package/src/segments/HITAN.ts +39 -0
- package/src/segments/HITANS.ts +102 -0
- package/src/segments/HIUPA.ts +32 -0
- package/src/segments/HIUPD.ts +82 -0
- package/src/segments/HIVPAS.ts +29 -0
- package/src/segments/HIVPP.ts +75 -0
- package/src/segments/HIVPPS.ts +47 -0
- package/src/segments/HIWPD.ts +25 -0
- package/src/segments/HKCAZ.ts +42 -0
- package/src/segments/HKCCS.ts +43 -0
- package/src/segments/HKEKA.ts +69 -0
- package/src/segments/HKEND.ts +20 -0
- package/src/segments/HKIDN.ts +31 -0
- package/src/segments/HKKAZ.ts +40 -0
- package/src/segments/HKKKU.ts +41 -0
- package/src/segments/HKSAL.ts +35 -0
- package/src/segments/HKSPA.ts +28 -0
- package/src/segments/HKSYN.ts +21 -0
- package/src/segments/HKTAB.ts +23 -0
- package/src/segments/HKTAN.ts +72 -0
- package/src/segments/HKVPA.ts +26 -0
- package/src/segments/HKVPP.ts +46 -0
- package/src/segments/HKVVB.ts +32 -0
- package/src/segments/HKWPD.ts +52 -0
- package/src/segments/HNHBK.ts +33 -0
- package/src/segments/HNHBS.ts +20 -0
- package/src/segments/HNSHA.ts +38 -0
- package/src/segments/HNSHK.ts +145 -0
- package/src/segments/HNVSD.ts +22 -0
- package/src/segments/HNVSK.ts +110 -0
- package/src/segments/businessTransactionParameter.ts +33 -0
- package/src/segments/registry.ts +125 -0
- package/src/statement.ts +40 -0
- package/src/tanMethod.ts +32 -0
- package/src/tests/HIBPA.test.ts +33 -0
- package/src/tests/HICAZS.test.ts +24 -0
- package/src/tests/HICCSS.test.ts +20 -0
- package/src/tests/HIPINS.test.ts +19 -0
- package/src/tests/HIRMG.test.ts +33 -0
- package/src/tests/HITAB.test.ts +33 -0
- package/src/tests/HITANS.test.ts +27 -0
- package/src/tests/HIUPA.test.ts +13 -0
- package/src/tests/HIUPD.test.ts +13 -0
- package/src/tests/HIVPAS.test.ts +20 -0
- package/src/tests/HIVPP.test.ts +75 -0
- package/src/tests/HIVPPS.test.ts +37 -0
- package/src/tests/HIWPD.test.ts +32 -0
- package/src/tests/HKCAZ.test.ts +56 -0
- package/src/tests/HKCCS.test.ts +64 -0
- package/src/tests/HKEKA.test.ts +252 -0
- package/src/tests/HKIDN.test.ts +26 -0
- package/src/tests/HKKKU.test.ts +248 -0
- package/src/tests/HKSAL.test.ts +52 -0
- package/src/tests/HKTAN.test.ts +26 -0
- package/src/tests/HKVPA.test.ts +25 -0
- package/src/tests/HKVPP.test.ts +54 -0
- package/src/tests/HKWPD.test.ts +47 -0
- package/src/tests/HNSHK.test.ts +14 -0
- package/src/tests/HNVSK.test.ts +14 -0
- package/src/tests/accountDescriptor.test.ts +113 -0
- package/src/tests/accountReference.test.ts +150 -0
- package/src/tests/bankReplyChecks.test.ts +75 -0
- package/src/tests/camtParser.test.ts +1068 -0
- package/src/tests/client.test.ts +826 -0
- package/src/tests/credentialRedaction.test.ts +75 -0
- package/src/tests/creditTransfer.test.ts +2433 -0
- package/src/tests/creditTransferBank.ts +245 -0
- package/src/tests/creditTransferSafety.test.ts +573 -0
- package/src/tests/datatypes.test.ts +9 -0
- package/src/tests/dialog.test.ts +579 -0
- package/src/tests/httpClientErrorLog.test.ts +41 -0
- package/src/tests/interactionAccountDescriptor.test.ts +203 -0
- package/src/tests/message.test.ts +130 -0
- package/src/tests/mt535parser.test.ts +280 -0
- package/src/tests/mt940parser.test.ts +91 -0
- package/src/tests/pain001Builder.test.ts +474 -0
- package/src/tests/pain002Parser.test.ts +191 -0
- package/src/tests/parser.test.ts +34 -0
- package/src/tests/partedDialog.test.ts +309 -0
- package/src/tests/partedResponse.test.ts +234 -0
- package/src/tests/statementParseFailure.test.ts +23 -0
- package/src/tests/tanMedia.test.ts +163 -0
- package/src/unknownSegment.ts +19 -0
- package/src/upd.ts +8 -0
- package/tsconfig.json +103 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { internationalAccount, nationalAccount } from '../accountDescriptor.js';
|
|
2
|
+
import { describeAccount } from '../bankAccount.js';
|
|
3
|
+
import { CreditDebit } from '../codes.js';
|
|
4
|
+
import { HISAL } from '../segments/HISAL.js';
|
|
5
|
+
import { HKSAL } from '../segments/HKSAL.js';
|
|
6
|
+
import { CustomerOrderInteraction } from './customerInteraction.js';
|
|
7
|
+
export class BalanceInteraction extends CustomerOrderInteraction {
|
|
8
|
+
account;
|
|
9
|
+
constructor(account) {
|
|
10
|
+
super(HKSAL.Id, HISAL.Id);
|
|
11
|
+
this.account = account;
|
|
12
|
+
}
|
|
13
|
+
createSegments(init) {
|
|
14
|
+
const bankAccount = init.getBankAccount(this.account);
|
|
15
|
+
if (!init.isAccountTransactionSupported(this.account, this.segId)) {
|
|
16
|
+
throw Error(`Account ${describeAccount(this.account)} does not support business transaction '${this.segId}'`);
|
|
17
|
+
}
|
|
18
|
+
const version = init.getMaxSupportedTransactionVersion(HKSAL.Id);
|
|
19
|
+
if (!version) {
|
|
20
|
+
throw Error(`There is no supported version for business transaction '${HKSAL.Id}`);
|
|
21
|
+
}
|
|
22
|
+
const account = version <= 6 ? nationalAccount(bankAccount) : internationalAccount(init, bankAccount);
|
|
23
|
+
const hksal = {
|
|
24
|
+
header: { segId: HKSAL.Id, segNr: 0, version: version },
|
|
25
|
+
account: account,
|
|
26
|
+
allAccounts: false,
|
|
27
|
+
};
|
|
28
|
+
return [hksal];
|
|
29
|
+
}
|
|
30
|
+
handleResponse(response, clientResponse) {
|
|
31
|
+
const hisal = response.findSegment(HISAL.Id);
|
|
32
|
+
if (hisal) {
|
|
33
|
+
clientResponse.balance = {
|
|
34
|
+
date: hisal.balance.date,
|
|
35
|
+
currency: hisal.currency,
|
|
36
|
+
balance: balanceToValue(hisal.balance),
|
|
37
|
+
notedBalance: hisal.notedBalance ? balanceToValue(hisal.notedBalance) : undefined,
|
|
38
|
+
creditLimit: hisal.creditLimit?.value,
|
|
39
|
+
availableAmount: hisal.availableAmount?.value,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function balanceToValue(balance) {
|
|
45
|
+
return balance.creditDebit === CreditDebit.Credit ? balance.amount.value : -balance.amount.value;
|
|
46
|
+
}
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
// Added to lib-fints 1.5.4 for @davidvornholt/lib-fints, last on 2026-11-18. FORK.md lists the changes.
|
|
2
|
+
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import { HIVPP } from '../segments/HIVPP.js';
|
|
4
|
+
import { HKCCS } from '../segments/HKCCS.js';
|
|
5
|
+
import { HKVPA } from '../segments/HKVPA.js';
|
|
6
|
+
import { HKVPP } from '../segments/HKVPP.js';
|
|
7
|
+
import { HNHBK } from '../segments/HNHBK.js';
|
|
8
|
+
import { CustomerOrderInteraction } from './customerInteraction.js';
|
|
9
|
+
import { TransferEvidence } from './transferOutcome.js';
|
|
10
|
+
import { VopCheck } from './vopCheck.js';
|
|
11
|
+
export { extractVopResult } from './vopCheck.js';
|
|
12
|
+
/** The return codes about a Verification of Payee: 3090 check the result, 3091 no HKVPA
|
|
13
|
+
* needed, 3093 the check is still running */
|
|
14
|
+
const VOP_CODES = [3090, 3091, 3093];
|
|
15
|
+
const NO_VOP_ID = 'The bank sent a Verification of Payee result without a VoP ID.';
|
|
16
|
+
const UNANNOUNCED_CHECK = 'The bank reported a Verification of Payee its parameters do not announce for HKCCS; synchronize to update the bank parameters.';
|
|
17
|
+
/**
|
|
18
|
+
* The state of one credit transfer across the messages of its dialog: the order, built
|
|
19
|
+
* when it is created (to check the input before anything is sent) and built again from
|
|
20
|
+
* the banking information as the dialog initialisation left it, right before it is first
|
|
21
|
+
* sent; and what the bank has said about it so far.
|
|
22
|
+
*/
|
|
23
|
+
export class CreditTransferOrder {
|
|
24
|
+
build;
|
|
25
|
+
/** The opaque reference of this transfer for the caller (TransferResponse.transferId) */
|
|
26
|
+
transferId = randomBytes(16).toString('hex');
|
|
27
|
+
status = 'pending';
|
|
28
|
+
/** Whether the caller has confirmed the VoP result with `confirmTransfer()` */
|
|
29
|
+
confirmed = false;
|
|
30
|
+
/** Whether HKVPA goes with the next TAN message (a match without code 3091) */
|
|
31
|
+
sendVopAuthorizationWithTan = false;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the bank holds the order after a match and waived the strong authentication
|
|
34
|
+
* (3076 without 3091): the confirmation is HKVPA alone, without the order or HKTAN
|
|
35
|
+
* (DK VoP specification E.8.1, figure 3)
|
|
36
|
+
*/
|
|
37
|
+
authorizationOnly = false;
|
|
38
|
+
/** Every bank answer to this order, and what they say became of it */
|
|
39
|
+
evidence = new TransferEvidence();
|
|
40
|
+
/** The response of the latest message this order's interactions handled */
|
|
41
|
+
lastResponse;
|
|
42
|
+
/** The current Verification of Payee check: its result, VoP ID, notice and codes */
|
|
43
|
+
check = new VopCheck();
|
|
44
|
+
prepared;
|
|
45
|
+
/**
|
|
46
|
+
* The material fields of the result the caller was handed to decide on, kept here
|
|
47
|
+
* where no caller can change them
|
|
48
|
+
*/
|
|
49
|
+
decided;
|
|
50
|
+
/**
|
|
51
|
+
* @param build builds the order from the banking information as it is at the time of
|
|
52
|
+
* the call; throws when the account, the bank or the input does not allow the transfer
|
|
53
|
+
*/
|
|
54
|
+
constructor(build) {
|
|
55
|
+
this.build = build;
|
|
56
|
+
this.prepared = build();
|
|
57
|
+
}
|
|
58
|
+
get account() {
|
|
59
|
+
return this.prepared.account;
|
|
60
|
+
}
|
|
61
|
+
get pain() {
|
|
62
|
+
return this.prepared.pain;
|
|
63
|
+
}
|
|
64
|
+
get hkccsVersion() {
|
|
65
|
+
return this.prepared.hkccsVersion;
|
|
66
|
+
}
|
|
67
|
+
get vopParameters() {
|
|
68
|
+
return this.prepared.vopParameters;
|
|
69
|
+
}
|
|
70
|
+
get vopId() {
|
|
71
|
+
return this.check.vopId;
|
|
72
|
+
}
|
|
73
|
+
get vopResult() {
|
|
74
|
+
return this.check.result;
|
|
75
|
+
}
|
|
76
|
+
get waitSeconds() {
|
|
77
|
+
return this.check.waitSeconds;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Builds the order again from the banking information as it is now. Called right
|
|
81
|
+
* before the order is first sent, after the dialog initialisation, which may have
|
|
82
|
+
* brought new bank or account parameters; every later message reuses this order.
|
|
83
|
+
*/
|
|
84
|
+
prepare() {
|
|
85
|
+
this.prepared = this.build();
|
|
86
|
+
this.startCheck();
|
|
87
|
+
}
|
|
88
|
+
/** Starts a new check: whatever the bank said about an earlier one no longer counts */
|
|
89
|
+
startCheck() {
|
|
90
|
+
this.check = new VopCheck();
|
|
91
|
+
this.authorizationOnly = false;
|
|
92
|
+
return this.check;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Reads the result of the current check
|
|
96
|
+
* @returns the result, or why it cannot be trusted
|
|
97
|
+
*/
|
|
98
|
+
readResult() {
|
|
99
|
+
return this.check.read(this.pain, this.vopParameters?.noticeStructured ?? false);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Binds the caller's decision, a confirmation or a TAN, to the current result: the
|
|
103
|
+
* first result handed to the caller is the only one the transfer goes on with
|
|
104
|
+
*/
|
|
105
|
+
bindDecision() {
|
|
106
|
+
this.decided ??= this.material();
|
|
107
|
+
}
|
|
108
|
+
/** Whether the current result is, in every material field, the one the caller decided on */
|
|
109
|
+
isDecided() {
|
|
110
|
+
return this.decided !== undefined && this.decided === this.material();
|
|
111
|
+
}
|
|
112
|
+
material() {
|
|
113
|
+
const result = this.vopResult;
|
|
114
|
+
if (!result) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const { code, iban, suggestedName, notApplicableReason, notice, reasons } = result;
|
|
118
|
+
return JSON.stringify([
|
|
119
|
+
this.vopId,
|
|
120
|
+
result.result,
|
|
121
|
+
code,
|
|
122
|
+
iban,
|
|
123
|
+
suggestedName,
|
|
124
|
+
notApplicableReason,
|
|
125
|
+
notice,
|
|
126
|
+
reasons,
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
createHkccs() {
|
|
130
|
+
return {
|
|
131
|
+
header: { segId: HKCCS.Id, segNr: 0, version: this.hkccsVersion },
|
|
132
|
+
account: this.account,
|
|
133
|
+
sepaDescriptor: this.pain.descriptor,
|
|
134
|
+
sepaPainMessage: this.pain.bytes,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
createHkvpa() {
|
|
138
|
+
if (!this.vopParameters || this.vopId === undefined) {
|
|
139
|
+
throw new Error('cannot authorise a transfer without a VoP ID');
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
header: { segId: HKVPA.Id, segNr: 0, version: this.vopParameters.hkvpaVersion },
|
|
143
|
+
vopId: this.vopId,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* HKVPP to start the check, or, while it runs, to ask for the rest of the result with
|
|
148
|
+
* the touchdown point and polling ID of the latest answer
|
|
149
|
+
*/
|
|
150
|
+
createHkvpp() {
|
|
151
|
+
if (!this.vopParameters) {
|
|
152
|
+
throw new Error('cannot check the payee when the bank does not require it');
|
|
153
|
+
}
|
|
154
|
+
const { touchdownPoint, pollingId } = this.check;
|
|
155
|
+
return {
|
|
156
|
+
header: { segId: HKVPP.Id, segNr: 0, version: this.vopParameters.hkvppVersion },
|
|
157
|
+
supportedReports: this.vopParameters.reportFormats,
|
|
158
|
+
pollingId: touchdownPoint ? pollingId : undefined,
|
|
159
|
+
touchdownPoint,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Whether the bank holds the order after the match of the current check and needs no
|
|
164
|
+
* strong authentication for it (3076 without 3091 or 3945, no TAN asked for): HKVPA
|
|
165
|
+
* alone then authorises it
|
|
166
|
+
*/
|
|
167
|
+
holdsMatch(tanRequested) {
|
|
168
|
+
return (!tanRequested &&
|
|
169
|
+
this.vopResult?.result === 'match' &&
|
|
170
|
+
this.check.has(3076) &&
|
|
171
|
+
!this.check.has(3091) &&
|
|
172
|
+
!this.check.has(3945));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The first HIVPP that carries a VoP ID, or the first one at all
|
|
177
|
+
*/
|
|
178
|
+
function findHivpp(message) {
|
|
179
|
+
const segments = message.findAllSegments(HIVPP.Id);
|
|
180
|
+
return segments.find((segment) => segment.vopId !== undefined) ?? segments[0];
|
|
181
|
+
}
|
|
182
|
+
function withoutTan(response) {
|
|
183
|
+
const { tanReference: _reference, tanChallenge: _challenge, tanPhoto: _photo, tanChallengeHhdUc: _hhdUc, tanMediaName: _media, ...rest } = response;
|
|
184
|
+
return { ...rest, requiresTan: false };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* What the transfer interactions share: the order state, the evaluation of every
|
|
188
|
+
* answer against it, and holding the dialog open while the bank or the caller has
|
|
189
|
+
* to act before the next message.
|
|
190
|
+
*
|
|
191
|
+
* Every message goes through the order's evidence before it is sent, and every answer
|
|
192
|
+
* into it before anything branches on it; the interaction then reads what the
|
|
193
|
+
* Verification of Payee allows next, and the evidence decides the outcome
|
|
194
|
+
* (TransferEvidence). Nothing that can move money is sent without the caller seeing the
|
|
195
|
+
* VoP result first, unless the bank itself executes the order on the first message (DK
|
|
196
|
+
* VoP specification E.8.1 rule 2: codes 3091 and 3076). Anything unexpected ends the
|
|
197
|
+
* transfer with `success: false` instead of sending another message.
|
|
198
|
+
*/
|
|
199
|
+
class TransferOrderInteraction extends CustomerOrderInteraction {
|
|
200
|
+
order;
|
|
201
|
+
constructor(segId, order) {
|
|
202
|
+
super(segId, HIVPP.Id);
|
|
203
|
+
this.order = order;
|
|
204
|
+
}
|
|
205
|
+
beforeSend(message) {
|
|
206
|
+
this.order.evidence.send(message);
|
|
207
|
+
}
|
|
208
|
+
handleClientResponse(message) {
|
|
209
|
+
let base;
|
|
210
|
+
let unreadable;
|
|
211
|
+
try {
|
|
212
|
+
base = super.handleClientResponse(message);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
// Such as a code asking for a TAN without a HITAN: answer, do not throw
|
|
216
|
+
unreadable = `Unexpected answer from the bank: ${error.message}.`;
|
|
217
|
+
base = {
|
|
218
|
+
dialogId: message.findSegment(HNHBK.Id)?.dialogId ?? '',
|
|
219
|
+
success: false,
|
|
220
|
+
bankingInformationUpdated: false,
|
|
221
|
+
bankAnswers: message.getBankAnswers(),
|
|
222
|
+
requiresTan: false,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (base.requiresTan && !base.tanReference) {
|
|
226
|
+
// A challenge that cannot be answered: the evidence so far decides
|
|
227
|
+
unreadable = 'The bank asked for a TAN without the reference of its challenge.';
|
|
228
|
+
}
|
|
229
|
+
this.order.evidence.record(message, {
|
|
230
|
+
tanRequested: base.requiresTan || unreadable !== undefined,
|
|
231
|
+
unreadable,
|
|
232
|
+
externalApproval: !!this.dialog?.config.selectedTanMethod?.isDecoupled,
|
|
233
|
+
});
|
|
234
|
+
// An error ends the transfer whatever else the answer says; the base response counts
|
|
235
|
+
// a TAN request as success even next to an error code
|
|
236
|
+
const proposal = unreadable !== undefined || message.getHighestReturnCode() >= 9000
|
|
237
|
+
? 'none'
|
|
238
|
+
: this.evaluate(message, base);
|
|
239
|
+
const response = this.conclude(base, this.order.evidence.decide(proposal));
|
|
240
|
+
this.order.lastResponse = response;
|
|
241
|
+
return response;
|
|
242
|
+
}
|
|
243
|
+
awaitsCaller() {
|
|
244
|
+
return this.order.status === 'polling' || this.order.status === 'awaitingConfirmation';
|
|
245
|
+
}
|
|
246
|
+
handleResponse() {
|
|
247
|
+
// Everything happens in handleClientResponse, which also sees TAN requests
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The answer to a message after the check: the TAN message, whichever step asked for
|
|
251
|
+
* the TAN, or the message that carries HKVPA, the caller's authorisation despite the
|
|
252
|
+
* result
|
|
253
|
+
*/
|
|
254
|
+
evaluateLater(message, base) {
|
|
255
|
+
const order = this.order;
|
|
256
|
+
const later = this.takeLaterResult(message);
|
|
257
|
+
if (later) {
|
|
258
|
+
return later;
|
|
259
|
+
}
|
|
260
|
+
if (message.hasReturnCode(3945)) {
|
|
261
|
+
// 3945: the bank voided the approval and wants HKVPA with the order (E.8.1 rule 5)
|
|
262
|
+
if (order.vopParameters && order.vopId !== undefined && !order.confirmed) {
|
|
263
|
+
return 'confirmation';
|
|
264
|
+
}
|
|
265
|
+
return { stop: 'The bank refused the approval (3945).' };
|
|
266
|
+
}
|
|
267
|
+
if (base.requiresTan) {
|
|
268
|
+
// Decoupled approval still pending (3956), another TAN asked for, or the TAN for
|
|
269
|
+
// the authorisation; HKVPA has gone, the TAN message carries none
|
|
270
|
+
order.sendVopAuthorizationWithTan = false;
|
|
271
|
+
return 'tan';
|
|
272
|
+
}
|
|
273
|
+
if (message.hasReturnCode(3958)) {
|
|
274
|
+
return { stop: 'The approval app does not support the approval of this order (3958).' };
|
|
275
|
+
}
|
|
276
|
+
return 'none';
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Takes in a result the bank sends with an answer after the check, such as with 3945 to
|
|
280
|
+
* the TAN: a new check, which replaces the earlier one whole. The caller decided on the
|
|
281
|
+
* earlier one; a result that differs from it in any material field ends the transfer
|
|
282
|
+
* instead of asking again, so no decision, a late one included, applies to another result.
|
|
283
|
+
* @returns why the transfer has to stop, if it does
|
|
284
|
+
*/
|
|
285
|
+
takeLaterResult(message) {
|
|
286
|
+
const hivpp = findHivpp(message);
|
|
287
|
+
if (!hivpp) {
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
const order = this.order;
|
|
291
|
+
if (!order.vopParameters) {
|
|
292
|
+
return { stop: UNANNOUNCED_CHECK };
|
|
293
|
+
}
|
|
294
|
+
order.startCheck().take(message, hivpp, order.evidence.touchdownPoint);
|
|
295
|
+
const result = order.readResult();
|
|
296
|
+
if (typeof result === 'string') {
|
|
297
|
+
return { stop: result };
|
|
298
|
+
}
|
|
299
|
+
return order.isDecided()
|
|
300
|
+
? undefined
|
|
301
|
+
: {
|
|
302
|
+
stop: 'The bank sent another Verification of Payee result than the one decided on, see vop.',
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Hands the result of the check to the caller. A match the bank holds and needs no
|
|
307
|
+
* strong authentication for, by the codes of every answer of the check, is authorised
|
|
308
|
+
* by HKVPA alone (E.8.1, figure 3).
|
|
309
|
+
*/
|
|
310
|
+
offerConfirmation(tanRequested) {
|
|
311
|
+
this.order.authorizationOnly = this.order.holdsMatch(tanRequested);
|
|
312
|
+
if (this.order.authorizationOnly) {
|
|
313
|
+
this.order.evidence.hold();
|
|
314
|
+
}
|
|
315
|
+
return 'confirmation';
|
|
316
|
+
}
|
|
317
|
+
conclude(base, outcome) {
|
|
318
|
+
const order = this.order;
|
|
319
|
+
if (outcome.status === 'failed') {
|
|
320
|
+
order.status = 'failed';
|
|
321
|
+
return {
|
|
322
|
+
...this.respond(withoutTan(base)),
|
|
323
|
+
success: false,
|
|
324
|
+
failureReason: outcome.reason,
|
|
325
|
+
outcomeUncertain: outcome.uncertain,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
if (outcome.status === 'tan' || outcome.status === 'confirmation') {
|
|
329
|
+
order.bindDecision();
|
|
330
|
+
}
|
|
331
|
+
if (outcome.status === 'tan') {
|
|
332
|
+
order.status = 'awaitingTan';
|
|
333
|
+
return this.respond(base);
|
|
334
|
+
}
|
|
335
|
+
order.status =
|
|
336
|
+
outcome.status === 'confirmation'
|
|
337
|
+
? 'awaitingConfirmation'
|
|
338
|
+
: outcome.status === 'poll'
|
|
339
|
+
? 'polling'
|
|
340
|
+
: 'accepted';
|
|
341
|
+
return this.respond(withoutTan(base), outcome.status === 'confirmation');
|
|
342
|
+
}
|
|
343
|
+
respond(base, requiresVopConfirmation = false) {
|
|
344
|
+
return {
|
|
345
|
+
...base,
|
|
346
|
+
requiresVopConfirmation,
|
|
347
|
+
// A copy: what the caller does with it changes nothing here
|
|
348
|
+
vop: structuredClone(this.order.vopResult),
|
|
349
|
+
transferId: this.order.transferId,
|
|
350
|
+
endToEndId: this.order.pain.endToEndId,
|
|
351
|
+
outcomeUncertain: false,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Submits a SEPA credit transfer (HKCCS), with the Verification of Payee check
|
|
357
|
+
* request (HKVPP) in front of it when the bank requires one, or, as the confirm step,
|
|
358
|
+
* sends the identical order again together with the authorisation (HKVPA) after the
|
|
359
|
+
* caller has accepted the VoP result.
|
|
360
|
+
*/
|
|
361
|
+
export class CreditTransferInteraction extends TransferOrderInteraction {
|
|
362
|
+
step;
|
|
363
|
+
constructor(order, step) {
|
|
364
|
+
super(HKCCS.Id, order);
|
|
365
|
+
this.step = step;
|
|
366
|
+
}
|
|
367
|
+
createSegments(_config) {
|
|
368
|
+
if (this.step === 'confirm') {
|
|
369
|
+
return [this.order.createHkvpa(), this.order.createHkccs()];
|
|
370
|
+
}
|
|
371
|
+
this.order.prepare();
|
|
372
|
+
const hkccs = this.order.createHkccs();
|
|
373
|
+
return this.order.vopParameters ? [this.order.createHkvpp(), hkccs] : [hkccs];
|
|
374
|
+
}
|
|
375
|
+
needsTanSegment(tanRequired) {
|
|
376
|
+
// HKVPP or HKVPA, HKTAN and the order always go together (DK VoP specification
|
|
377
|
+
// E.8.1 rules 1 and 4), whatever the BPD say about a TAN for HKCCS
|
|
378
|
+
return tanRequired || !!this.order.vopParameters;
|
|
379
|
+
}
|
|
380
|
+
getTanMessageSegments(_config) {
|
|
381
|
+
// After a match without 3091, HKVPA goes with the TAN (E.8.1, figure 3); only
|
|
382
|
+
// with the first TAN message, not with the status requests of a decoupled method
|
|
383
|
+
if (this.order.status === 'awaitingTan' && this.order.sendVopAuthorizationWithTan) {
|
|
384
|
+
this.order.sendVopAuthorizationWithTan = false;
|
|
385
|
+
return [this.order.createHkvpa()];
|
|
386
|
+
}
|
|
387
|
+
return [];
|
|
388
|
+
}
|
|
389
|
+
evaluate(message, base) {
|
|
390
|
+
if (this.order.status === 'awaitingTan' || this.step === 'confirm') {
|
|
391
|
+
return this.evaluateLater(message, base);
|
|
392
|
+
}
|
|
393
|
+
return this.order.vopParameters
|
|
394
|
+
? this.evaluateSubmitWithVop(message, base)
|
|
395
|
+
: this.evaluateSubmitWithoutVop(message, base);
|
|
396
|
+
}
|
|
397
|
+
evaluateSubmitWithoutVop(message, base) {
|
|
398
|
+
if (message.hasReturnCode(3945)) {
|
|
399
|
+
return {
|
|
400
|
+
stop: 'The bank asked for a Verification of Payee its parameters do not announce for HKCCS (3945).',
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
// The banking information said no check was needed, but the bank checked: its result
|
|
404
|
+
// has to reach the caller before any TAN, which this order cannot offer
|
|
405
|
+
if (findHivpp(message) || VOP_CODES.some((code) => message.hasReturnCode(code))) {
|
|
406
|
+
return { stop: UNANNOUNCED_CHECK };
|
|
407
|
+
}
|
|
408
|
+
return base.requiresTan ? 'tan' : 'none';
|
|
409
|
+
}
|
|
410
|
+
evaluateSubmitWithVop(message, base) {
|
|
411
|
+
const order = this.order;
|
|
412
|
+
// Searched in every answer, not only the HKTAN's: Commerzbank attaches 3945
|
|
413
|
+
// elsewhere (observed at that bank, reported in python-fints PR #223)
|
|
414
|
+
const approvalVoided = message.hasReturnCode(3945);
|
|
415
|
+
const hivpp = findHivpp(message);
|
|
416
|
+
// 3091 with 3076 in this answer, the bank executed the order without a challenge
|
|
417
|
+
// (E.8.1 rule 2; Hamburger Sparkasse does this, as reported to python-fints): the
|
|
418
|
+
// evidence decides that before anything this reads
|
|
419
|
+
order.check.take(message, hivpp, order.evidence.touchdownPoint);
|
|
420
|
+
if (!hivpp) {
|
|
421
|
+
return { stop: 'The bank answered without a Verification of Payee result.' };
|
|
422
|
+
}
|
|
423
|
+
if (hivpp.vopId === undefined) {
|
|
424
|
+
// Atruvia banks check asynchronously: polling ID, touchdown point (3040) and
|
|
425
|
+
// code 3905 instead of a challenge (observed there, reported in python-fints
|
|
426
|
+
// PR #223). A TAN request before the result is complete is not expected.
|
|
427
|
+
return order.check.canPoll() && !base.requiresTan ? 'poll' : { stop: NO_VOP_ID };
|
|
428
|
+
}
|
|
429
|
+
const result = order.readResult();
|
|
430
|
+
if (typeof result === 'string') {
|
|
431
|
+
return { stop: result };
|
|
432
|
+
}
|
|
433
|
+
// The codes decide the flow, not the result (E.8.1): 3945 voids the approval
|
|
434
|
+
// even for a match
|
|
435
|
+
if (base.requiresTan && !approvalVoided && result.result === 'match') {
|
|
436
|
+
// 3091: the bank needs no HKVPA, the TAN alone answers the challenge (rule 3)
|
|
437
|
+
order.sendVopAuthorizationWithTan = !order.check.has(3091);
|
|
438
|
+
return 'tan';
|
|
439
|
+
}
|
|
440
|
+
// A deviation, or a match the bank wants confirmed: the caller decides. A TAN
|
|
441
|
+
// the bank asked for anyway is dropped; the confirm step brings a new one.
|
|
442
|
+
return this.offerConfirmation(base.requiresTan);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Authorises an order the bank holds after a match and for which it waived the strong
|
|
447
|
+
* authentication (3076 without 3091): HKVPA alone, without the order and without HKTAN
|
|
448
|
+
* (DK VoP specification E.8.1, figure 3 and its note on small amounts).
|
|
449
|
+
*/
|
|
450
|
+
export class VopAuthorizationInteraction extends TransferOrderInteraction {
|
|
451
|
+
constructor(order) {
|
|
452
|
+
super(HKVPA.Id, order);
|
|
453
|
+
}
|
|
454
|
+
createSegments(_config) {
|
|
455
|
+
return [this.order.createHkvpa()];
|
|
456
|
+
}
|
|
457
|
+
needsTanSegment(_tanRequired) {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
evaluate(message, base) {
|
|
461
|
+
return this.evaluateLater(message, base);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Asks again for a Verification of Payee result the bank is still producing: HKVPP
|
|
466
|
+
* alone, with the touchdown point of the latest answer and the polling ID, when the bank
|
|
467
|
+
* sent them (DK VoP specification C.10.7.1.1; the polling ID is optional, but where the
|
|
468
|
+
* bank sends both, Atruvia answers 9210 to either alone, as reported in python-fints
|
|
469
|
+
* PR #223).
|
|
470
|
+
*
|
|
471
|
+
* The dialog adds HKTAN only if the bank's parameters require a TAN for HKVPP itself.
|
|
472
|
+
*/
|
|
473
|
+
export class VopPollInteraction extends TransferOrderInteraction {
|
|
474
|
+
constructor(order) {
|
|
475
|
+
super(HKVPP.Id, order);
|
|
476
|
+
}
|
|
477
|
+
createSegments(_config) {
|
|
478
|
+
return [this.order.createHkvpp()];
|
|
479
|
+
}
|
|
480
|
+
evaluate(message, base) {
|
|
481
|
+
const hivpp = findHivpp(message);
|
|
482
|
+
if (!hivpp || base.requiresTan) {
|
|
483
|
+
return { stop: 'Unexpected answer to the Verification of Payee poll.' };
|
|
484
|
+
}
|
|
485
|
+
const check = this.order.check;
|
|
486
|
+
check.take(message, hivpp, this.order.evidence.touchdownPoint);
|
|
487
|
+
if (hivpp.vopId === undefined) {
|
|
488
|
+
// The VoP ID comes with the final part of the result (C.10.7.1.1)
|
|
489
|
+
return check.canPoll() ? 'poll' : { stop: NO_VOP_ID };
|
|
490
|
+
}
|
|
491
|
+
const result = this.order.readResult();
|
|
492
|
+
if (typeof result === 'string') {
|
|
493
|
+
return { stop: result };
|
|
494
|
+
}
|
|
495
|
+
// No challenge was issued yet, so even a match goes back to the caller: the
|
|
496
|
+
// confirm step may execute the order straight away where no TAN is needed
|
|
497
|
+
return this.offerConfirmation(false);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describeAccount } from '../bankAccount.js';
|
|
2
|
+
import { DIKKU } from '../segments/DIKKU.js';
|
|
3
|
+
import { DKKKU } from '../segments/DKKKU.js';
|
|
4
|
+
import { CustomerOrderInteraction } from './customerInteraction.js';
|
|
5
|
+
export class CreditCardStatementInteraction extends CustomerOrderInteraction {
|
|
6
|
+
account;
|
|
7
|
+
from;
|
|
8
|
+
constructor(account, from) {
|
|
9
|
+
super(DKKKU.Id, DIKKU.Id);
|
|
10
|
+
this.account = account;
|
|
11
|
+
this.from = from;
|
|
12
|
+
}
|
|
13
|
+
createSegments(init) {
|
|
14
|
+
const bankAccount = init.getBankAccount(this.account);
|
|
15
|
+
if (!init.isAccountTransactionSupported(this.account, this.segId)) {
|
|
16
|
+
throw Error(`Account ${describeAccount(this.account)} does not support business transaction '${this.segId}'`);
|
|
17
|
+
}
|
|
18
|
+
const account = { ...bankAccount, iban: undefined };
|
|
19
|
+
const version = 2;
|
|
20
|
+
const dkkku = {
|
|
21
|
+
header: { segId: DKKKU.Id, segNr: 0, version: version },
|
|
22
|
+
account,
|
|
23
|
+
accountNumber: account.accountNumber,
|
|
24
|
+
subAccountId: account.subAccountId,
|
|
25
|
+
from: this.from,
|
|
26
|
+
};
|
|
27
|
+
return [dkkku];
|
|
28
|
+
}
|
|
29
|
+
handleResponse(response, clientResponse) {
|
|
30
|
+
function parseGermanFloat(value) {
|
|
31
|
+
const valueFloatStr = value.replaceAll('.', '').replaceAll(',', '.');
|
|
32
|
+
return parseFloat(valueFloatStr);
|
|
33
|
+
}
|
|
34
|
+
// A response the bank spread over several messages arrives as several DIKKU
|
|
35
|
+
// segments. The balance is the same in each, the transactions are not.
|
|
36
|
+
const dikkuSegments = response.findAllSegments(DIKKU.Id);
|
|
37
|
+
const dikku = dikkuSegments[0]
|
|
38
|
+
? {
|
|
39
|
+
...dikkuSegments[0],
|
|
40
|
+
transactions: dikkuSegments.flatMap((segment) => segment.transactions ?? []),
|
|
41
|
+
}
|
|
42
|
+
: undefined;
|
|
43
|
+
if (dikku) {
|
|
44
|
+
const creditDebit = dikku.balance.creditDebit;
|
|
45
|
+
const balanceAmount = dikku.balance.amount.value * (creditDebit === 'D' ? -1 : 1);
|
|
46
|
+
const balanceCurrency = dikku.balance.amount.currency;
|
|
47
|
+
const balanceDateTime = dikku.balance.date;
|
|
48
|
+
if (dikku.balance.time) {
|
|
49
|
+
balanceDateTime.setUTCHours(dikku.balance.time.getUTCHours());
|
|
50
|
+
balanceDateTime.setUTCMinutes(dikku.balance.time.getUTCMinutes());
|
|
51
|
+
balanceDateTime.setUTCSeconds(dikku.balance.time.getUTCSeconds());
|
|
52
|
+
}
|
|
53
|
+
clientResponse.balance = {
|
|
54
|
+
balance: balanceAmount,
|
|
55
|
+
date: balanceDateTime,
|
|
56
|
+
currency: balanceCurrency,
|
|
57
|
+
};
|
|
58
|
+
clientResponse.statements = [];
|
|
59
|
+
if (dikku.transactions) {
|
|
60
|
+
for (let i = 0; i < dikku.transactions.length; i++) {
|
|
61
|
+
const parts = dikku.transactions[i].split(':');
|
|
62
|
+
// const account = parts[0];
|
|
63
|
+
const transactionDateStr = parts[1];
|
|
64
|
+
const valueDateStr = parts[2];
|
|
65
|
+
const currencyOrig = parts[5];
|
|
66
|
+
const depositMarkerOrig = parts[6];
|
|
67
|
+
const amountOrig = parseGermanFloat(parts[4]) * (depositMarkerOrig === 'D' ? -1 : 1);
|
|
68
|
+
const exchangeRate = parseGermanFloat(parts[7]);
|
|
69
|
+
const currency = parts[9];
|
|
70
|
+
const depositMarker = parts[10];
|
|
71
|
+
const amount = parseGermanFloat(parts[8]) * (depositMarker === 'D' ? -1 : 1);
|
|
72
|
+
const tYear = parseInt(transactionDateStr.substring(0, 4), 10);
|
|
73
|
+
const tMonth = parseInt(transactionDateStr.substring(4, 6), 10);
|
|
74
|
+
const tDay = parseInt(transactionDateStr.substring(6, 8), 10);
|
|
75
|
+
const vYear = parseInt(valueDateStr.substring(0, 4), 10);
|
|
76
|
+
const vMonth = parseInt(valueDateStr.substring(4, 6), 10);
|
|
77
|
+
const vDay = parseInt(valueDateStr.substring(6, 8), 10);
|
|
78
|
+
let purpose = '';
|
|
79
|
+
let pIdx = 11;
|
|
80
|
+
do {
|
|
81
|
+
const partPurpose = parts[pIdx].trim();
|
|
82
|
+
if (partPurpose === 'J') {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
purpose = purpose + partPurpose;
|
|
86
|
+
if (purpose.endsWith('Betrag?')) {
|
|
87
|
+
purpose = `${purpose.slice(0, purpose.length - 7)} Betrag `;
|
|
88
|
+
}
|
|
89
|
+
else if (purpose[purpose.length - 1] === '?') {
|
|
90
|
+
purpose = `${purpose.slice(0, purpose.length - 1)} `;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
pIdx += 1;
|
|
96
|
+
} while (pIdx < 21);
|
|
97
|
+
const statement = {
|
|
98
|
+
transactionDate: new Date(tYear, tMonth - 1, tDay),
|
|
99
|
+
valueDate: new Date(vYear, vMonth - 1, vDay),
|
|
100
|
+
currency: currency,
|
|
101
|
+
amount: amount,
|
|
102
|
+
purpose: purpose,
|
|
103
|
+
originalCurrency: currencyOrig,
|
|
104
|
+
originalAmount: amountOrig,
|
|
105
|
+
exchangeRate: exchangeRate,
|
|
106
|
+
};
|
|
107
|
+
clientResponse.statements = clientResponse.statements.concat(statement);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
clientResponse.statements = [];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|