From 13ed477c58b008ca298d64cf91e17aded63bb739 Mon Sep 17 00:00:00 2001 From: Christian Kosmowski Date: Fri, 16 Nov 2018 21:56:22 +0100 Subject: [PATCH] Further cleanup of establishConnection --- src/FinTSClient.ts | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/FinTSClient.ts b/src/FinTSClient.ts index ed7cab0..0ffc4bb 100644 --- a/src/FinTSClient.ts +++ b/src/FinTSClient.ts @@ -564,20 +564,7 @@ export class FinTSClient { if (step === 1 || step === 2) { // Im Step 1 und 2 bleiben keine Verbindungen erhalten // Diese Verbindung auf jeden Fall beenden - const neuUrl = this.bpd.url; - const neuSigMethod = this.upd.availableTanVerfahren[0]; - this.bpd = originalBpd.clone(); - this.upd = originalUpd.clone(); - const origSysId = this.sysId; - const origLastSig = this.lastSignaturId; - this.endDialogIfNotCanceled(recvMsg); - this.clear(); - this.bpd.url = neuUrl; - this.upd.availableTanVerfahren[0] = neuSigMethod; - this.sysId = origSysId; - this.lastSignaturId = origLastSig; - originalBpd.url = this.bpd.url; - originalUpd.availableTanVerfahren[0] = neuSigMethod; + this.resetConnection(originalBpd, originalUpd, recvMsg); } if (hasNewUrl) { @@ -1012,6 +999,23 @@ export class FinTSClient { }); } + private resetConnection(originalBpd, originalUpd, recvMsg) { + const neuUrl = this.bpd.url; + const neuSigMethod = this.upd.availableTanVerfahren[0]; + this.bpd = originalBpd.clone(); + this.upd = originalUpd.clone(); + const origSysId = this.sysId; + const origLastSig = this.lastSignaturId; + this.endDialogIfNotCanceled(recvMsg); + this.clear(); + this.bpd.url = neuUrl; + this.upd.availableTanVerfahren[0] = neuSigMethod; + this.sysId = origSysId; + this.lastSignaturId = origLastSig; + originalBpd.url = this.bpd.url; + originalUpd.availableTanVerfahren[0] = neuSigMethod; + } + private debugLogMsg = (txt, send) => { this.conLog.trace({ raw_data: txt,