User Tools

Site Tools


web-integration:client-side

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
web-integration:client-side [2019/08/01 10:29]
tjotov
web-integration:client-side [2019/08/05 12:46]
tjotov [Communication]
Line 10: Line 10:
 </sxh>      </sxh>     
  
-===== Basic usage with AAA =====+===== Basic usage with No-Code =====
 Create instance of ADUCID object: Create instance of ADUCID object:
 <sxh java> <sxh java>
Line 126: Line 126:
  
  
-===== Advanced usage ===== +===== Detailed description ===== 
-advanced method to pass more parameters like transaction amount, description, etc.+See also source file "/aducid-resources/js/aducid-api.js" 
 + 
 +==== Communication ==== 
 +=== Start operation URL === 
 +Tell Web API where your start operation is.
 <sxh java> <sxh java>
-    aducid.setInitParams = function(param) { +    aducid.setStartOperationUrl = function(param) { 
-        initParams = param;+        startOperationUrl = param;
     }     }
 </sxh> </sxh>
-tell server to generate QR / or not to reduce payload+ 
 +=== Check method location provided by server side controller ===
 <sxh java> <sxh java>
-    aducid.setGenerateQr = function(param) { +    aducid.setResultOperationUrl = function(param) { 
-        generateQr = param;+        resultOperationUrl = param;
     }     }
 </sxh> </sxh>
-QR code and animation location jQuery+ 
 +=== Proxy method location ===
 <sxh java> <sxh java>
-    aducid.setQrCode = function(param) { +    aducid.setProxyUrl = function(param) { 
-        qrCode = param;+        proxyUrl = param;
     }     }
 +
 </sxh> </sxh>
  
-QR code hint jQuery+=== Tell AJAX to use GET or POST === 
 +POST is used to deliver more data like transaction parameters
 <sxh java> <sxh java>
-    aducid.setQrHint = function(param) { +    aducid.setAjaxMethod = function(param) { 
-        qrHint = param;+        ajaxMethod = param;
     }     }
 </sxh> </sxh>
  
 +=== Redirect URL set by GUI ===
 +This is usuallly set by server side but can be also managed from client side. Server side has higher priority.
 <sxh java> <sxh java>
-debug DOM to display internal messages +    aducid.setRedirectUrl = function(param) { 
-    aducid.setDebug = function(param) { +        redirectUrl = param;
-        aducidDebug = param;+
     }     }
 </sxh> </sxh>
  
-server URL typically provided by server side controller+=== Error redirect URL set by GUI === 
 +This is usuallly set by server side but can be also managed from client side. Server side has higher priority.
 <sxh java> <sxh java>
-    aducid.setStartOperationUrl = function(param) { +    aducid.setErrorPage = function(param) { 
-        startOperationUrl = param;+        errorPage = param;
     }     }
 </sxh> </sxh>
  
-check method location provided by server side controller+=== Final action === 
 +What API should do when operation finishes (not processed on iOS as we use returnUrl directly there)
 <sxh java> <sxh java>
-    aducid.setResultOperationUrl = function(param) { +    aducid.processResult = function(result) { 
-        resultOperationUrl = param;+        alert(result);
     }     }
 </sxh> </sxh>
-    //URL with proxy method provided  by server + 
-    //returns status oft running operation from AIM until finish +=== Use push === 
-    aducid.setProxyUrl = function(param) { +Tell Web API if it should use push (QR code was used previously). 
-        proxyUrl = param;+<sxh java> 
 +    this.setPush = function(param) { 
 +        push = param == true;
     }     }
 +</sxh>
 +==== UI methods ====
 +=== Tell server to generate QR / or not to reduce payload ===
 +<sxh java>
 +    aducid.setGenerateQr = function(param) {
 +        generateQr = param;
 +    }
 +</sxh>
  
-Tell AJAX to use GET or POST +=== QR code targeting using jQuery === 
-POST is used to deliver more data like transaction parameters +<sxh java> 
-    aducid.setAjaxMethod = function(param) { +    aducid.setQrCode = function(param) { 
-        ajaxMethod = param;+        qrCode = param;
     }     }
 +</sxh>
  
-Redirect URL for iOS typically provided by server side controler +=== QR code text hint jQuery === 
-    aducid.setRedirectUrl = function(param) { +<sxh java> 
-        redirectUrl = param;+    aducid.setQrHint = function(param) { 
 +        qrHint = param;
     }     }
 +</sxh>
  
-Button with bound operation+=== Button bound operation === 
 +<sxh java>
     aducid.setButton = function(param) {     aducid.setButton = function(param) {
         aducidButton = param;         aducidButton = param;
Line 198: Line 223:
         });         });
     }     }
- +</sxh> 
-Internal logic to evaluate API binding mode +=== Text hint shown before operation started === 
-    aducid.setSessionBinding function(param) { +<sxh java>
-        if (param == "QR" || param == "URI") { +
-        } +
-        else param = ""; +
-        localStorage['session-binding'] = param; +
-    } +
- +
-Get last binding mode +
-    aducid.getSessionBinding = function() { +
-        return localStorage['session-binding']; +
-    } +
- +
-Is binding URI? +
-    aducid.isURI = function() { +
-        return instance.getSessionBinding() == "URI"; +
-    } +
-     +
-Is binding QR? +
-    aducid.isQR = function() { +
-        return instance.getSessionBinding() == "QR"; +
-    } +
- +
-Is this operation going to be authentication (i.e. first operation in chain)? +
-    aducid.setAuthentication = function() { +
-        instance.setSessionBinding(null); +
-    } +
- +
-Text hint shown before operation started+
     aducid.showQRHint = function(param) {     aducid.showQRHint = function(param) {
         if (qrHint != null) qrHint.html(localize("aducid_common_authenticateComment"));         if (qrHint != null) qrHint.html(localize("aducid_common_authenticateComment"));
     }     }
 +</sxh>
  
-How API can hide text hint+=== How API can hide text hint === 
 +<sxh java>
     aducid.hideQRHint = function(param) {     aducid.hideQRHint = function(param) {
         if (qrHint != null) qrHint.html("");         if (qrHint != null) qrHint.html("");
     }     }
  
-Text hint shown after operation started+=== Text hint shown after operation started === 
 +<sxh java>
     aducid.showRunningHint = function(param) {     aducid.showRunningHint = function(param) {
         if (qrHint != null) qrHint.html(localize("aducid_common_authenticationProgress"));         if (qrHint != null) qrHint.html(localize("aducid_common_authenticationProgress"));
     }     }
 +</sxh>
  
-How API can hide text hint+=== How API can hide text hint === 
 +<sxh java>
     aducid.hideRunningHint = function(param) {     aducid.hideRunningHint = function(param) {
         if (qrHint != null) qrHint.html("");         if (qrHint != null) qrHint.html("");
     }     }
- +</sxh> 
-The most important method - what API should do when operation finishes (not processed on iOS as we use returnUrl directly there) +==Auxiliary method to animate operation in progress === 
-    aducid.processResult function(result) { +<sxh java>
-        alert(result); +
-    } +
- +
-How PEIG not installed is treated, marketplace redirect can be used here +
-    aducid.showPeigError function() { +
-        alert("peig error - override this function"+
-    } +
- +
- +
-Auxiliary method to animate operation in progress+
     aducid.startAnimation = function() {     aducid.startAnimation = function() {
         if (qrCode != null) {         if (qrCode != null) {
Line 265: Line 258:
         }         }
     }     }
 +</sxh>
          
-Stop animation+=== Stop animation === 
 +<sxh java>
     aducid.stopRunningAnimation = function() {     aducid.stopRunningAnimation = function() {
         if (qrCode == null) return;         if (qrCode == null) return;
         qrCode.hide();         qrCode.hide();
     }     }
 +</sxh>
 +==== Advanced methods ====
 +=== Init Params ===
 +Method to pass more parameters like transaction amount, description, etc.
 +<sxh java>
 +    aducid.setInitParams = function(param) {
 +        initParams = param;
 +    }
 +</sxh>
  
 +=== Debug DOM to display internal messages ===
 +<sxh java>
 +    aducid.setDebug = function(param) {
 +        aducidDebug = param;
 +    }
 +</sxh>
  
-This method controll progress bar animation. See aducid-api.js +=== Is binding URI? === 
-   this.startProgressBar = function(animationTime) { +<sxh java> 
-   }+    aducid.isURI = function() { 
 +        return instance.getSessionBinding() == "URI"; 
 +    } 
 +</sxh> 
 +     
 +=== Is binding QR? === 
 +<sxh java> 
 +    aducid.isQR = function() { 
 +        return instance.getSessionBinding() == "QR"; 
 +    }
  
 +=== Is this operation going to be authentication (i.e. first operation in chain)? ===
 +<sxh java>
 +    aducid.setAuthentication = function() {
 +        instance.setSessionBinding(null);
 +    }
 +</sxh>
  
-Hide QR timer progress bar +=== Get last binding mode === 
-    aducid.hideProgressBar = function() { +<sxh java> 
-        if (qrTimer == null) return+    aducid.getSessionBinding = function() { 
-        qrTimer.hide(); +        return localStorage['session-binding'];
-        qrTimer.html("");+
     }     }
 +</sxh>
  
-How errors are treated - use nice dialogues here+=== How PEIG not installed is treated, marketplace redirect can be used here === 
 +<sxh java> 
 +    aducid.showPeigError = function() { 
 +        alert("peig error - override this function"
 +    } 
 +</sxh> 
 + 
 +=== How errors are treated - use nice dialogues here === 
 +<sxh java>
     aducid.handleError = function(e) {     aducid.handleError = function(e) {
         alert(e);         alert(e);
     }     }
 +</sxh>
web-integration/client-side.txt · Last modified: 2020/02/29 10:53 by mpospisek