diff --git a/examples/doc-scan/src/main/java/com/yoti/docscan/demo/controller/DocScanController.java b/examples/doc-scan/src/main/java/com/yoti/docscan/demo/controller/DocScanController.java index 0f7096dc..adc512f5 100644 --- a/examples/doc-scan/src/main/java/com/yoti/docscan/demo/controller/DocScanController.java +++ b/examples/doc-scan/src/main/java/com/yoti/docscan/demo/controller/DocScanController.java @@ -1,11 +1,14 @@ package com.yoti.docscan.demo.controller; +import java.util.List; + import javax.servlet.http.HttpSession; import com.yoti.api.client.Media; import com.yoti.api.client.docs.DocScanClient; import com.yoti.api.client.docs.DocScanException; import com.yoti.api.client.docs.session.create.CreateSessionResult; +import com.yoti.api.client.docs.session.devicemetadata.MetadataResponse; import com.yoti.api.client.docs.session.retrieve.GetSessionResult; import com.yoti.docscan.demo.service.DocScanService; @@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -68,8 +72,13 @@ public String getIndex(final Model model, HttpSession httpSession) { } @RequestMapping(value = "/success", method = RequestMethod.GET) - public String getUserSession(final Model model, HttpSession httpSession) { - String sessionId = (String) httpSession.getAttribute(DOC_SCAN_SESSION_ID); + public String getUserSession(@RequestParam(value = "sessionId") String sessionIdQueryParam, final Model model, HttpSession httpSession) { + String sessionId; + if (sessionIdQueryParam != null) { + sessionId = sessionIdQueryParam; + } else { + sessionId = (String) httpSession.getAttribute(DOC_SCAN_SESSION_ID); + } if (sessionId == null || sessionId.equals("")) { return "redirect:/"; @@ -117,6 +126,11 @@ public ResponseEntity getMedia( return new ResponseEntity<>(media.getContent(), headers, HttpStatus.OK); } + @RequestMapping(value = "/tracked-devices", method = RequestMethod.GET) + public @ResponseBody List getTrackedDevices(@RequestParam(value = "sessionId") String sessionId) throws DocScanException { + return docScanService.getTrackedDevices(sessionId); + } + @RequestMapping(value = "/privacy-policy", method = RequestMethod.GET) public String showPrivacyPolicyPage() { return "privacy"; diff --git a/examples/doc-scan/src/main/java/com/yoti/docscan/demo/service/DocScanService.java b/examples/doc-scan/src/main/java/com/yoti/docscan/demo/service/DocScanService.java index 4538f907..233f0218 100644 --- a/examples/doc-scan/src/main/java/com/yoti/docscan/demo/service/DocScanService.java +++ b/examples/doc-scan/src/main/java/com/yoti/docscan/demo/service/DocScanService.java @@ -1,6 +1,7 @@ package com.yoti.docscan.demo.service; import java.util.Arrays; +import java.util.List; import com.yoti.api.client.Media; import com.yoti.api.client.docs.DocScanClient; @@ -22,6 +23,7 @@ import com.yoti.api.client.docs.session.create.objective.ProofOfAddressObjective; import com.yoti.api.client.docs.session.create.task.RequestedIdDocTextExtractionTask; import com.yoti.api.client.docs.session.create.task.RequestedSupplementaryDocTextExtractionTask; +import com.yoti.api.client.docs.session.devicemetadata.MetadataResponse; import com.yoti.api.client.docs.session.retrieve.GetSessionResult; import com.yoti.api.client.spi.remote.call.YotiConstants; @@ -148,4 +150,8 @@ public String getIframeUrl(CreateSessionResult createSessionResult) { public Media getMedia(String sessionId, String mediaId) throws DocScanException { return docScanClient.getMediaContent(sessionId, mediaId); } + + public List getTrackedDevices(String sessionId) throws DocScanException { + return docScanClient.getTrackedDevices(sessionId); + } } diff --git a/examples/doc-scan/src/main/resources/templates/success.html b/examples/doc-scan/src/main/resources/templates/success.html index 1eab041d..1d85831f 100644 --- a/examples/doc-scan/src/main/resources/templates/success.html +++ b/examples/doc-scan/src/main/resources/templates/success.html @@ -446,6 +446,40 @@
Media
+ +
+
+

+ +

+
+
+
+ +
Media
+ + + + + + + +
ID + + +
+
+
+
+
+
@@ -1010,6 +1044,17 @@

+
+
+

+ Tracked Devices + + + + +

+
+