// 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 static bool updateorcreatexeropayment(PaymentReadOnly Upayment, string clientxeroid) { XeroCoreApi xeroapp = getxeroapp(); Xero.Api.Core.Model.Payment Xpayment = new Xero.Api.Core.Model.Payment(); Xpayment.Amount = Convert.ToDecimal(Upayment.Amount); Xpayment.Date = Convert.ToDateTime(Upayment.CreatedDate); Xpayment.Status = Xero.Api.Core.Model.Status.PaymentStatus.Authorised; Xpayment.Type = Xero.Api.Core.Model.Types.PaymentType.AccountsReceivable; Xpayment.Account = xeroapp.Accounts.Where("Name==\"Stripe Payment Account\"").Find().First(); Xpayment.Reference = "from Unms"; foreach (PaymentCoverReadOnly pc in Upayment.PaymentCovers) { string invnumber = UNMSHelper.getinvoicenumberbyid(Convert.ToDouble(pc.InvoiceId)); Xpayment.Invoice = xeroapp.Invoices.Where("InvoiceNumber=\"" + invnumber + "\"").Find().FirstOrDefault(); } Xero.Api.Core.Model.Payment Xpaymentreturned = xeroapp.Update(Xpayment); return(true); }
protected Payment CreatePayment(decimal invoiceAmount, DateTime date, decimal amount, bool isReconciled = false) { var invoice = Given_an_invoice(invoiceAmount, Account.Code); var bankCode = BankAccount.Code; var payment = new Payment { Invoice = new Invoice { Number = invoice.Number }, Account = new Account { Code = bankCode }, Date = date, Amount = amount }; if (isReconciled) { payment.IsReconciled = true; } return payment; }
protected void Given_this_payment_is_deleted(Payment payment) { var deleteThisPayment = new Payment { Status = PaymentStatus.Deleted, Id = payment.Id }; Api.Payments.Update(deleteThisPayment); }
public Payment Update(Payment item) { return Payments.Update(item); }
public Payment Create(Payment item) { return Payments.Create(item); }
public Task<Payment> CreateAsync(Payment item) { return Payments.CreateAsync(item); }
protected Task Given_this_payment_is_deleted(Payment payment) { var deleteThisPayment = new Payment { Status = PaymentStatus.Deleted, Id = payment.Id }; return Api.Payments.UpdateAsync(deleteThisPayment); }