コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: I-D-X/Sample-Code
        public void cmpi_authenticate(string TransactionIndex, string PAResPayload, string GatewayID, string MerchantUID, string ApplicationUID, string Terminal, int Mode, string Amount, string Currency,
                                      string CardType, string CardNumber, string CardHolder, string CVV, string ExpiryMonth, string ExpiryYear)
        {
            //Sandbox service
            //ws3DSecure_sandbox.Item3DSecure1 authenticateReference = new ws3DSecure_sandbox.Item3DSecure1();

            //Production service
            ws3DSecure.Item3DSecure1 authenticateReference = new ws3DSecure.Item3DSecure1();

            object[] arrResults = authenticateReference.authenticate(
                TransactionIndex,                                                               //MerchantUID
                PAResPayload                                                                    //ApplicationUID
                );

            //Regardless of the result, an authorisation should occur at this stage.
            performAuth(TransactionIndex, GatewayID, MerchantUID, ApplicationUID, Terminal, Mode, Amount, Currency,
                        CardType, CardNumber, CardHolder, CVV, ExpiryMonth, ExpiryYear);
        }
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: I-D-X/Sample-Code
        //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        #region Click_Button_OK

        public void cmpi_lookup(string MerchantUID, string ApplicationUID, int Mode, string CardNumber,
                                string PanExp, string Amount, string UserAgent, string BrowserHeader, string Recurring,
                                string RecurringFrequency, string RecurringEnd, string Installament, string ACSCallbackURL,
                                string GatewayID, string Terminal, string Currency, string CardHolder, string ExpiryMonth, string ExpiryYear,
                                string CVV, string CardType)
        {
            //Sandbox service
            //ws3DSecure_sandbox.Item3DSecure1 lookupReference = new ws3DSecure_sandbox.Item3DSecure1();

            //Production service
            ws3DSecure.Item3DSecure1 lookupReference = new ws3DSecure.Item3DSecure1();


            object[] arrResults = lookupReference.lookup(
                MerchantUID,                                                            //MerchantUID
                ApplicationUID,                                                         //ApplicationUID
                Mode,                                                                   //Mode
                CardNumber,                                                             //PAN
                PanExp,                                                                 //PANExp
                Amount,                                                                 //PurchaseAmount
                UserAgent,                                                              //UserAgent
                BrowserHeader,                                                          //Browser Header
                "OrderNum",                                                             //OrderNum
                "OrderDesc",                                                            //OrderDesc
                Recurring,                                                              //Recurring
                RecurringFrequency,                                                     //RecurringFrequency
                RecurringEnd,                                                           //RecurringEnd
                Installament                                                            //Installment
                );

            System.Boolean authorisationSuccessful = false;
            string         transactionIndex        = "";
            string         Enrolled = "";
            string         ACSUrl   = "";
            string         PAReqMsg = "";

            foreach (string result in arrResults)
            {
                //unpack result array
                int    delimiter   = result.IndexOf("||");
                string resultDefn  = result.Substring(0, delimiter);
                string resultValue = result.Substring(delimiter + 2);

                //if 'result' not -1, authorisation was successful
                if (resultDefn == "Result" && resultValue != "-1")
                {
                    authorisationSuccessful = true;
                }
                if (resultDefn == "TransactionIndex")
                {
                    transactionIndex = resultValue;
                }
                if (resultDefn == "Enrolled")
                {
                    Enrolled = resultValue;
                }

                //A 'Y' will be returned in the $arrResults[2] return parameter. In the case of a 'Y', the card holder needs to be redirected to the ACS. In all otrher cases, an Authorisation can be invoked.
                if (Enrolled.Equals("Y"))
                {
                    if (resultDefn == "ACSUrl")
                    {
                        ACSUrl = resultValue;
                    }
                    if (resultDefn == "PAReqMsg")
                    {
                        PAReqMsg = resultValue;
                    }
                }
            }
            //A 'Y' will be returned in the $arrResults[2] return parameter. In the case of a 'Y', the card holder needs to be redirected to the ACS. In all otrher cases, an Authorisation can be invoked.
            if (Enrolled.Equals("Y"))
            {
                Response.Write("<form name='frmLaunchACS' method='POST' action='" + ACSUrl + "'>");
                Response.Write("<table align='center'  width='50%' style='border:1px solid black;'>");
                Response.Write("<tr>");
                Response.Write("<td align='center' colspan='2' style='background-color:Red; font-size:16px;'><font color='FFFFFF'>Posting data to the Issuer ACS server</font></td>");
                Response.Write("</tr>");
                Response.Write("<tr>");
                Response.Write("<td ><div align='right'>PaReq :</div></td>");
                Response.Write("<td ><textarea cols='50' rows='5' style='width:400' name='PaReq' >" + PAReqMsg + "</textarea></textarea></td>");
                Response.Write("</tr>");
                Response.Write("<tr>");
                Response.Write("<td ><div align='right'>TermUrl :</div></td>");
                Response.Write("<td ><input type='text' style='width:400' name='TermUrl' value='" + ACSCallbackURL + "'/></td>");
                Response.Write("</tr>");
                Response.Write("<tr>");
                Response.Write("<td ><div align='right'>Transaction Index :</div></td>");
                Response.Write("<td ><input type='text' style='width:400' name='MD' value='" + transactionIndex + "'/></td>");
                Response.Write("</tr>");
                Response.Write("<tr>");
                Response.Write("<td colspan='2' align='center'><input type='submit' value='Submit Form' style='width:250' ></td>");
                Response.Write("</tr>");
                Response.Write("</table>");
                Response.Write("</form>");
            }
            else
            {
                performAuth(transactionIndex, GatewayID, MerchantUID, ApplicationUID, Terminal, Mode, Amount, Currency,
                            CardType, CardNumber, CardHolder, CVV, ExpiryMonth, ExpiryYear);
            }
        }