public HttpResponseMessage PayOpenInvoicesJob(PayOpenInvoicesRequest invoiceRequest)
        {
            XmlToModelConverter xmlToModelConverter = new XmlToModelConverter();
            string request = xmlToModelConverter.Serialize <PayOpenInvoicesRequest>(invoiceRequest);
            //string request = CreatePayInvoiceRequest(invoiceRequest);
            GetOutstandingInvoiceParameter parameter = new GetOutstandingInvoiceParameter();

            parameter.TransactionName = "PayOpenInvoices";
            var response = this.PostXml(parameter, request);

            return(response);
        }
        public bool PayOpenInvoicesRequest(PayOpenInvoicesRequest invoiceRequest, string invoiceNumber)
        {
            XmlToModelConverter xmlToModelConverter = new XmlToModelConverter();
            string request = xmlToModelConverter.Serialize <PayOpenInvoicesRequest>(invoiceRequest);

            LogHelper.For(this).Info(request, "InforRequest");
            //string request = CreatePayInvoiceRequest(invoiceRequest);
            GetOutstandingInvoiceParameter parameter = new GetOutstandingInvoiceParameter();
            Boolean status;

            parameter.TransactionName = "PayOpenInvoices";
            var response = this.PostXml(parameter, request);

            if (!response.IsSuccessStatusCode)
            {
                string reason = response.ReasonPhrase + " : " + response.StatusCode + " : " + invoiceRequest.CreditCard.CCAuthorizationNumber + " Infor payment failed for " + invoiceNumber;
                LogHelper.For(this).Info(reason, "Failed InforResponse");
                status = false;
                InvoiceTransactionHandler handler = new InvoiceTransactionHandler(this.unitOfWork);
                handler.CreateInvoiceTransaction(invoiceRequest, reason, status);
                //throw error to frontend
                return(false);
            }

            XmlDocument xmlDocument    = this.xmlHelper.CreateXmlDocument(response.Content.ReadAsStringAsync().Result);
            string      responseString = JsonConvert.SerializeXmlNode(xmlDocument);

            if (responseString.ContainsIgnoreCase(customSettings.InforSuccessMessage))
            {
                LogHelper.For(this).Info(response.StatusCode + " : " + invoiceRequest.CreditCard.CCAuthorizationNumber + " Infor payment successful for " + invoiceNumber, "successful InforResponse");

                status = true;
                InvoiceTransactionHandler handler = new InvoiceTransactionHandler(this.unitOfWork);
                handler.CreateInvoiceTransaction(invoiceRequest, responseString, status);
                return(true);
            }
            else
            {
                //log in appl log and db for failed,invoice,amount,
                LogHelper.For(this).Info(response.StatusCode + " : " + invoiceRequest.CreditCard.CCAuthorizationNumber + " Infor payment failed for " + invoiceNumber, "Failed InforResponse");
                status = false;
                InvoiceTransactionHandler handler = new InvoiceTransactionHandler(this.unitOfWork);
                handler.CreateInvoiceTransaction(invoiceRequest, responseString, status);
                //throw error to frontend
                return(false);
            }
        }