SOAP EMV-CAP Authentication Wrapper Code Samples for Java

Prev Next

The following code samples show what you need to include in your web page if you want to incorporate OneSpan Authentication Server EMV-CAP authentication functionality.

If you want to include other functionality, go to the sdk_install_dir/Java/src/SampleSite/src/main/webapp/jsp/emvcapauthentication folder and use the code from the files in there. All the file names identify the function of the code in the file.

Code sample: Mode 1

<%-- 
EMV-CAP Authentication - EMV-CAP Mode 1 Authentication
--%>

<%@ page import="java.util.Random" %>
<%@ page import="com.vasco.identikey.model.EmvCapAuthenticationDetails" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationCommandResponse" %>

<jsp:useBean id="emvCapAuthenticationBean" class="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationBean" scope="page" />

<%
    if ("true".equalsIgnoreCase(request.getParameter("process"))) {
        // Details have been provided, now perform the request
        String userID = request.getParameter("EMVCAPFLD_USERID");
        String domain = request.getParameter("EMVCAPFLD_DOMAIN");
        String challenge = request.getParameter("EMVCAPFLD_CHALLENGE");
        String transactionAmount = request.getParameter("EMVCAPFLD_TRANSACTION_AMOUNT");
        String transactionCurrency = request.getParameter("EMVCAPFLD_TRANSACTION_CURRENCY");
        String secureCode = request.getParameter("EMVCAPFLD_SECURECODE");

        // Execute the command
        EmvCapAuthenticationCommandResponse results = emvCapAuthenticationBean.authUserEmcCapMode1(
            domain, userID, challenge, transactionAmount, transactionCurrency, secureCode
        );

        if (results.getReturnCode() == 0)
         {
       %>

      <%
        }
%>

Code sample: Mode 2

<%-- 
  EMV-CAP Authentication - EMV-CAP Mode 2 Authentication
--%>

<%@ page import="com.vasco.identikey.model.EmvCapAuthenticationDetails" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationCommandResponse" %>
<jsp:useBean id="emvCapAuthenticationBean" class="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationBean" scope="page" />

<%
  if ("true".equalsIgnoreCase(request.getParameter("process")))
  {
    // Details have been provided, now perform the request
    String userID = request.getParameter("EMVCAPFLD_USERID");
    String domain = request.getParameter("EMVCAPFLD_DOMAIN");
    String tdsField1 = request.getParameter("EMVCAPFLD_TDS_FIELD_1");
    String tdsField2 = request.getParameter("EMVCAPFLD_TDS_FIELD_2");
    String tdsField3 = request.getParameter("EMVCAPFLD_TDS_FIELD_3");
    String tdsField4 = request.getParameter("EMVCAPFLD_TDS_FIELD_4");
    String tdsField5 = request.getParameter("EMVCAPFLD_TDS_FIELD_5");
    String tdsField6 = request.getParameter("EMVCAPFLD_TDS_FIELD_6");
    String tdsField7 = request.getParameter("EMVCAPFLD_TDS_FIELD_7");
    String tdsField8 = request.getParameter("EMVCAPFLD_TDS_FIELD_8");
    String tdsField9 = request.getParameter("EMVCAPFLD_TDS_FIELD_9");
    String tdsField10 = request.getParameter("EMVCAPFLD_TDS_FIELD_10");
    String secureCode = request.getParameter("EMVCAPFLD_SECURECODE");
    // execute the command
    EmvCapAuthenticationCommandResponse results = emvCapAuthenticationBean.authUserEmcCapMode2(domain, userID, tdsField1, tdsField2, tdsField3, tdsField4, tdsField5, tdsField6, tdsField7, tdsField8, tdsField9, tdsField10, secureCode);
    if (results.getReturnCode() == 0)
    {
  %>
<%
    }
%>

Code sample: Mode 3

<%-- 
  Identikey Sample Website - SDK - Copyright VASCO Data Security 2009
  EMV-CAP Authentication - EMV-CAP Mode 3 Authentication
--%>

<%@ page import="java.util.Random" %>
<%@ page import="com.vasco.identikey.model.EmvCapAuthenticationDetails" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationCommandResponse" %>

<jsp:useBean id="emvCapAuthenticationBean" class="com.vasco.identikey.controller.emvcapauthentication.EmvCapAuthenticationBean" scope="page" />

<%
  if ("true".equalsIgnoreCase(request.getParameter("process")))
  {
    // Details have been provided, now perform the request
    String userID = request.getParameter("EMVCAPFLD_USERID");
    String domain = request.getParameter("EMVCAPFLD_DOMAIN");
    String challenge = request.getParameter("EMVCAPFLD_CHALLENGE");
    String secureCode = request.getParameter("EMVCAPFLD_SECURECODE");
    // execute the command
    EmvCapAuthenticationCommandResponse results = emvCapAuthenticationBean.authUserEmcCapMode3(domain, userID, challenge, secureCode);
    if (results.getReturnCode() == 0)
    {
  %>
<%
    }
%>