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/05 11:58]
tjotov [Advanced usage]
web-integration:client-side [2019/08/05 12:46]
tjotov [Communication]
Line 126: Line 126:
  
  
-===== Advanced usage =====+===== Detailed description =====
 See also source file "/aducid-resources/js/aducid-api.js" See also source file "/aducid-resources/js/aducid-api.js"
  
-=== Init Params === +==== Communication ==== 
-Method to pass more parameters like transaction amount, description, etc.+=== 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 targeting using jQuery ===+=== Proxy method location ===
 <sxh java> <sxh java>
-    aducid.setQrCode = function(param) { +    aducid.setProxyUrl = function(param) { 
-        qrCode = param;+        proxyUrl = param;
     }     }
 +
 </sxh> </sxh>
  
-=== QR code text 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>
 +    aducid.setRedirectUrl = function(param) {
 +        redirectUrl = param;
 +    }
 +</sxh>
  
-=== Debug DOM to display internal messages ===+=== 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.setDebug = function(param) { +    aducid.setErrorPage = function(param) { 
-        aducidDebug = param;+        errorPage = param;
     }     }
 </sxh> </sxh>
  
-=== Start operation URL === +=== Final action === 
-Tell Web API where your start operation is.+What API should do when operation finishes (not processed on iOS as we use returnUrl directly there)
 <sxh java> <sxh java>
-    aducid.setStartOperationUrl = function(param) { +    aducid.processResult = function(result) { 
-        startOperationUrl = param;+        alert(result);
     }     }
 </sxh> </sxh>
  
-=== Check method location provided by server side controller ===+=== Use push === 
 +Tell Web API if it should use push (QR code was used previously).
 <sxh java> <sxh java>
-    aducid.setResultOperationUrl = function(param) { +    this.setPush = function(param) { 
-        resultOperationUrl = 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> </sxh>
  
- +=== QR code targeting using jQuery ===
-=== Tell AJAX to use GET or POST === +
-POST is used to deliver more data like transaction parameters+
 <sxh java> <sxh java>
-    aducid.setAjaxMethod = function(param) { +    aducid.setQrCode = function(param) { 
-        ajaxMethod = param;+        qrCode = param;
     }     }
 </sxh> </sxh>
  
-=== Redirect URL for iOS typically provided by server side controler ===+=== QR code text hint jQuery ===
 <sxh java> <sxh java>
-    aducid.setRedirectUrl = function(param) { +    aducid.setQrHint = function(param) { 
-        redirectUrl = param;+        qrHint = param;
     }     }
 </sxh> </sxh>
Line 207: Line 224:
     }     }
 </sxh> </sxh>
- +=== Text hint shown before operation started ===
-=== Get last binding mode ===+
 <sxh java> <sxh java>
-    aducid.getSessionBinding = function() { 
-        return localStorage['session-binding']; 
-    } 
-</sxh java> 
- 
-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 268: 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>
  
-How errors are treated - use nice dialogues here+=== Debug DOM to display internal messages === 
 +<sxh java> 
 +    aducid.setDebug = function(param) { 
 +        aducidDebug = param; 
 +    } 
 +</sxh> 
 + 
 +=== Is binding URI? === 
 +<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> 
 + 
 +=== Get last binding mode === 
 +<sxh java> 
 +    aducid.getSessionBinding = function() { 
 +        return localStorage['session-binding']; 
 +    } 
 +</sxh> 
 + 
 +=== 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