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 12:04]
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"
  
 +==== Communication ====
 === Start operation URL === === Start operation URL ===
 Tell Web API where your start operation is. Tell Web API where your start operation is.
Line 152: Line 153:
 </sxh> </sxh>
  
- +=== Tell AJAX to use GET or POST === 
-=== Tell server to generate QR / or not to reduce payload ===+POST is used to deliver more data like transaction parameters
 <sxh java> <sxh java>
-    aducid.setGenerateQr = function(param) { +    aducid.setAjaxMethod = function(param) { 
-        generateQr = param;+        ajaxMethod = param;
     }     }
 </sxh> </sxh>
  
-=== QR code targeting using jQuery ===+=== 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.setQrCode = function(param) { +    aducid.setRedirectUrl = function(param) { 
-        qrCode = param;+        redirectUrl = param;
     }     }
 </sxh> </sxh>
  
-=== QR code text hint jQuery ===+=== 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.setQrHint = function(param) { +    aducid.setErrorPage = function(param) { 
-        qrHint = param;+        errorPage = param;
     }     }
 </sxh> </sxh>
  
- +=== Final action === 
-=== Init Params === +What API should do when operation finishes (not processed on iOS as we use returnUrl directly there)
-Method to pass more parameters like transaction amount, description, etc.+
 <sxh java> <sxh java>
-    aducid.setInitParams = function(param) { +    aducid.processResult = function(result) { 
-        initParams = param;+        alert(result);
     }     }
 </sxh> </sxh>
  
-=== Debug DOM to display internal messages ===+=== Use push === 
 +Tell Web API if it should use push (QR code was used previously).
 <sxh java> <sxh java>
-    aducid.setDebug = function(param) { +    this.setPush = function(param) { 
-        aducidDebug = 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 216: Line 224:
     }     }
 </sxh> </sxh>
- 
- 
-=== Get last binding mode === 
-<sxh java> 
-    aducid.getSessionBinding = function() { 
-        return localStorage['session-binding']; 
-    } 
-</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> 
- 
 === Text hint shown before operation started === === Text hint shown before operation started ===
 <sxh java> <sxh java>
Line 271: Line 250:
     }     }
 </sxh> </sxh>
- 
-=== The most important method === 
-What API should do when operation finishes (not processed on iOS as we use returnUrl directly there) 
-<sxh java> 
-    aducid.processResult = function(result) { 
-        alert(result); 
-    } 
-</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> 
- 
 === Auxiliary method to animate operation in progress === === Auxiliary method to animate operation in progress ===
 <sxh java> <sxh java>
Line 302: Line 265:
         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>
 +
 +=== 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> </sxh>
web-integration/client-side.txt · Last modified: 2020/02/29 10:53 by mpospisek