/// <summary>
        /// Method created to consume the service "recordAutoPayEnrollmentStatus" to save the updated credit card details.
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        private recordAutoPayEnrollmentStatusRequest CreateStatusRequest(string token)
        {
            recordAutoPayEnrollmentStatusRequest statusRequest = new recordAutoPayEnrollmentStatusRequest();

            statusRequest.applicationContext             = new ApplicationContext();
            statusRequest.applicationContext.application = Config.Setting(CSAAWeb.Constants.PC_ApplicationContext_Payment_Tool);
            statusRequest.applicationContext.address     = CSAAWeb.AppLogger.Logger.GetIPAddress();
            statusRequest.userId     = HttpContext.Current.User.Identity.Name;
            statusRequest.policyInfo = new PolicyProductSource();
            statusRequest.policyInfo.policyNumber = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).PolicyNumber;
            statusRequest.policyInfo.type         = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ProductType_PC;
            //MAIG - CH10 - BEGIN -  Logic added to pass the datasourec for all policies and set the Blaze rules for valid policy
            if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow == null))
            {
                statusRequest.enrollmentEffectiveDateSpecified = true;
                statusRequest.enrollmentEffectiveDate          = Convert.ToDateTime(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Modifyenrollment[2]);
                statusRequest.enrollmentReasonCode             = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Modifyenrollment[3];
            }

            // Included MAIG Iteration2 - start

            /*if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidPolicyFlow == null) && (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow == null))
             * {
             *  statusRequest.policyInfo.dataSource = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidPolicySourceSystem;
             * }
             * else
             * {
             *  IssueDirectPaymentWrapper wrap = new IssueDirectPaymentWrapper();
             *  statusRequest.policyInfo.dataSource = wrap.DataSource(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ProductType_PT, statusRequest.policyInfo.policyNumber.Length);
             * }*/
            statusRequest.policyInfo.dataSource = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidPolicySourceSystem;
            //MAIG - CH10 - END -  Logic added to pass the datasourec for all policies and set the Blaze rules for valid policy

            statusRequest.paymentItem = new PaymentItemHeader();
            statusRequest.paymentItem.paymentMethod       = Config.Setting(CSAAWeb.Constants.PC_CreditCard_Code);
            statusRequest.paymentItem.paymentAccountToken = token;
            statusRequest.paymentItem.card        = new PaymentCard();
            statusRequest.paymentItem.card.number = lblCardNumberLast4Digit.Text.Substring(12);
            statusRequest.paymentItem.card.isCardPresentSpecified  = true;
            statusRequest.paymentItem.card.isCardPresent           = true;
            statusRequest.paymentItem.card.expirationDateSpecified = true;
            statusRequest.paymentItem.card.expirationDate          = Convert.ToDateTime(_ExpireMonth.SelectedValue + "-" + _ExpireYear.SelectedValue);
            statusRequest.paymentItem.card.printedName             = _Name.Text;
            statusRequest.paymentItem.card.type = hdnCardType.Value.ToString();

            //MAIG - CH11 - BEGIN -  Adding Email ID value to the REQUEST
            if (!(string.IsNullOrEmpty(_txtEmailAddress.Text.ToString())))
            {
                statusRequest.emailTo = _txtEmailAddress.Text.ToString().Trim();
            }
            //MAIG - CH11 - END -  Adding Email ID value to the REQUEST

            Logger.Log(Constants.PC_LOG_REQ_SENT + statusRequest.policyInfo.policyNumber);
            return(statusRequest);
        }
示例#2
0
        public List <string> PCEnrollService(recordAutoPayEnrollmentStatusRequest EnrollRequest)
        {
            List <string> resp_List = new List <string>();
            DataSet       ds        = new DataSet();
            string        DO        = string.Empty;
            bool          Errflag   = false;
            RecordAutoPayEnrollmentStatusRequest1  ReqObj     = new RecordAutoPayEnrollmentStatusRequest1();
            recordAutoPayEnrollmentStatusResponse  EnrollResp = new recordAutoPayEnrollmentStatusResponse();
            RecordAutoPayEnrollmentStatusResponse1 RespObj    = new RecordAutoPayEnrollmentStatusResponse1();

            AuthenticationClasses.WebService.Authentication authObj = new AuthenticationClasses.WebService.Authentication();
            ds = authObj.GetRepIDDO(HttpContext.Current.User.Identity.Name.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                DO = (ds.Tables[0].Rows[0]["DO ID"].ToString()).Trim();
            }
            try
            {
                RecordAutoPayEnrollmentStatus _RecordEnrollProvider = (RecordAutoPayEnrollmentStatusChannel)CreateInstance <RecordAutoPayEnrollmentStatusChannel>("RecordAutoPayEnrollmentStatusSOAPPort");
                if (DO == string.Empty)
                {
                    EnrollRequest.authenticationChannel = Constants.PC_AUTHCH_CC;
                }
                else
                {
                    if (DO.Equals(CSAAWeb.Constants.PC_DO_AUTHIVR))
                    {
                        EnrollRequest.authenticationChannel = Constants.PC_AUTHCH_IVR;
                    }
                    else if ((Config.Setting("PC_DO.BO").ToString().IndexOf(DO)) > -1 && DO.Length > 1)
                    {
                        EnrollRequest.authenticationChannel = Constants.PC_AUTHCH_BO;
                    }
                    else if ((Config.Setting("PC_DO.CC").IndexOf(DO)) > -1 && DO.Length > 1)
                    {
                        EnrollRequest.authenticationChannel = Constants.PC_AUTHCH_CC;
                    }
                    else
                    {
                        EnrollRequest.authenticationChannel = Constants.PC_AUTHCH_F2F;
                    }
                }
                ReqObj.recordAutoPayEnrollmentStatusRequest = EnrollRequest;
                if (ReqObj != null && (Config.Setting("Logging.RecordEnrollment") == "1"))
                {
                    System.Xml.Serialization.XmlSerializer serializerReq = new System.Xml.Serialization.XmlSerializer(ReqObj.GetType());
                    StringWriter writerReq = new StringWriter();
                    serializerReq.Serialize(writerReq, ReqObj);
                    Logger.Log("Enrollment request to Payment Central - Record Enrollment Request : \r\n" + writerReq);
                }
                RespObj    = _RecordEnrollProvider.RecordAutoPayEnrollmentStatus(ReqObj);
                EnrollResp = RespObj.recordAutoPayEnrollmentStatusResponse;
                if (EnrollResp != null)
                {
                    string Trnxid = string.Empty;
                    if (EnrollResp.status.ToUpper() == CSAAWeb.Constants.PC_SUCESS.ToUpper())
                    {
                        resp_List.Add(EnrollResp.status.ToUpper());
                        resp_List.Add(EnrollResp.receiptNumber);
                        //return resp_List;
                    }
                }
                if (EnrollResp != null && (Config.Setting("Logging.RecordEnrollment") == "1"))
                {
                    System.Xml.Serialization.XmlSerializer serializerRes = new System.Xml.Serialization.XmlSerializer(EnrollResp.GetType());
                    StringWriter writerRes = new StringWriter();
                    serializerRes.Serialize(writerRes, EnrollResp);
                    Logger.Log("Enrollment Response from Payment Central - Record Enrollment Response : \r\n" + writerRes);
                }
                else
                {
                    if (EnrollResp == null)
                    {
                        Logger.Log("Enrollment Response is NULL");
                    }
                }
                // PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
            }
            catch (FaultException <RecordEnrollment.ErrorInfo> faultExpErrorInfo)
            {
                if (Config.Setting("Logging.RecordEnrollment") == "1")
                {
                    if (EnrollResp != null)
                    {
                        System.Xml.Serialization.XmlSerializer serializerRes = new System.Xml.Serialization.XmlSerializer(EnrollResp.GetType());
                        StringWriter writerRes = new StringWriter();
                        serializerRes.Serialize(writerRes, EnrollResp);
                        Logger.Log("Enrollment Response from Payment Central - Record Enrollment Response : \r\n" + writerRes);
                    }
                }
                if (faultExpErrorInfo.Detail != null)
                {
                    Logger.Log(faultExpErrorInfo.Detail.errorMessageText);
                    resp_List.Add(faultExpErrorInfo.Detail.errorCode);
                    resp_List.Add(faultExpErrorInfo.Detail.errorMessageText);
                }
                Errflag = true;
                return(resp_List);
            }
            catch (FaultException faultExp)
            {
                string errFriendlyMsg = "", errMsg = "", errCode = "", appendErrMsg = "";
                //PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
                if (Config.Setting("Logging.RecordEnrollment") == "1")
                {
                    if (EnrollResp != null)
                    {
                        System.Xml.Serialization.XmlSerializer serializerRes = new System.Xml.Serialization.XmlSerializer(EnrollResp.GetType());
                        StringWriter writerRes = new StringWriter();
                        serializerRes.Serialize(writerRes, EnrollResp);
                        Logger.Log("Enrollment Response from Payment Central - Record Enrollment Response : \r\n" + writerRes);
                    }
                }
                //PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
                FaultException <RecordEnrollment.www.aaancnuit.com.aaancnu_common_version2.ErrorInfo> errInfo = (FaultException <RecordEnrollment.www.aaancnuit.com.aaancnu_common_version2.ErrorInfo>)faultExp;
                if (errInfo.Detail != null)
                {
                    foreach (XmlNode node in errInfo.Detail.Nodes)
                    {
                        if (node.Name.Contains(CSAAWeb.Constants.PC_ERR_NODE_FRIENDLY_ERROR_MSG))
                        {
                            errFriendlyMsg = node.InnerText;
                        }
                        if (node.Name.Contains(CSAAWeb.Constants.PC_ERR_NODE_ERROR_MSG_TEXT))
                        {
                            errMsg = node.InnerText;
                        }
                        if (node.Name.Contains(CSAAWeb.Constants.PC_ERR_NODE_ERROR_CODE))
                        {
                            errCode = node.InnerText;
                        }
                    }
                }
                if (errCode == CSAAWeb.Constants.ERR_CODE_BUSINESS_EXCEPTION)
                {
                    appendErrMsg = CSAAWeb.Constants.PC_ERR_BUSINESS_EXCEPTION_ENROLL + CSAAWeb.Constants.ERR_CODE_BUSINESS_EXCEPTION + "-" + errMsg;
                }
                else
                {
                    appendErrMsg = errCode + "-" + CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION;
                }
                Logger.Log(errCode + " " + appendErrMsg);
                resp_List.Add(errCode);
                resp_List.Add(appendErrMsg);
                Errflag = true;
                return(resp_List);
            }
            catch (SoapException soapExp)
            {
                //PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
                if (Config.Setting("Logging.RecordEnrollment") == "1")
                {
                    if (EnrollResp != null)
                    {
                        System.Xml.Serialization.XmlSerializer serializerRes = new System.Xml.Serialization.XmlSerializer(EnrollResp.GetType());
                        StringWriter writerRes = new StringWriter();
                        serializerRes.Serialize(writerRes, EnrollResp);
                        Logger.Log("Enrollment Response from Payment Central - Record Enrollment Response : \r\n" + writerRes);
                    }
                }
                //PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
                if (soapExp.Message != null)
                {
                    Logger.Log(soapExp.Message);
                    resp_List.Add(soapExp.Code.ToString());
                    resp_List.Add(CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION);
                }
                Errflag = true;
                return(resp_List);
            }
            catch (Exception exp)
            {
                //PC Phase II 4/20 - Added condition such that based on config entry the response is getting logged in log file.
                if (Config.Setting("Logging.RecordEnrollment") == "1")
                {
                    if (EnrollResp != null)
                    {
                        System.Xml.Serialization.XmlSerializer serializerRes = new System.Xml.Serialization.XmlSerializer(EnrollResp.GetType());
                        StringWriter writerRes = new StringWriter();
                        serializerRes.Serialize(writerRes, EnrollResp);
                        Logger.Log("Enrollment Response from Payment Central - Record Enrollment Response : \r\n" + writerRes);
                    }
                }
                if (exp.Message != null)
                {
                    Logger.Log(exp.Message);
                    resp_List.Add("");
                    resp_List.Add(CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION);
                }
                Errflag = true;
                return(resp_List);
            }
            return(resp_List);
        }