Ejemplo n.º 1
0
        // Update of returned invoice from ZRA into Nav
        public async void UpdateInvoices(string strInvoice, ZRASalesInvoice2 zRASalesInvoice)
        {
            //Console.WriteLine(strInvoice);
            //Console.ReadKey();
            // Convert string to json
            JObject jInvoice = JObject.Parse(strInvoice);

            ResponseHeader responseHeader = new ResponseHeader();

            responseHeader = JsonConvert.DeserializeObject <ResponseHeader>(strInvoice);
            // Fields to update
            // Ideally loop through items
            zRASalesInvoice.ESD_Time      = DateTime.ParseExact(responseHeader.ESDTime, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            zRASalesInvoice.Fiscal_Code   = responseHeader.FiscalCode;
            zRASalesInvoice.Terminal_ID   = responseHeader.TerminalID;
            zRASalesInvoice.Invoice_Code  = responseHeader.InvoiceCode;
            zRASalesInvoice.InvoiceSigned = true;
            // loop through the invoices
            var tmpSales = _mapper.Map <P_Sales_Inv_Line[]>(responseHeader.TaxItems);

            tmpSales.CopyTo(zRASalesInvoice.SalesInvLines, 0);

            NAVUpdateReference.Update navUpdate = new NAVUpdateReference.Update(zRASalesInvoice);

            // Attempt the actual update of the invoices. Errors are handled in the calling program
            Update_Result update_Result = await this._navUpdateClient.UpdateAsync(navUpdate);
        }
Ejemplo n.º 2
0
        // 3. Get feedback from ZRA and update invoice
        private static void UpdateNavInvoice(string strInvoice, ZRASalesInvoice2 invoice)
        {
            var            logger = _serviceCollection.BuildServiceProvider().GetService <ILogger <NavInteraction> >();
            NavInteraction nav    = new NavInteraction(NavReadClient, NavUpdateClient, _mapper);

            nav.UpdateInvoices(strInvoice, invoice);
        }