diff --git a/lib/Classes.js b/lib/Classes.js index ba91245..e1566a9 100644 --- a/lib/Classes.js +++ b/lib/Classes.js @@ -56,8 +56,8 @@ var ByteVal = function (ddd) { } var Helper = new function () { - this.checkMsgsWithBelongToForId = function (msg, bez, id) { - var array = msg.selectSegByNameAndBelongTo('HIRMS', bez) + this.checkMsgsWithBelongToForId = function (msg, id) { + var array = msg.selectSegByName('HIRMS') if (array.length > 0) { for (var i = 0; i != array.length; i++) { for (var a = 0; a != array[i].store.data.length; a++) { @@ -864,6 +864,7 @@ var Order = function (client) { } } if (act_vers == 0) { + console.log("Angefragte Aktion nicht erlaubt") me_order.error = new Exceptions.GVNotSupportedByKI(in_data.ki_type, client.bpd.gv_parameters[in_data.ki_type]) return false } diff --git a/lib/FinTSClient.js b/lib/FinTSClient.js index 0599d14..e4cbc0f 100644 --- a/lib/FinTSClient.js +++ b/lib/FinTSClient.js @@ -414,13 +414,35 @@ var FinTSClient = function (in_blz, in_kunden_id, in_pin, in_bankenlist, logger) }, 'Unhandled callback Error in HKVVB,HKIDN') } } else { + //Auf fehlerprüfen + + var errorToManyLogin = Helper.checkMsgsWithBelongToForId(recvMsg, '3931') + if (errorToManyLogin) { + console.log("Login Error") + cb(errorToManyLogin.getEl(3), recvMsg, false) + return + + } + var errorpw = Helper.checkMsgsWithBelongToForId(recvMsg, '9942') + if (errorpw) { + console.log("Pw Error") + cb(errorpw.getEl(3), recvMsg, false) + return + + } + + + // Prüfen ob Erfolgreich var HIRMG = null try { HIRMG = recvMsg.selectSegByName('HIRMG')[0] } catch (e) {}; - if (HIRMG != null && (HIRMG.getEl(1).getEl(1) == '0010' || HIRMG.getEl(1).getEl(1) == '3060')) { - if (Helper.checkMsgsWithBelongToForId(recvMsg, HKVVB.nr, '0020')) { + if (HIRMG != null && (HIRMG.getEl(1).getEl(1) == '0010' || HIRMG.getEl(1).getEl(1) == '3060' || HIRMG.getEl(2).getEl(1) == '3060')) { + if (Helper.checkMsgsWithBelongToForId(recvMsg, '0020')) { + + + try { // 1. Dialog ID zuweisen me.dialog_id = recvMsg.selectSegByName('HNHBK')[0].getEl(3) @@ -454,19 +476,21 @@ var FinTSClient = function (in_blz, in_kunden_id, in_pin, in_bankenlist, logger) if (me.konten.length == 0) { var konto_list = recvMsg.selectSegByName('HIUPD') for (var i = 0; i != konto_list.length; i++) { - var konto = new Konto() - konto.iban = konto_list[i].getEl(2) - konto.konto_nr = konto_list[i].getEl(1).getEl(1) - konto.unter_konto = konto_list[i].getEl(1).getEl(2) - konto.ctry_code = konto_list[i].getEl(1).getEl(3) - konto.blz = konto_list[i].getEl(1).getEl(4) - konto.kunden_id = konto_list[i].getEl(3) - konto.kontoar = konto_list[i].getEl(4) - konto.currency = konto_list[i].getEl(5) - konto.kunde1_name = konto_list[i].getEl(6) - konto.product_name = konto_list[i].getEl(8) - konto.sepa_data = null - me.konten.push(konto) + if(konto_list[i].getEl(2)){ + var konto = new Konto() + konto.iban = konto_list[i].getEl(2) + konto.konto_nr = konto_list[i].getEl(1).getEl(1) + konto.unter_konto = konto_list[i].getEl(1).getEl(2) + konto.ctry_code = konto_list[i].getEl(1).getEl(3) + konto.blz = konto_list[i].getEl(1).getEl(4) + konto.kunden_id = konto_list[i].getEl(3) + konto.kontoar = konto_list[i].getEl(4) + konto.currency = konto_list[i].getEl(5) + konto.kunde1_name = konto_list[i].getEl(6) + konto.product_name = konto_list[i].getEl(8) + konto.sepa_data = null + me.konten.push(konto) + } } } // 5. Analysiere BPD @@ -482,6 +506,8 @@ var FinTSClient = function (in_blz, in_kunden_id, in_pin, in_bankenlist, logger) me.log.gv.error(ee, { gv: 'HIBPA' }, 'Error while analyse BPD') + cb("Wrong password") + return } if (me.proto_version == 300) { try { @@ -928,6 +954,7 @@ var FinTSClient = function (in_blz, in_kunden_id, in_pin, in_bankenlist, logger) 5: recv } }) + req_umsaetze.done(function (error, order, recvMsg) { if (error && !processed) { me.log.gv.error(error, { @@ -1088,6 +1115,7 @@ var FinTSClient = function (in_blz, in_kunden_id, in_pin, in_bankenlist, logger) // 3. Abschließende Verbindung aufbauen var perform_step = function (step) { me.MsgInitDialog(function (error, recvMsg, has_neu_url) { + console.log(error) if (error) { me.MsgCheckAndEndDialog(recvMsg, function (error2, recvMsg2) { if (error2) { diff --git a/lib/MTParser.js b/lib/MTParser.js index 57dbed0..63fe6da 100644 --- a/lib/MTParser.js +++ b/lib/MTParser.js @@ -159,8 +159,10 @@ module.exports = function () { satz.datum = me.convertMTDateFormatToJS(msg[a][1].substr(0, 6)) if ('0123456789'.indexOf(msg[a][1][6]) != -1) { // optionales feld Buchungstag + satz.buchungsdatum = me.convertMTDateFormatToJS(msg[a][1].substr(0, 2) + msg[a][1].substr(6, 4) ) pos = 10 } else { + satz.buchungsdatum = me.convertMTDateFormatToJS(msg[a][1].substr(0, 6)) pos = 6 } if (msg[a][1][pos] == 'R') { @@ -173,6 +175,7 @@ module.exports = function () { pos++ if ('0123456789'.indexOf(msg[a][1][pos]) == -1) { // optionales feld Währungsunterscheidung + pos++ } else { @@ -263,7 +266,6 @@ module.exports = function () { var dtYear = parseInt('20' + date.substr(0, 2), 10) var dtMonth = parseInt(date.substr(2, 2), 10) - 1 var dtDate = parseInt(date.substr(4, 2), 10) - - return new Date(dtYear, dtMonth, dtDate) + return new Date(dtYear, dtMonth, dtDate, 12) } }