Exemple #1
0
        private async Task <int> GetClientIdAsync()
        {
            var clientRepository = new ClientsRepository(billingoApi);
            var clients          = await clientRepository.GetListAsync(1, 1);

            return(clients?.SingleOrDefault()?.Id ?? (await clientRepository.CreateAsync(new Client
            {
                Name = "Test Elek",
                Email = "*****@*****.**",
                Billing_address = new BillingAddress
                {
                    Country = "Magyarország",
                    Postcode = "1117",
                    City = "Budapest",
                    Street_name = "Test",
                    Street_type = "utca",
                    House_nr = "10",
                },
                Bank = new Bank
                {
                    Account_no = "11739009-23905470-"
                },
                Defaults = new Defaults
                {
                    Electronic_invoice = "true",
                    Invoice_currency = "HUF"
                }
            })).Id);
        }
        public async Task <InvoiceWithClient> GenerateInvoiceForNewClientAsync(Invoice invoice, Client client)
        {
            var clientWithId = await clients.CreateAsync(client);

            invoice.Client_uid = clientWithId.Id;
            var invoiceWithId = await invoices.CreateAsync(invoice);

            return(new InvoiceWithClient
            {
                Client = clientWithId,
                Invoice = invoiceWithId,
            });
        }