SOAP EMV-CAP authentication wrapper code samples for .NET
  • 06 Dec 2024
  • 2 Minutes à lire
  • Sombre
    Lumière
  • PDF

SOAP EMV-CAP authentication wrapper code samples for .NET

  • Sombre
    Lumière
  • PDF

The content is currently unavailable in French. You are viewing the default English version.
Résumé de l’article

The following code sample shows what you need to include in your webpage 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/ASP.Net/src/SampleSite/authentication 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 - Mode 1 
--%>

<asp:Content ID="Mode1" ContentPlaceHolderID="MainContentHolder" runat="server">
    <% 
        if ("true".Equals(process))
        {
            // EMV-CAP details have been provided, now perform the request
            string userID = Request["EMVCAPFLD_USERID"];
            string domain = Request["EMVCAPFLD_DOMAIN"];
            string challenge = Request["EMVCAPFLD_CHALLENGE"];
            string transactionAmount = Request["EMVCAPFLD_TRANSACTION_AMOUNT"];
            string transactionCurrency = Request["EMVCAPFLD_TRANSACTION_CURRENCY"];
            string secureCode = Request["EMVCAPFLD_SECURECODE"];

            // Execute the command
            results = executeAuthUserEmvCapMode1(domain, userID, challenge, transactionAmount, transactionCurrency, secureCode);

            if (results.getReturnCode() == 0)
            {
                details = results.getResults();
    %>
        <p>EMV-CAP Authentication succeeded</p>
    <% 
            }
        }
    %>
</asp:Content>

This code should be added to the codebehind page (*.asp.cs):

using IdentikeyWrapper.vasco.identikey.model;
using IdentikeyWrapper.vasco.identikey.emvcapauthentication;

namespace IdentikeySampleSite.emvcapGroup
{
    public partial class mode1 : System.Web.UI.Page
    {
        protected EmvCapAuthenticationCommandResponse results;
        protected EmvCapAuthenticationDetails details;
        protected string process;

        protected void Page_Load(object sender, EventArgs e)
        {
            process = Request["process"];
        }

        protected EmvCapAuthenticationCommandResponse executeAuthUserEmvCapMode1(string domain, string userID, string challenge, string transactionAmount, string transactionCurrency, string secureCode)
        {
            EmvCapAuthenticationHandler handler = new EmvCapAuthenticationHandler();
            return handler.authUserEmcCapMode1(domain, userID, challenge, transactionAmount, transactionCurrency, secureCode);
        }
    }
}

Code sample: Mode 2

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

<asp:Content ID="Mode2" ContentPlaceHolderID="MainContentHolder" runat="server">
    <% 
        if ("true".Equals(process))
        {
            // EMV-CAP details have been provided, now perform the request
            string userID = Request["EMVCAPFLD_USERID"];
            string domain = Request["EMVCAPFLD_DOMAIN"];
            string tdsField1 = Request["EMVCAPFLD_TDS_FIELD_1"];
            string tdsField2 = Request["EMVCAPFLD_TDS_FIELD_2"];
            string tdsField3 = Request["EMVCAPFLD_TDS_FIELD_3"];
            string tdsField4 = Request["EMVCAPFLD_TDS_FIELD_4"];
            string tdsField5 = Request["EMVCAPFLD_TDS_FIELD_5"];
            string tdsField6 = Request["EMVCAPFLD_TDS_FIELD_6"];
            string tdsField7 = Request["EMVCAPFLD_TDS_FIELD_7"];
            string tdsField8 = Request["EMVCAPFLD_TDS_FIELD_8"];
            string tdsField9 = Request["EMVCAPFLD_TDS_FIELD_9"];
            string tdsField10 = Request["EMVCAPFLD_TDS_FIELD_10"];
            bool secureCode = Request["EMVCAPFLD_SECURECODE"];

            // Execute the command
            results = executeAuthUserEmvCapMode2(domain, userID, tdsField1, tdsField2, tdsField3, tdsField4, tdsField5, tdsField6, tdsField7, tdsField8, tdsField9, tdsField10, secureCode);

            if (results.getReturnCode() == 0)
            {
                details = results.getResults();
    %>
    <% 
        }
    %>
</asp:Content>

This code should be added to the codebehind page (*.asp.cs):

using IdentikeyWrapper.vasco.identikey.model;
using IdentikeyWrapper.vasco.identikey.emvcapauthentication;

namespace IdentikeySampleSite.emvcapGroup
{
    public partial class mode2 : System.Web.UI.Page
    {
        protected EmvCapAuthenticationCommandResponse results;
        protected EmvCapAuthenticationDetails details;
        protected string process;

        protected void Page_Load(object sender, EventArgs e)
        {
            process = Request["process"];
        }

        protected EmvCapAuthenticationCommandResponse executeAuthUserEmvCapMode2(string domain, string userID, string tdsField1, string tdsField2, string tdsField3, string tdsField4, string tdsField5, string tdsField6, string tdsField7, string tdsField8, string tdsField9, string tdsField10, string secureCode)
        {
            EmvCapAuthenticationHandler handler = new EmvCapAuthenticationHandler();
            return handler.authUserEmcCapMode2(domain, userID, tdsField1, tdsField2, tdsField3, tdsField4, tdsField5, tdsField6, tdsField7, tdsField8, tdsField9, tdsField10, secureCode);
        }
    }
}

Code sample: Mode 3

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

<asp:Content ID="Mode3" ContentPlaceHolderID="MainContentHolder" runat="server">
    <% 
        if ("true".Equals(process))
        {
            // EMV-CAP details have been provided, now perform the request
            string userID = Request["EMVCAPFLD_USERID"];
            string domain = Request["EMVCAPFLD_DOMAIN"];
            string challenge = Request["EMVCAPFLD_CHALLENGE"];
            string secureCode = Request["EMVCAPFLD_SECURECODE"];

            // Execute the command
            results = executeAuthUserEmvCapMode3(domain, userID, challenge, secureCode);

            if (results.getReturnCode() == 0)
            {
                details = results.getResults();
    %>
    <% 
        }
    %>
</asp:Content>

This code should be added to the codebehind page (*.asp.cs):

using IdentikeyWrapper.vasco.identikey.model;
using IdentikeyWrapper.vasco.identikey.emvcapauthentication;

namespace IdentikeySampleSite.emvcapGroup
{
    public partial class mode3 : System.Web.UI.Page
    {
        protected EmvCapAuthenticationCommandResponse results;
        protected EmvCapAuthenticationDetails details;
        protected string process;

        protected void Page_Load(object sender, EventArgs e)
        {
            process = Request["process"];
        }

        protected EmvCapAuthenticationCommandResponse executeAuthUserEmvCapMode3(string domain, string userID, string challenge, string secureCode)
        {
            EmvCapAuthenticationHandler handler = new EmvCapAuthenticationHandler();
            return handler.authUserEmcCapMode3(domain, userID, challenge, secureCode);
        }
    }
}

Cet article vous a-t-il été utile ?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Ozzy, facilitant la découverte de connaissances grâce à l’intelligence conversationnelle