public void DeleteSalePayment() { CrudProxy proxy = new InvoiceProxy(); InvoiceDto sale1 = this.GetUnpaidItemSale(); InvoiceDto sale2 = this.GetUnpaidServiceSale(); proxy.Insert(sale1); proxy.Insert(sale2); InvoicePaymentDto paymentInfo1 = new InvoicePaymentDto(TransactionType.SalePayment); paymentInfo1.Date = DateTime.Today.Date; paymentInfo1.PaymentAccountUid = this.Westpac.Uid; paymentInfo1.Reference = Guid.NewGuid().ToString(); paymentInfo1.Summary = "Payment for 2 Outstanding Invoices"; paymentInfo1.Fee = 3.55m; InvoicePaymentItemDto item = null; item = new InvoicePaymentItemDto(); item.InvoiceUid = sale2.Uid; item.Amount = 20.05M; paymentInfo1.Items.Add(item); item = new InvoicePaymentItemDto(); item.InvoiceUid = sale1.Uid; item.Amount = 23.75M; paymentInfo1.Items.Add(item); proxy = new InvoicePaymentProxy(); proxy.Insert(paymentInfo1); proxy.DeleteByUid(paymentInfo1.Uid); try { proxy.GetByUid(paymentInfo1.Uid); } catch (RestException ex) { Assert.AreEqual("RecordNotFoundException", ex.Type); } }
public void InsertInvoicePayment() { CrudProxy proxy = new InvoiceProxy(); InvoiceDto sale1 = this.GetUnpaidItemSale(); InvoiceDto sale2 = this.GetUnpaidServiceSale(); proxy.Insert(sale1); proxy.Insert(sale2); InvoicePaymentDto paymentInfo1 = new InvoicePaymentDto(TransactionType.SalePayment); paymentInfo1.Date = DateTime.Today.Date; paymentInfo1.PaymentAccountUid = this.Westpac.Uid; paymentInfo1.Reference = Guid.NewGuid().ToString(); paymentInfo1.Summary = "Payment for 2 Outstanding Invoices"; paymentInfo1.Fee = 9.99m; InvoicePaymentItemDto item = null; item = new InvoicePaymentItemDto(); item.InvoiceUid = sale2.Uid; item.Amount = 20.05M; paymentInfo1.Items.Add(item); item = new InvoicePaymentItemDto(); item.InvoiceUid = sale1.Uid; item.Amount = 23.75M; paymentInfo1.Items.Add(item); proxy = new InvoicePaymentProxy(); proxy.Insert(paymentInfo1); Assert.IsTrue(paymentInfo1.Uid > 0, "Uid must be > 0 after save."); InvoicePaymentDto paymentInfo2 = (InvoicePaymentDto)proxy.GetByUid(paymentInfo1.Uid); Assert.AreEqual("AUD", paymentInfo2.Ccy, "Incorrect Currency."); AssertEqual(paymentInfo1, paymentInfo2); }
public void InsertMultiCcyInvoicePayment() { CrudProxy proxy = new InvoiceProxy(); InvoiceDto sale1 = this.GetUnpaidItemSale(); sale1.Date = DateTime.Parse("12-Feb-2010"); sale1.Ccy = "EUR"; sale1.AutoPopulateFXRate = true; sale1.FCToBCFXRate = 1.6194842787M; proxy.Insert(sale1); InvoicePaymentDto paymentInfo1 = new InvoicePaymentDto(TransactionType.SalePayment); paymentInfo1.Date = DateTime.Today.Date; paymentInfo1.PaymentAccountUid = this.Westpac.Uid; paymentInfo1.Reference = Guid.NewGuid().ToString(); paymentInfo1.Summary = "Payment for 2 Outstanding Invoices"; paymentInfo1.Ccy = "EUR"; paymentInfo1.AutoPopulateFXRate = true; paymentInfo1.FCToBCFXRate = 1.6194842787M; paymentInfo1.Fee = 1.75m; InvoicePaymentItemDto item = null; item = new InvoicePaymentItemDto(); item.InvoiceUid = sale1.Uid; item.Amount = 23.75M; paymentInfo1.Items.Add(item); proxy = new InvoicePaymentProxy(); proxy.Insert(paymentInfo1); Assert.IsTrue(paymentInfo1.Uid > 0, "Uid must be > 0 after save."); InvoicePaymentDto paymentInfo2 = (InvoicePaymentDto)proxy.GetByUid(paymentInfo1.Uid); Assert.AreEqual(paymentInfo1.Ccy, paymentInfo2.Ccy, "Incorrect Currency."); Assert.AreEqual(paymentInfo1.AutoPopulateFXRate, paymentInfo2.AutoPopulateFXRate, "Incorrect Auto Populate FX Rate flag."); Assert.AreEqual(1.6194842787M, paymentInfo2.FCToBCFXRate, "Incorrect FX rate."); AssertEqual(paymentInfo1, paymentInfo2); }
public void TestDeletePurchasePayment() { CrudProxy proxy = new InvoiceProxy(); InvoiceDto purchase1 = this.GetUnpaidItemPurchase(); InvoiceDto purchase2 = this.GetUnpaidServicePurchase(); proxy.Insert(purchase1); proxy.Insert(purchase2); InvoicePaymentDto paymentInfo1 = new InvoicePaymentDto(TransactionType.PurchasePayment); paymentInfo1.Date = DateTime.Today.Date; paymentInfo1.PaymentAccountUid = this.Westpac.Uid; paymentInfo1.Reference = Guid.NewGuid().ToString(); paymentInfo1.Summary = "Payment for 2 Outstanding Invoices"; paymentInfo1.Fee = 3.99m; InvoicePaymentItemDto item = null; item = new InvoicePaymentItemDto(); item.InvoiceUid = purchase2.Uid; item.Amount = 20.05M; paymentInfo1.Items.Add(item); item = new InvoicePaymentItemDto(); item.InvoiceUid = purchase1.Uid; item.Amount = 23.75M; paymentInfo1.Items.Add(item); proxy = new InvoicePaymentProxy(); proxy.Insert(paymentInfo1); Assert.IsTrue(paymentInfo1.Uid > 0, "Uid must be > 0 after save."); InvoicePaymentDto paymentInfo2 = (InvoicePaymentDto)proxy.GetByUid(paymentInfo1.Uid); AssertEqual(paymentInfo1, paymentInfo2); proxy = new InvoicePaymentProxy(); proxy.DeleteByUid(paymentInfo1.Uid); try { proxy.GetByUid(paymentInfo1.Uid); } catch (RestException ex) { Assert.AreEqual("RecordNotFoundException", ex.Type); } }