Пример #1
0
        public Authenticate3dSecure_Result Authenticate3dSecure(Authenticate3dSecure_Details details)
        {
            if (string.IsNullOrWhiteSpace(details.GatewayPayloadRaw) && !string.IsNullOrWhiteSpace(details.GatewayQueryStringRaw))
            {
                details.GatewayPayloadRaw = Uri.UnescapeDataString(details.GatewayQueryStringRaw); //get data from querystring and unescape
            }

            var xml = new XmlDocument();

            xml.LoadXml(details.GatewayPayloadRaw);

            var Token         = xml.SelectSingleNode("/AuthorisationResponse/Reference") ?? xml.SelectSingleNode("/DemandResponse/Reference");
            var UTI           = xml.SelectSingleNode("/AuthorisationResponse/Uti") ?? xml.SelectSingleNode("/DemandResponse/Uti");
            var error_code    = xml.SelectSingleNode("/AuthorisationResponse/ResponseCode") ?? xml.SelectSingleNode("/DemandResponse/ResponseCode");
            var error_message = xml.SelectSingleNode("/AuthorisationResponse/Response") ?? xml.SelectSingleNode("/DemandResponse/Response");
            var ip            = xml.SelectSingleNode("/AuthorisationResponse/CardHolderIpAddr") ?? xml.SelectSingleNode("/DemandResponse/CardHolderIpAddr");

            var threeDSecureEnrolled     = xml.SelectSingleNode("/AuthorisationResponse/threeDsecureEnrolled") ?? xml.SelectSingleNode("/DemandResponse/threeDsecureEnrolled");
            var threeDSecureEci          = xml.SelectSingleNode("/AuthorisationResponse/threeDsecureEci") ?? xml.SelectSingleNode("/DemandResponse/threeDsecureEci");
            var threeDSecureXid          = xml.SelectSingleNode("/AuthorisationResponse/threeDsecureXid") ?? xml.SelectSingleNode("/DemandResponse/threeDsecureXid");
            var threeDSecureCavv         = xml.SelectSingleNode("/AuthorisationResponse/threeDsecureCavv") ?? xml.SelectSingleNode("/DemandResponse/threeDsecureCavv");
            var RetrievalReferenceNumber = xml.SelectSingleNode("/AuthorisationResponse/RetrievalReferenceNumber") ?? xml.SelectSingleNode("/DemandResponse/RetrievalReferenceNumber");

            var m_1 = xml.SelectSingleNode("/AuthorisationResponse/m_1") ?? xml.SelectSingleNode("/DemandResponse/m_1");
            var m_2 = xml.SelectSingleNode("/AuthorisationResponse/m_2") ?? xml.SelectSingleNode("/DemandResponse/m_2");
            var m_3 = xml.SelectSingleNode("/AuthorisationResponse/m_3") ?? xml.SelectSingleNode("/DemandResponse/m_3");
            var m_4 = xml.SelectSingleNode("/AuthorisationResponse/m_4") ?? xml.SelectSingleNode("/DemandResponse/m_4");
            var m_5 = xml.SelectSingleNode("/AuthorisationResponse/m_5") ?? xml.SelectSingleNode("/DemandResponse/m_5");
            var m_6 = xml.SelectSingleNode("/AuthorisationResponse/m_6") ?? xml.SelectSingleNode("/DemandResponse/m_6");

            return(new Authenticate3dSecure_Result
            {
                isSuccess = error_message.InnerText.Contains("APPROVED") && !error_message.InnerText.Contains("NOT"),
                isEnrolled = threeDSecureEnrolled.InnerText != "U",
                isNotSupported = threeDSecureEnrolled.InnerText == "N",
                ErrorCode = error_code.InnerText,
                ErrorMessage = error_message.InnerText,
                CardToken = Token.InnerText,
                TransactionIdentifier = UTI.InnerText,
                IPAddress = ip.InnerText,
                EnrollmentStatus = threeDSecureEnrolled.InnerText,
                ThreeDSecureEci = threeDSecureEci.InnerText,
                ThreeDSecureXid = threeDSecureXid.InnerText,
                ThreeDSecureCavv = threeDSecureCavv.InnerText,
                RetrievalReferenceNumber = RetrievalReferenceNumber.InnerText,
                CustomResponse = "<CallbackResponse>Accepted</CallbackResponse>",
                TransactionToken = m_1.InnerText,
                ExternalIdentifier1 = m_2.InnerText,
                ExternalIdentifier2 = m_3.InnerText,
                ExternalIdentifier3 = m_4.InnerText,
                ExternalIdentifier4 = m_5.InnerText,
                ExternalIdentifier5 = m_6.InnerText,
                FullResult = details.GatewayPayloadRaw
            });
        }
Пример #2
0
 public Authenticate3dSecure_Result Authenticate3dSecure(Authenticate3dSecure_Details details)
 {
     throw new NotImplementedException();
 }