Ejemplo n.º 1
0
        public async Task <CustomerInvoiceDto> GetCustomerInvoiceAsync(int invoiceId)
        {
            var invoice = await _invoiceRepository.GetWithCustomerAsync(invoiceId);

            var result = new CustomerInvoiceDto {
                CreateDate              = invoice.CreateDate,
                CustomerEmail           = invoice.Customer.Email,
                CustomerFullName        = invoice.Customer.FullName,
                CustomerId              = invoice.CustomerId,
                CustomerMobile          = invoice.Customer.Mobile,
                CustomerPostalCode      = invoice.ShippingAddress.PostalCode,
                CustomerShippingAddress = invoice.ShippingAddress.Address,
                InvoiceId     = invoice.Id,
                TotalPrice    = invoice.TotalPrice,
                UserId        = invoice.Customer.UserId,
                Items         = invoice.Orders.Adapt <List <CustomerInvoiceItemDto> >(),
                InvoiceStatus = invoice.Status
            };

            result.TotalTaxAmount = invoice.Orders.Sum(_ => _.TaxAmount);

            return(await Task.FromResult(result));
        }
        public virtual void GenerateXeroInvoice(CustomerInvoiceDto invoice)
        {
            // Akshay to implement this function

            // Use _xeroInvoiceRepository to store the results of the API call to Xero
        }