//Create Payment in Xero From Xero Invoice public Payment CreateXeroPaymentFromXeroInvoice(XeroCoreApi private_app_api, Guid invoiceid) { Payment paymentresponse = new Payment(); try { Invoice invoiceById = private_app_api.Invoices.Find().Where(x => x.Id == invoiceid).First(); //Find account By Name for Payent Transaction which is mendatory in Xero. Xero.Api.Core.Model.Account account = private_app_api.Accounts.Find().ToList().Where(c => c.Name == "Arun Test Bank").FirstOrDefault(); var payment = new Payment { Invoice = new Invoice { Number = invoiceById.Number, Id = invoiceById.Id }, Account = new Xero.Api.Core.Model.Account { Id = account.Id, Code = account.Code }, Date = DateTime.Now, Amount = invoiceById.AmountDue }; paymentresponse = private_app_api.Payments.Create(payment); } catch (Exception ex) { throw; } return(paymentresponse); }
public async Task create_refund_on_credit_note_with_foreign_currency() { await SetUp(); Foreign = await Given_a_foreign_currency_account(); const int amount = 50; var accountCode = Account.Code; var note = await Given_an_credit_note(amount, accountCode); var date = DateTime.UtcNow; const string reference = "Full refund as we couldn't replace item"; var payment = await Api.CreateAsync(new Payment { CreditNote = new CreditNote { Number = note.Number }, Account = new Account { Code = Foreign.Code }, CurrencyRate = 0.8m, Date = date, Amount = amount, Reference = reference }); Assert.AreEqual(reference, payment.Reference); Assert.AreEqual(amount, payment.Amount); }
// Make payment against the invoice public void InvoicePay(string invoiceId, decimal paidAmount) { Payment payment = new Payment(); Invoice payingInvoice = _api.Invoices.Find(new Guid(invoiceId)); payment.Invoice = payingInvoice; Account payingAccount = new Account(); payingAccount.Code = "880"; payment.Account = payingAccount; payment.Amount = paidAmount; payment.Date = DateTime.Now; _api.Payments.Create(payment); }
public Account Update(Account item) { return Accounts.Update(item); }
public Account Create(Account item) { return Accounts.Create(item); }
public Task<Account> CreateAsync(Account item) { return Accounts.CreateAsync(item); }
protected void ManualJournalsSetUp() { SetUp(); Sales = Given_an_account(); Revenue = Given_an_account(AccountType.Revenue); }
protected async Task ManualJournalsSetUp() { await SetUp(); Sales = await Given_an_account(); Revenue = await Given_an_account(AccountType.Revenue); }
protected void SetUp() { BankAccount = Given_a_bank_account(); Account = Given_an_account(); }