コード例 #1
0
        public void IovationSubmit(ref int intProcessSerialId, string strProcessId, string strIPAddress, LoginInfo info)
        {
            var iovationObj = new IovationModel(info.Username);

            if (string.Compare(iovationObj.ServiceEnabled, "true", true) != 0)
            {
                return;
            }

            iovationObj.ProcessRemark =
                string.Format(
                    "CheckTransactionURL: {0} | GetEvidenceURL: {1} | AccountPrefix: {2} | SubscriberID: {3} | SubscriberAccount: {4} | SubscriberPassCode: {5} | UserAccountCode : {6}",
                    iovationObj.CheckTransactionUrl, iovationObj.GetEvidenceUrl, iovationObj.AccountPrefix,
                    iovationObj.SubscriberID, iovationObj.SubscriberAccount, iovationObj.SubscriberPassCode,
                    iovationObj.UserAccountCode);

            try
            {
                using (var ioInstance = new CheckTransactionDetailsService(iovationObj.CheckTransactionUrl))
                {
                    var ioRequest = new CheckTransactionDetails
                    {
                        accountcode        = iovationObj.UserAccountCode,
                        enduserip          = strIPAddress,
                        beginblackbox      = info.ioBlackBox,
                        subscriberid       = iovationObj.SubscriberID,
                        subscriberpasscode = iovationObj.SubscriberPassCode,
                        subscriberaccount  = iovationObj.SubscriberAccount,
                        type = info.PageName
                    };

                    var ioResponse = new CheckTransactionDetailsResponse();

                    ioResponse = ioInstance.CheckTransactionDetails(ioRequest);

                    #region setIovationCookie
                    var cookie = new HttpCookie(info.Username);
                    cookie.Value = ioResponse.result;
                    if (!string.IsNullOrEmpty(commonIp.DomainName))
                    {
                        cookie.Domain = commonIp.DomainName;
                    }
                    cookie.Expires = System.DateTime.Now.AddDays(Convert.ToInt32(iovationObj.ServiceDays));
                    HttpContext.Current.Response.Cookies.Add(cookie);
                    #endregion
                }
            }
            catch (Exception ex)
            {
                iovationObj.ResultCode   = "31";
                iovationObj.ResultDetail = "Error:Iovation";
                iovationObj.ErrorCode    = Convert.ToString(ex.HResult);
                iovationObj.ErrorDetail  = ex.Message;

                iovationObj.isSystemError = true;
            }


            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", info.PageName, "Iovation", "DataBaseManager.DLL", iovationObj.ResultCode, iovationObj.ResultDetail, iovationObj.ErrorCode, iovationObj.ErrorDetail, iovationObj.ProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, iovationObj.isSystemError);
        }
コード例 #2
0
    protected void IovationSubmit(ref int intProcessSerialId, string strProcessId, string strPageName, string strUsername, string strIPAddress, string strPermission)
    {
        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isSystemError    = false;

        customConfig.IovationSettings ioSettings = new customConfig.IovationSettings("W88");
        string strCheckTransactionUrl            = ioSettings.Values.Get("CheckTransactionUrl");
        string strGetEvidenceUrl     = ioSettings.Values.Get("GetEvidenceUrl");
        string strAccountPrefix      = ioSettings.Values.Get("AccountPrefix");
        string strSubscriberID       = ioSettings.Values.Get("SubscriberId");
        string strSubscriberAccount  = ioSettings.Values.Get("SubscriberAccount");
        string strSubscriberPassCode = ioSettings.Values.Get("SubscriberPassCode");
        string strServiceEnabled     = ioSettings.Values.Get("ServiceEnabled");
        string strUserAccountCode    = string.Format("{0}{1}", strAccountPrefix, strUsername);
        string strExceptions         = ioSettings.Values.Get("Exceptions");

        List <string> lstPermission = strExceptions.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();

        if (lstPermission.FindIndex(x => x.Trim().Equals(strPermission, StringComparison.OrdinalIgnoreCase)) >= 0)
        {
            return;
        }
        else if (string.Compare(strServiceEnabled, "true", true) != 0)
        {
            return;
        }

        strProcessRemark = string.Format("CheckTransactionURL: {0} | GetEvidenceURL: {1} | AccountPrefix: {2} | SubscriberID: {3} | SubscriberAccount: {4} | SubscriberPassCode: {5} | UserAccountCode : {6}",
                                         strCheckTransactionUrl, strGetEvidenceUrl, strAccountPrefix, strSubscriberID, strSubscriberAccount, strSubscriberPassCode, strUserAccountCode);

        try
        {
            using (CheckTransactionDetailsService ioInstance = new CheckTransactionDetailsService(strCheckTransactionUrl))
            {
                CheckTransactionDetails ioRequest = new CheckTransactionDetails();

                ioRequest.accountcode = strUserAccountCode;
                ioRequest.enduserip   = strIPAddress;

                ioRequest.beginblackbox      = HttpContext.Current.Request.Form.Get("ioBlackBox");
                ioRequest.subscriberid       = strSubscriberID;
                ioRequest.subscriberpasscode = strSubscriberPassCode;
                ioRequest.subscriberaccount  = strSubscriberAccount;
                ioRequest.type = "login";

                CheckTransactionDetailsResponse ioResponse = new CheckTransactionDetailsResponse();

                ioResponse = ioInstance.CheckTransactionDetails(ioRequest);

                #region setIovationCookie
                HttpCookie cookie = new HttpCookie(strUsername);
                cookie.Value = ioResponse.result;
                if (!string.IsNullOrEmpty(commonIp.DomainName))
                {
                    cookie.Domain = commonIp.DomainName;
                }
                cookie.Expires = System.DateTime.Now.AddDays(Convert.ToInt32(ioSettings.Values.Get("ServiceDays")));
                HttpContext.Current.Response.Cookies.Add(cookie);
                #endregion
            }
        }
        catch (Exception ex)
        {
            strResultCode   = "31";
            strResultDetail = "Error:Iovation";
            strErrorCode    = Convert.ToString(ex.HResult);
            strErrorDetail  = ex.Message;

            isSystemError = true;
        }


        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "Iovation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
    }
コード例 #3
0
        public CheckTransactionDetailsResponse CheckTransactionDetails(IovationCheckModel model)
        {
            model.MobilePhoneNumber = string.IsNullOrEmpty(model.MobilePhoneNumber) ? "" : "+44" + model.MobilePhoneNumber.Substring(1);

            var properties = new List <CheckTransactionDetailsProperty> {
                new CheckTransactionDetailsProperty {
                    name  = "Email",
                    value = model.Email
                },
                new CheckTransactionDetailsProperty {
                    name  = "MobilePhoneNumber",
                    value = model.MobilePhoneNumber
                },
                new CheckTransactionDetailsProperty {
                    name  = "mobilePhoneSmsEnabled",
                    value = model.mobilePhoneSmsEnabled ? "1" : "0"
                },
                new CheckTransactionDetailsProperty {
                    name  = "mobilePhoneVerified",
                    value = model.mobilePhoneVerified ? "1" : "0"
                },
                new CheckTransactionDetailsProperty {
                    name  = "eventId",
                    value = model.Origin
                }
            };

            if (model.MoreData != null)
            {
                model.MoreData.HomePhoneNumber = string.IsNullOrEmpty(model.MoreData.HomePhoneNumber) ? "" : "+44" + model.MoreData.HomePhoneNumber.Substring(1);

                string countryCode = "";
                switch (model.MoreData.BillingCountry)
                {
                case "England":
                case "UK":
                case "Scotland":
                case "Northern Ireland":
                case "United Kingdom":
                    countryCode = "GB";
                    break;
                }

                var moreProperties = new List <CheckTransactionDetailsProperty> {
                    new CheckTransactionDetailsProperty {
                        name  = "firstName",
                        value = model.MoreData.FirstName
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "lastName",
                        value = model.MoreData.LastName
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "BillingCity",
                        value = model.MoreData.BillingCity
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "BillingCountry",
                        value = countryCode
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "BillingPostalCode",
                        value = model.MoreData.BillingPostalCode
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "BillingStreet",
                        value = model.MoreData.BillingStreet
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "emailVerified",
                        value = model.MoreData.EmailVerified ? "1" : "0"
                    },
                    new CheckTransactionDetailsProperty {
                        name  = "HomePhoneNumber",
                        value = model.MoreData.HomePhoneNumber
                    }
                };

                properties.AddRange(moreProperties);
            }

            IovationCheckTransactionDetailsNS.CheckTransactionDetails request = new CheckTransactionDetails {
                subscriberaccount  = this.subscriberAccount,
                subscriberid       = this.subscriberId,
                subscriberpasscode = this.subscriberPasscode,

                accountcode    = model.AccountCode,
                beginblackbox  = model.BeginBlackBox,
                enduserip      = model.EndUserIp,
                txn_properties = properties.ToArray(),
                type           = model.Type
            };



            try {
                CheckTransactionDetailsResponse response = this.checkTransactionDetailsClient.CheckTransactionDetails(request);
                this.Log.InfoFormat("CheckTransactionDetails result: {0}", response.result);
                return(response);
            } catch (Exception ex) {
                this.Log.ErrorFormat("CheckTransactionDetails failed:\n {0}", ex);
                return(new CheckTransactionDetailsResponse()
                {
                    reason = "Exception: " + ex.Message,
                    result = "U"
                });
            }
        }