From 3422e5eb2819f5de304f25dc622f5284813bb9b4 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 6 Jul 2022 12:09:48 +0200 Subject: more YAGNI --- .../asit/pdfover/gui/bku/MobileBKUConnector.java | 2 +- .../asit/pdfover/gui/bku/mobile/ATrustHandler.java | 13 ++++----- .../asit/pdfover/gui/bku/mobile/ATrustStatus.java | 32 ++-------------------- 3 files changed, 8 insertions(+), 39 deletions(-) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java index c1b30add..2e278f5e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java @@ -146,7 +146,7 @@ public class MobileBKUConnector implements BkuSlConnector { enterTAN = false; } } - if (enterTAN && !aStatus.getTanField()) { + if (enterTAN && !aStatus.tanField) { try { this.state.showFingerPrintInformation(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java index 1e996b21..03003325 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java @@ -160,9 +160,6 @@ public class ATrustHandler extends MobileBKUHandler { String sessionID = status.sessionID; String refVal = null; String signatureDataURL = null; - String qrCode = null; - String tanField = null; - String tanTextTan = null; String viewstateGenerator = status.viewStateGenerator; status.errorMessage = null; @@ -245,23 +242,23 @@ public class ATrustHandler extends MobileBKUHandler { signatureDataURL = status.baseURL + "/ShowSigobj.aspx" + //$NON-NLS-1$ MobileBKUHelper.extractSubstring(responseData, "ShowSigobj.aspx", "'"); //$NON-NLS-1$ //$NON-NLS-2$ try { - qrCode = MobileBKUHelper.extractValueFromTagWithParam(responseData, "img", "class", "qrcode", "src"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + String qrCode = MobileBKUHelper.extractValueFromTagWithParam(responseData, "img", "class", "qrcode", "src"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ log.debug("QR Code found: " + qrCode); //$NON-NLS-1$ status.qrCodeURL = qrCode; } catch (Exception e) { log.debug("No QR Code found"); //$NON-NLS-1$ } try { - tanField = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - status.setTanField(tanField); + String tanTextTan = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + status.tanField = tanTextTan.equals("input_tan"); status.dynAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN); status.dynAttrSignButton = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_BTN); } catch (Exception e) { log.debug("No tan field found"); //$NON-NLS-1$ } try { - tanTextTan = tanField = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - status.setIsAPPTan(tanTextTan); + String tanTextTan = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + status.isAPPTan = !tanTextTan.toLowerCase().contains("sms"); status.dynAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN); status.dynAttrSignButton = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_BTN); }catch (Exception e) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index 138549d4..cbd26f8c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -39,8 +39,8 @@ public class ATrustStatus extends MobileBKUStatus { public String viewState; public String eventValidation; public String qrCodeURL = null; - private boolean tanField = false; - private boolean isAPPTan = false; + public boolean tanField = false; + public boolean isAPPTan = false; public String viewStateGenerator; public String dynAttrPhoneNumber; public String dynAttrPassword; @@ -65,34 +65,6 @@ public class ATrustStatus extends MobileBKUStatus { public int getMaxTanTries() { return MOBILE_MAX_TAN_TRIES; } - - /** - * @param tanField - */ - public void setTanField(String tanField) { - this.tanField = tanField.equals("input_tan"); //$NON-NLS-1$ - } - - /** - * @return boolean if response contained tan field - */ - public boolean getTanField() { - return this.tanField; - } - - /** - * @param tanString the tan string from the response - */ - public void setIsAPPTan(String tanString) { - this.isAPPTan = !tanString.toLowerCase().contains("sms"); //$NON-NLS-1$ - } - - /** - * @return true if the user receives the tan via app - */ - public boolean getIsAPPTan() { - return this.isAPPTan; - } @Override public String ensureSessionID(String url) { -- cgit v1.2.3