private async Task SendBusinessObjectToInterface(ProcessInterfaceDataChangeLogsRequest request, string accountingInterfaceXMLMessage, int tAorJLType, long eventId, bool isResendRequest) { bool messageCheck = true; if (!string.IsNullOrWhiteSpace(accountingInterfaceXMLMessage)) { messageCheck = false; // Call ESB service and send the XML message to accounting system var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(accountingInterfaceXMLMessage); await ProcessAccountingInterfaceRequest(request, xmlDoc.OuterXml, tAorJLType, eventId, isResendRequest); } else { _logger.LogWarning("Accounting interface XML message is invalid."); var eventHistory = new EventHistory(eventId, "Error- Message generated", accountingInterfaceXMLMessage, null, null); var updateEventStatus = new Event(eventId, (long)InterfaceStatus.TransmitError, "Accounting interface XML message is invalid."); _unitOfWork.BeginTransaction(); try { await _interfaceEventLogService.UpdateEventStatusAsync(updateEventStatus, request.CompanyId); await _interfaceEventLogService.CreateEventHistoryAsync(eventHistory, request.CompanyId); await ProcessStatusUpdate(request, InterfaceStatus.TransmitError, "Accounting interface XML message is invalid."); _unitOfWork.Commit(); } catch { _unitOfWork.Rollback(); if (!isResendRequest) { if (messageCheck) { throw new AtlasBusinessException("CSV File is empty."); } else { throw; } } } } }
private async Task SendBusinessObjectToInterface(ProcessInterfaceDataChangeLogsRequest request, string paymentRequestMessage, string legalEntityCode, long eventId) { bool messageCheck = true; if (!string.IsNullOrWhiteSpace(paymentRequestMessage)) { messageCheck = false; // Call ESB service and send the message to Trax system await ProcessTraxRequest(request, paymentRequestMessage, legalEntityCode, eventId); } else { var eventHistory = new EventHistory(eventId, "Error- Message generated", paymentRequestMessage, null, null); var updateEventStatus = new Event(eventId, (long)InterfaceStatus.TransmitError, "CSV Format is invalid."); _unitOfWork.BeginTransaction(); try { await _interfaceEventLogService.UpdateEventStatusAsync(updateEventStatus, request.CompanyId); await _interfaceEventLogService.CreateEventHistoryAsync(eventHistory, request.CompanyId); await ProcessStatusUpdate(request, InterfaceStatus.TransmitError, "CSV Format is invalid."); _unitOfWork.Commit(); } catch { _unitOfWork.Rollback(); if (messageCheck) { throw new AtlasBusinessException("CSV File is empty."); } else { throw; } } } }