protected void On_LoanFieldChanged(object sender, FieldChangeEventArgs oFldEvt) { if (oAFN2IRSection == null) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); } string oTriggerField = (oAFN2IRSection != null) ? oTriggerField = oAFN2IRSection.AFNRequest.TriggerField : "300"; if ((oFldEvt.FieldID == oTriggerField) && oFldEvt.NewValue.EndsWith("PQ")) { On_RetrieveAndTrackInvoice(EncompassApplication.CurrentLoan.Fields["364"].Value.ToString(), oFldEvt.NewValue); } }
protected void On_FormLoaded(object sender, FormChangeEventArgs oFCEvt) { // WNW: Temporary Workaround if (EncompassApplication.Screens.Current.ScreenType == EncompassScreen.Loans) { this.fxIRRespHTTPStatus = (EMFORMS.Panel)oFCEvt.Form.FindControl("FX_AFN2IR_HTTPSTATUS"); this.fxIRRespBilling = (EMFORMS.Panel)oFCEvt.Form.FindControl("FX_AFN2IR_IRBILLINGRESP"); } if (oAFN2IRSection == null) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); } }
protected void On_FormLoad(object sender, EventArgs evt) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); if (oAFN2IRSection != null && this.fxIRServiceEndpoint != null) { var oOptionDDL = (EMFORMS.DropdownOptionCollection) this.fxIRServiceEndpoint.Options; var oDefaultOption = oAFN2IRSection.AFNRequest.IRRequestSource; this.fxIRServiceEndpoint.SelectedIndex = oOptionDDL.IndexOf(new EMFORMS.DropdownOption(oDefaultOption)); this.fxIRServiceEndpoint.Select(); } }
protected void On_IRServiceEndpointChanged(object sender, EventArgs e) { //WNW: ONLY IN THE UI WE DO THIS! if (oAFN2IRSection == null) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); } oAFN2IRSection.AFNRequest.Endpoint = this.fxIRServiceEndpoint.Value; AFN2IRHelper.WriteAppConfig(oAFN2IRSection); string oType = oAFN2IRSection.AFNRequest.Endpoint; IRServiceEndpoint oEndPoint = (oAFN2IRSection.IRServiceEndpoints.IRServiceEndpoint).Find(ep => ep.Type == oType); this.fxAFNReqUID.Text = oEndPoint.UID; this.fxAFNReqPwD.Text = "*******"; this.fxAFNIntrnlAID.Text = oEndPoint.InternalAID; this.fxIRReqSrc.Text = oAFN2IRSection.AFNRequest.IRRequestSource; Macro.Alert(String.Format("Now using {0} IRService EndPoint", oAFN2IRSection.AFNRequest.Endpoint)); }
protected void On_RetrieveAndTrackInvoice(string oLenderCID, string oOrderID) { oAFN2IRSection = AFN2IRHelper.ReadAppConfig(); if (oAFN2IRSection == null) { Macro.Alert("Error: AFN2IRAppConfig is missing or corrupted"); return; } var oType = oAFN2IRSection.AFNRequest.Endpoint; IRServiceEndpoint oEndPoint = (oAFN2IRSection.IRServiceEndpoints.IRServiceEndpoint).Find(ep => ep.Type == oType); RestClient oRestClient = new RestClient(oEndPoint.Url); RestRequest oRestRequest = new RestRequest(Method.POST); oRestRequest.AddHeader("cache-control", "no-cache"); oRestRequest.AddHeader("content-type", "text/xml"); string oXML = IR_RequestGroup.ToXML(oAFN2IRSection, oEndPoint.InternalAID, oEndPoint.UID, oEndPoint.PwD, oLenderCID, oOrderID); oRestRequest.AddParameter("text/xml", oXML, ParameterType.RequestBody); Stopwatch oStopWatch = new Stopwatch(); oStopWatch.Start(); oRestClient.ExecuteAsync(oRestRequest, (IRestResponse oIRResp) => { Loan oLoan = EncompassApplication.CurrentLoan; oStopWatch.Stop(); if (oIRResp.StatusCode != HttpStatusCode.OK) { Macro.Alert(string.Format(oIRResp.ErrorMessage, oIRResp.ErrorException.InnerException)); } else { IR_ResponseGroup oIRResponseGroup = AFN2IRHelper.ConvertXMLToObject <IR_ResponseGroup>(Encoding.UTF8.GetBytes(oIRResp.Content)); IR_Status oIRStatus = oIRResponseGroup.Response.Status; var oIRStatusPacked = String.Format("{0}:{1}:{2} ms:{3} Bytes:{4}", oIRStatus.Condition.ToLower(), oIRStatus.Code, oStopWatch.ElapsedMilliseconds, oIRResp.ContentLength, oIRStatus.Description); //WNW: Pack status into CX.FX.IRRESP.STATUS // "success:S0010:1354:100747:Complete- Product Delivery" oLoan.Fields["CX.FX.IRRESPSTATUS"].Value = (object)oIRStatusPacked; if (oIRStatus.Condition.ToLower().Equals("success") == false) { Macro.Alert(string.Format("Condition={0} StatusCode={1}{2}Description={3}", oIRStatus.Condition, oIRStatus.Code, Environment.NewLine, oIRStatus.Description)); oLoan.Fields["CX.FX.IRINVCASEID"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVORDERID"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVORDERDT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVBILLINGDT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVAMNT"].Value = (object)String.Empty; oLoan.Fields["CX.FX.IRINVRPTNAME"].Value = (object)String.Empty; } else { try { Attachment oLoanAttachment = null; TrackedDocument oTrackedDocumentFolder = null; IR_BillingResponse oBillingResponse = oIRResponseGroup.Response.ResponseData.BillingResponse; string oAttachmentTitle = oAFN2IRSection.AFNResponse.AttachmentPrefix + oOrderID; string oTrackedDocumentTitle = oAFN2IRSection.AFNResponse.TrackedDocumentTitle; oLoanAttachment = AFN2IRHelper.NewLoanAttachment(oLoan, oAttachmentTitle, Convert.FromBase64String(oBillingResponse.EmbeddedFile.Document), "PDF"); oTrackedDocumentFolder = AFN2IRHelper.GetTrackedDocument(oLoan, oTrackedDocumentTitle, EncompassApplication.Session.Loans.Milestones.Submittal.Name); if ((oTrackedDocumentFolder == null) || (oLoanAttachment != null)) { oTrackedDocumentFolder.Attach(oLoanAttachment); oLoanAttachment.IsActive = Convert.ToBoolean(oAFN2IRSection.AFNResponse.AttachementActivated); } oLoan.Fields["CX.FX.IRRESPSTATUS"].Value = (object)oIRStatusPacked; oLoan.Fields["CX.FX.IRINVCASEID"].Value = (object)oBillingResponse.LenderCaseIdentifier; oLoan.Fields["CX.FX.IRINVORDERID"].Value = (object)oBillingResponse.OrderIdentifier; oLoan.Fields["CX.FX.IRINVORDERDT"].Value = (object)oBillingResponse.OrderedDate; oLoan.Fields["CX.FX.IRINVBILLINGDT"].Value = (object)oBillingResponse.BilledDate; oLoan.Fields["CX.FX.IRINVAMNT"].Value = (object)oBillingResponse.BilledAmount; oLoan.Fields["CX.FX.IRINVRPTNAME"].Value = (object)oBillingResponse.EmbeddedFile.Name; oLoan.Fields["CX.FX.AFNTRACKEDDOCFOLDER"].Value = (object)oTrackedDocumentFolder.Title; //Macro.Alert(string.Format("Received: {0}.{1}Now tracked in eFolder: {2}", oLoanAttachment.Title, // Environment.NewLine, // oTrackedDocumentFolder.Title)); } catch (Exception Ex) { var oMethodName = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name; Macro.Alert(string.Format("{0}: Error moving billing report to eFolder: {1}", oMethodName, Ex.Message)); } } if (this.fxIRRespHTTPStatus != null) { this.fxIRRespHTTPStatus.Refresh(); } if (fxIRRespBilling != null) { this.fxIRRespBilling.Refresh(); } } }); }