This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
web-integration:client-side [2019/08/05 12:03] tjotov [Advanced usage] |
web-integration:client-side [2020/02/29 10:53] (current) mpospisek [Web Integration API - Example] |
||
|---|---|---|---|
| Line 52: | Line 52: | ||
| ===== Web Integration API - Example ===== | ===== Web Integration API - Example ===== | ||
| - | <code html> | + | <sxh html> |
| <html xmlns=" | <html xmlns=" | ||
| Line 122: | Line 122: | ||
| </ | </ | ||
| - | </code> | + | </sxh> |
| - | ===== Advanced usage ===== | + | ===== Detailed description |
| See also source file "/ | See also source file "/ | ||
| - | === Init Params | + | ==== Communication |
| - | Method to pass more parameters like transaction amount, description, | + | |
| - | <sxh java> | + | |
| - | aducid.setInitParams | + | |
| - | initParams | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | === Tell server to generate QR / or not to reduce payload === | + | |
| - | <sxh java> | + | |
| - | aducid.setGenerateQr = function(param) { | + | |
| - | generateQr = param; | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | === QR code targeting using jQuery === | + | |
| - | <sxh java> | + | |
| - | aducid.setQrCode = function(param) { | + | |
| - | qrCode = param; | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | === QR code text hint jQuery === | + | |
| - | <sxh java> | + | |
| - | aducid.setQrHint = function(param) { | + | |
| - | qrHint = param; | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | === Debug DOM to display internal messages === | + | |
| - | <sxh java> | + | |
| - | aducid.setDebug = function(param) { | + | |
| - | aducidDebug = param; | + | |
| - | } | + | |
| - | </ | + | |
| === Start operation URL === | === Start operation URL === | ||
| Tell Web API where your start operation is. | Tell Web API where your start operation is. | ||
| Line 181: | Line 145: | ||
| </ | </ | ||
| + | === Proxy method location === | ||
| + | <sxh java> | ||
| + | aducid.setProxyUrl = function(param) { | ||
| + | proxyUrl = param; | ||
| + | } | ||
| + | |||
| + | </ | ||
| === Tell AJAX to use GET or POST === | === Tell AJAX to use GET or POST === | ||
| Line 190: | Line 161: | ||
| </ | </ | ||
| - | === Redirect URL for iOS typically provided | + | === 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.setRedirectUrl = function(param) { | aducid.setRedirectUrl = function(param) { | ||
| Line 197: | Line 169: | ||
| </ | </ | ||
| - | === Button bound operation | + | === 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.setButton | + | aducid.setErrorPage |
| - | | + | |
| - | param.click(function() { | + | |
| - | if (currentRequest != null) instance.startOperation(); | + | |
| - | else instance.init(true); | + | |
| - | }); | + | |
| } | } | ||
| </ | </ | ||
| - | + | === Final action | |
| - | === Get last binding mode === | + | What API should do when operation finishes (not processed on iOS as we use returnUrl directly there) |
| <sxh java> | <sxh java> | ||
| - | aducid.getSessionBinding | + | aducid.processResult |
| - | | + | |
| } | } | ||
| </ | </ | ||
| - | === Is binding URI? === | + | === Use push === |
| + | Tell Web API if it should use push (QR code was used previously). | ||
| <sxh java> | <sxh java> | ||
| - | | + | |
| - | | + | |
| } | } | ||
| </ | </ | ||
| - | | + | ==== UI methods ==== |
| - | === Is binding | + | === Tell server to generate |
| <sxh java> | <sxh java> | ||
| - | aducid.isQR = function() { | + | aducid.setGenerateQr |
| - | | + | |
| } | } | ||
| + | </ | ||
| - | === Is this operation going to be authentication (i.e. first operation in chain)? | + | === QR code targeting using jQuery |
| <sxh java> | <sxh java> | ||
| - | aducid.setAuthentication | + | aducid.setQrCode |
| - | | + | |
| } | } | ||
| </ | </ | ||
| + | === QR code text hint jQuery === | ||
| + | <sxh java> | ||
| + | aducid.setQrHint = function(param) { | ||
| + | qrHint = param; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Button bound operation === | ||
| + | <sxh java> | ||
| + | aducid.setButton = function(param) { | ||
| + | aducidButton = param; | ||
| + | param.click(function() { | ||
| + | if (currentRequest != null) instance.startOperation(); | ||
| + | else instance.init(true); | ||
| + | }); | ||
| + | } | ||
| + | </ | ||
| === Text hint shown before operation started === | === Text hint shown before operation started === | ||
| <sxh java> | <sxh java> | ||
| Line 262: | Line 250: | ||
| } | } | ||
| </ | </ | ||
| - | |||
| - | === 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); | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | === How PEIG not installed is treated, marketplace redirect can be used here === | ||
| - | <sxh java> | ||
| - | aducid.showPeigError = function() { | ||
| - | alert(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| === Auxiliary method to animate operation in progress === | === Auxiliary method to animate operation in progress === | ||
| <sxh java> | <sxh java> | ||
| Line 293: | Line 265: | ||
| if (qrCode == null) return; | if (qrCode == null) return; | ||
| qrCode.hide(); | qrCode.hide(); | ||
| + | } | ||
| + | </ | ||
| + | ==== Advanced methods ==== | ||
| + | === Init Params === | ||
| + | Method to pass more parameters like transaction amount, description, | ||
| + | <sxh java> | ||
| + | aducid.setInitParams = function(param) { | ||
| + | initParams = param; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Debug DOM to display internal messages === | ||
| + | <sxh java> | ||
| + | aducid.setDebug = function(param) { | ||
| + | aducidDebug = param; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Is binding URI? === | ||
| + | <sxh java> | ||
| + | aducid.isURI = function() { | ||
| + | return instance.getSessionBinding() == " | ||
| + | } | ||
| + | </ | ||
| + | | ||
| + | === Is binding QR? === | ||
| + | <sxh java> | ||
| + | aducid.isQR = function() { | ||
| + | return instance.getSessionBinding() == " | ||
| + | } | ||
| + | |||
| + | === Is this operation going to be authentication (i.e. first operation in chain)? === | ||
| + | <sxh java> | ||
| + | aducid.setAuthentication = function() { | ||
| + | instance.setSessionBinding(null); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Get last binding mode === | ||
| + | <sxh java> | ||
| + | aducid.getSessionBinding = function() { | ||
| + | return localStorage[' | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === How PEIG not installed is treated, marketplace redirect can be used here === | ||
| + | <sxh java> | ||
| + | aducid.showPeigError = function() { | ||
| + | alert(" | ||
| } | } | ||
| </ | </ | ||