/// <summary> /// Method created to consume the service "recordAutoPayEnrollmentStatus" to save the updated credit card details. /// CHG0112662 - Record Payment Enrollment SOA Service changes - Added this method /// </summary> /// <param name="token"></param> /// <returns></returns> private RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest CreatePaymentStatusRequest(string token) { RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest statusRequest = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest(); statusRequest.applicationContext = new RecordPaymentEnrollment.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 RecordPaymentEnrollment.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 RecordPaymentEnrollment.PaymentItemHeader(); statusRequest.paymentItem.paymentMethod = Config.Setting(CSAAWeb.Constants.PC_CreditCard_Code); statusRequest.paymentItem.paymentAccountToken = token; statusRequest.paymentItem.card = new RecordPaymentEnrollment.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); }
//MAIG - CH1 - END - Adding region which contains un-used code /// <summary> /// Get the details for Email content /// </summary> private void CreateRequestAndGetResponse(Boolean result, string status) { if (result) { List <string> response = new List <string>(); //MAIG - CH2 - BEGIN - Adding variable and set the value based on the entered poicy is valid or invalid string invalidUnEnrollFlow = string.Empty; if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow) != null) { invalidUnEnrollFlow = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow; } // Included MAIG Iteration2 - start - for getting the UserInfo details //OrderClasses.Service.Order authUserObj = new OrderClasses.Service.Order(); //UserInfo userInfoObj = new UserInfo(); //userInfoObj = authUserObj.Authenticate(HttpContext.Current.User.Identity.Name, string.Empty, CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL); // Included MAIG Iteration2 - end - for getting the UserInfo details //MAIG - CH2 - END - Adding variable and set the value based on the entered poicy is valid or invalid PCEnrollmentMapping pCEnroll = new PCEnrollmentMapping(); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest statusRequest = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest(); statusRequest.applicationContext = new RecordPaymentEnrollment.ApplicationContext(); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request 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; //MAIG - CH3 - BEGIN - Logic added to pass the Blaze rule if it is an valid flow if (!(invalidUnEnrollFlow.Equals("True"))) { statusRequest.enrollmentEffectiveDateSpecified = true; statusRequest.enrollmentEffectiveDate = Convert.ToDateTime(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[2]); statusRequest.enrollmentReasonCode = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[3]; } //MAIG - CH3 - END - Logic added to pass the Blaze rule if it is an valid flow //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.policyInfo = new RecordPaymentEnrollment.PolicyProductSource(); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.policyInfo.policyNumber = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).PolicyNumber; statusRequest.policyInfo.type = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ProductType_PC; //MAIG - CH4 - BEGIN - Including Agent ID, Agency ID & SourceSystem to the Enrollment Request if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID) || ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString().Equals("0")) { statusRequest.agency = string.Empty; } else { statusRequest.agency = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString(); } //////if (string.IsNullOrEmpty(userInfoObj.RepId.ToString()) || userInfoObj.RepId.ToString().Equals("0")) ////// statusRequest.agentIdentifier = string.Empty; //////else ////// statusRequest.agentIdentifier = userInfoObj.RepId.ToString(); if (this.Page.User.Identity.Name.Length > 9) { statusRequest.agentIdentifier = Convert.ToString(this.Page.User.Identity.Name).Substring(1); } else if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID) || !((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID.ToString().Equals("0")) { statusRequest.agentIdentifier = Convert.ToString(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID); } else { statusRequest.agentIdentifier = null; } /*if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidPolicyFlow == null) && (!(invalidUnEnrollFlow.Equals("True")))) * { * 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 - CH4 - END - Including Agent ID, Agency ID & SourceSystem to the Enrollment Request //MAIG - CH5 - BEGIN - Condition added to check if it is an valid policy number if (!(invalidUnEnrollFlow.Equals("True"))) { //MAIG - CH5 - END - Condition added to check if it is an valid policy number //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.paymentItem = new RecordPaymentEnrollment.PaymentItemHeader(); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1].Equals(CSAAWeb.Constants.PC_YES_NOTATION) || ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1].Equals(string.Empty)) { if (paymentType.Equals(CSAAWeb.Constants.PC_Payment_CC)) { statusRequest.paymentItem.paymentMethod = Config.Setting(CSAAWeb.Constants.PC_CreditCard_Code); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.paymentItem.card = new RecordPaymentEnrollment.PaymentCard(); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.paymentItem.card.number = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._CCNumber; statusRequest.paymentItem.card.type = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._CCType; } else { statusRequest.paymentItem.paymentMethod = Config.Setting(CSAAWeb.Constants.PC_ElectronicFund_Code); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.paymentItem.account = new RecordPaymentEnrollment.PaymentAccount(); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace statusRequest.paymentItem.account.accountNumber = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ECAccountNo; statusRequest.paymentItem.account.type = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ECaacType; } //MAIG - CH6 - BEGIN - Adding Email ID value to the REQUEST if (!string.IsNullOrEmpty(TextBoxValue)) { statusRequest.emailTo = TextBoxValue.ToString(); } //MAIG - CH6 - END - Adding Email ID value to the REQUEST Logger.Log("Request sent to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the new service method response = pCEnroll.PCPaymentEnrollService(statusRequest); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the new service method if (response != null) { if (response[0].ToString().ToUpper().Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper())) { Logger.Log("Success Response to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber); //MAIG - CH7 - BEGIN - Disabling the PT Email trigger ////if (status.Equals(CSAAWeb.Constants.PC_SUCESS) && !string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, status); ////} //MAIG - CH7 - END - Disabling the PT Email trigger Context.Items.Add(Constants.PC_VLD_UNENROLL, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment); Server.Transfer(CSAAWeb.Constants.PC_UNENROLL_CONFIRM_PATH, false); } else { Logger.Log(Constants.PC_LOG_EMAIL_POPUP + statusRequest.policyInfo.policyNumber); //MAIG - CH12 - BEGIN - Modified code to display the Error Code only once //lblError.Text = response[1].ToString() + " (" + response[0].ToString() + ")"; lblError.Text = response[1].ToString(); //MAIG - CH12 - END - Modified code to display the Error Code only once content.Visible = false; lblError.Visible = false; Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG); if (Error != null) { Error.Visible = true; Error.Text = lblError.Text; } Logger.Log(lblError.Text.ToString()); //MAIG - CH8 - BEGIN - Disabling the PT Email trigger ////if (!string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL); ////} //MAIG - CH8 - END - Disabling the PT Email trigger } } else { Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG); content.Visible = false; if (Error != null) { Error.Visible = true; Error.Text = lblError.Text; } Logger.Log(lblError.Text.ToString()); //MAIG - CH9 - BEGIN - Disabling the PT Email trigger ////if (!string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL); ////} //MAIG - CH9 - END - Disabling the PT Email trigger } } else { content.Visible = false; if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1]).ToString().Equals("N")) { lblError.Text = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[0]; } Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG); if (Error != null) { Error.Visible = true; Error.Text = lblError.Text; } Logger.Log(lblError.Text.ToString()); //MAIG - CH10 - BEGIN - Disabling the PT Email trigger ////if (!string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL); ////} //MAIG - CH10 - END - Disabling the PT Email trigger } } else { //MAIG - CH11 - BEGIN - Disabling the PT Email trigger and set the Email ID value to PC Request if (!string.IsNullOrEmpty(TextBoxValue)) { statusRequest.emailTo = TextBoxValue.ToString(); } Logger.Log("Request sent to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the new service method response = pCEnroll.PCPaymentEnrollService(statusRequest); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the new service method if (response != null) { if (response[0].ToString().ToUpper().Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper())) { Logger.Log("Success Response to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber); ////if (status.Equals(CSAAWeb.Constants.PC_SUCESS) && !string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, status); ////} //////Context.Items.Add(Constants.PC_VLD_UNENROLL, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment); Server.Transfer(CSAAWeb.Constants.PC_UNENROLL_CONFIRM_PATH, false); } else { Logger.Log(Constants.PC_LOG_EMAIL_POPUP + statusRequest.policyInfo.policyNumber); //MAIG - CH13 - BEGIN - Modified code to display the Error Code only once //lblError.Text = response[1].ToString() + " (" + response[0].ToString() + ")"; lblError.Text = response[1].ToString(); //MAIG - CH13 - END - Modified code to display the Error Code only once content.Visible = false; lblError.Visible = false; Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG); if (Error != null) { Error.Visible = true; Error.Text = lblError.Text; } Logger.Log(lblError.Text.ToString()); ////if (!string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL); ////} } } else { Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG); content.Visible = false; if (Error != null) { Error.Visible = true; Error.Text = lblError.Text; } Logger.Log(lblError.Text.ToString()); ////if (!string.IsNullOrEmpty(TextBoxValue)) ////{ //// SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL); ////} //MAIG - CH11 - END - Disabling the PT Email trigger and set the Email ID value to PC Request } } } }
/// <summary> /// Update credit card details when the update button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImgBtnUpdate_Click(object sender, ImageClickEventArgs e) { PlaceHolder PH_PolicyDetail = (PlaceHolder)this.NamingContainer.FindControl(Constants.PC_CNTRL_NAME); if (PH_PolicyDetail != null) { PH_PolicyDetail.Visible = true; } string PC_ProductCode = string.Empty; //MAIG - CH13 - BEGIN - Modified the below logic to check if the Page is Valid if (_isValid && Page.IsValid) //MAIG - CH13 - END - Modified the below logic to check if the Page is Valid { try { //MAIG - CH4 - BEGIN - Logic to set the Update button Enabled property to false ImgBtnUpdate.Enabled = false; //OrderClasses.Service.Order authUserObj = new OrderClasses.Service.Order(); //UserInfo userInfoObj = new UserInfo(); //userInfoObj = authUserObj.Authenticate(HttpContext.Current.User.Identity.Name, string.Empty, CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL); //MAIG - CH4 - END - Logic to set the Update button Enabled property to false if (!string.IsNullOrEmpty(hdnPaymentToken.Value)) { List <string> response = new List <string>(); OrderClasses.OrderInfo ordderInfo = new OrderClasses.OrderInfo(); SessionInfo sessionInfo = new SessionInfo(); IssueDirectPaymentWrapper actObj = new IssueDirectPaymentWrapper(); string token = string.Empty; ordderInfo.S = new SessionInfo(); ordderInfo.S.AppName = CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL; ordderInfo.User = new UserInfo(); ordderInfo.User.UserId = HttpContext.Current.User.Identity.Name; ordderInfo.Card = new OrderClasses.CardInfo(); ordderInfo.Card.CCExpMonth = _ExpireMonth.SelectedValue.ToString(); ordderInfo.Card.CCExpYear = _ExpireYear.SelectedValue.ToString(); ordderInfo.Card.CCNumber = lblCardNumberLast4Digit.Text; ordderInfo.Detail = new OrderClasses.OrderDetailInfo(); ordderInfo.Detail.PaymentType = 1; OrderClasses.AddressInfo addressInfo = new OrderClasses.AddressInfo(); addressInfo.FirstName = _Name.Text; addressInfo.LastName = " "; addressInfo.Zip = _txtZipCode.Text; addressInfo.City = " "; addressInfo.State = " "; addressInfo.AddressType = OrderClasses.AddressInfoType.BillTo; ordderInfo.Addresses.Add(addressInfo); MaintainPaymentAccountRequest inputRequest = new MaintainPaymentAccountRequest(); MaintainPaymentAccountResponse tokenResponse = new MaintainPaymentAccountResponse(); inputRequest = actObj.Tokenmapping(ordderInfo, sessionInfo, hdnPaymentToken.Value); inputRequest.MaintainPaymentAccountRequest1.saveForFuture = true; if (inputRequest != null) { //Invokes the Payment Token Service tokenResponse = actObj.InvokePaymentTokenService(inputRequest); } if (tokenResponse != null) { token = tokenResponse.MaintainPaymentAccountResponse1.paymentAccountToken; } else { //Added the below code to set Error flag if response object is null Logger.Log(CSAAWeb.Constants.PC_ERR_RESPONSE_NULL); lblErrMessage.Visible = true; lblErrMessage.Text = CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION; } PCEnrollmentMapping pCEnroll = new PCEnrollmentMapping(); //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest statusRequest = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest(); statusRequest = CreatePaymentStatusRequest(token); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request //MAIG - CH5 - BEGIN - Including Agent & Agency ID to the Enrollment Request if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID) || ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString().Equals("0")) { statusRequest.agency = string.Empty; } else { statusRequest.agency = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString(); } //////if (string.IsNullOrEmpty(userInfoObj.RepId.ToString()) || userInfoObj.RepId.ToString().Equals("0")) ////// statusRequest.agentIdentifier = string.Empty; //////else ////// statusRequest.agentIdentifier = userInfoObj.RepId.ToString(); if (this.Page.User.Identity.Name.Length > 9) { statusRequest.agentIdentifier = Convert.ToString(this.Page.User.Identity.Name).Substring(1); } else if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID) || !((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID.ToString().Equals("0")) { statusRequest.agentIdentifier = Convert.ToString(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID); } else { statusRequest.agentIdentifier = null; } //MAIG - CH5 - END - Including Agent & Agency ID to the Enrollment Request //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the method response = pCEnroll.PCPaymentEnrollService(statusRequest); //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the method if (response[0].Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper())) { Logger.Log(Constants.PC_LOG_STATUS_REQUEST_SUCCESS + statusRequest.policyInfo.policyNumber + Constants.PC_LOG_CNFRM_NUMBER + response[1].ToString()); Context.Items.Add(Constants.PC_CNFRMNUMBER, response[1].ToString()); //MAIG - CH6 - BEGIN - Logic to set the Invalid Unenroll flag passed to Confirmation page and removing PUP Prefix ////// Removing the logic to prefix the PUP for PUP Policies - start ////////if (statusRequest.policyInfo.type == Constants.PC_TYPE_PUP) ////////{ //////// Context.Items.Add(Constants.PC_POLICYNUMBER, Constants.PC_PUP + statusRequest.policyInfo.policyNumber.ToString()); ////////} ////////else ////////{ Context.Items.Add(Constants.PC_POLICYNUMBER, statusRequest.policyInfo.policyNumber.ToString()); ////////} ///// Removing the logic to prefix the PUP for PUP Policies - end ////// Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false); if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow != null) { Context.Items.Add("PC_INVALID_UNENROLL_FLOW_FLAG", true); Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false); } else { Context.Items.Add("PC_INVALID_UNENROLL_FLOW_FLAG", false); Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false); } //MAIG - CH6 - END - Logic to set the Invalid Unenroll flag passed to Confirmation page and removing PUP Prefix Context.Items.Add(Constants.PC_CCNumber, Constants.PC_MASK_TXT + statusRequest.paymentItem.card.number); //MAIG - CH15 - BEGIN - Added logic to add the condition for Amex and Discover if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_MASTER)) { statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_MASTER_EXPANSION; } else if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_AMEX)) { statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_AMEX_EXPANSION; } else if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_DISC)) { statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_DISC_EXPANSION; } //MAIG - CH15 - END - Added logic to add the condition for Amex and Discover Context.Items.Add(Constants.PC_CCType, statusRequest.paymentItem.card.type.ToUpper()); //MAIG - CH7 - BEGIN - Condition added to check if the policy is an valid policy if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow == null) { Context.Items.Add(Constants.PC_BILL_PLAN, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).BillingPlan); Context.Items.Add(Constants.PC_IS_ENROLLED, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._IsEnrolled); Context.Items.Add(Constants.PC_VLD_MDFY_ENROLLMENT, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Modifyenrollment); Context.Items.Add(Constants.PC_VLD_ENROLLMENT, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_enrollment); } //MAIG - CH7 - END - Condition added to check if the policy is an valid policy if ((_ExpireMonth.SelectedValue.Length) != 2) { Context.Items.Add(Constants.PC_CCEXP, "0" + _ExpireMonth.SelectedValue + "/" + _ExpireYear.SelectedValue); } else { Context.Items.Add(Constants.PC_CCEXP, _ExpireMonth.SelectedValue + "/" + _ExpireYear.SelectedValue); } Context.Items.Add(Constants.PC_PAYMT_TYPE, Constants.PC_CC); Context.Items.Add(Constants.PC_CUST_NAME, _Name.Text); Context.Items.Add(Constants.PC_EMAIL_ID, _txtEmailAddress.Text.ToString()); Context.Items.Add(Constants.PC_EDIT_CC, Constants.PC_EDIT_CC); Context.Items.Add(Constants.PC_EDIT_CONST_RESPONSE, Constants.PC_EDIT_RESPONSE); Server.Transfer(Constants.PC_RECURR_CNFRM_URL); } else { Logger.Log(Constants.PC_LOG_FAIL + statusRequest.policyInfo.policyNumber); lblErrMessage.Visible = true; //MAIG - CH14 - BEGIN - Modified code to display the Error Code only once //lblErrMessage.Text = response[1].ToString() + " (" + response[0].ToString() + ")"; lblErrMessage.Text = response[1].ToString(); //MAIG - CH14 - END - Modified code to display the Error Code only once } } else { lblErrMessage.Visible = true; lblErrMessage.Text = CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION; Logger.Log(Constants.PC_UPCC_PToken_Empty + ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).PolicyNumber); } } catch (FaultException faultExp) { DisplayException(faultExp); //MAIG - CH8 - BEGIN - Condition added to enable the Update Button ImgBtnUpdate.Enabled = true; //MAIG - CH8 - END - Condition added to enable the Update Button } } }
/// <summary> /// CHG0112662 - Record Payment Enrollment SOA Service changes - new method to invoke payment enrollment service /// </summary> /// <param name="EnrollRequest"></param> /// <returns></returns> public List <string> PCPaymentEnrollService(RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest EnrollRequest) { List <string> resp_List = new List <string>(); DataSet ds = new DataSet(); string DO = string.Empty; bool Errflag = false; RecordPaymentEnrollment.RecordPaymentEnrollmentStatusRequest1 ReqObj = new RecordPaymentEnrollment.RecordPaymentEnrollmentStatusRequest1(); RecordPaymentEnrollment.recordPaymentEnrollmentStatusResponse EnrollResp = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusResponse(); RecordPaymentEnrollment.RecordPaymentEnrollmentStatusResponse1 RespObj = new RecordPaymentEnrollment.RecordPaymentEnrollmentStatusResponse1(); 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 { RecordPaymentEnrollment.RecordPaymentEnrollmentStatus _RecordEnrollProvider = (RecordPaymentEnrollment.RecordPaymentEnrollmentStatusChannel)CreateInstance <RecordPaymentEnrollment.RecordPaymentEnrollmentStatusChannel>("RecordPaymentEnrollmentStatusSOAPPort"); 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.recordPaymentEnrollmentStatusRequest = 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("Payment Enrollment request to Payment Central - Record Payment Enrollment Request : \r\n" + writerReq); } RespObj = _RecordEnrollProvider.RecordPaymentEnrollmentStatus(ReqObj); EnrollResp = RespObj.recordPaymentEnrollmentStatusResponse; 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("Payment Enrollment Response from Payment Central - Record Payment Enrollment Response : \r\n" + writerRes); } else { if (EnrollResp == null) { Logger.Log("Payment 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 <RecordPaymentEnrollment.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("Payment Enrollment Response from Payment Central - Record Payment 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 <RecordPaymentEnrollment.www.aaancnuit.com.aaancnu_common_version2.ErrorInfo> errInfo = (FaultException <RecordPaymentEnrollment.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); }