コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void UpdateInvoicePayment()
        {
            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 = 59.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);

            //
            //	Update
            paymentInfo1.Summary = "Payment - Updated.";

            paymentInfo1.Items.Clear();

            item = new InvoicePaymentItemDto();
            item.InvoiceUid = sale1.Uid;
            item.Amount = 30M;
            paymentInfo1.Items.Add(item);

            proxy.Update(paymentInfo1);

            //
            //	TODO: Check result.
            //
        }
コード例 #3
0
        public void DeleteInvoicePayment()
        {
            CrudProxy proxy = new InvoiceProxy();
            InvoiceDto sale = this.GetUnpaidServiceSale();
            proxy.Insert(sale);

            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 Outstanding Sale Invoice";
            paymentInfo1.Fee = 9.99m;

            InvoicePaymentItemDto item = null;

            item = new InvoicePaymentItemDto();
            item.InvoiceUid = sale.Uid;
            item.Amount = 2132.51M;
            paymentInfo1.Items.Add(item);

            proxy = new InvoicePaymentProxy();
            proxy.Insert(paymentInfo1);

            proxy.DeleteByUid(paymentInfo1.Uid);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public void InsertInvoicePaymentIncorrectTranType()
        {
            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.TransactionType = "PS";
            paymentInfo1.Fee = 3.45m;

            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();
            try
            {
                proxy.Insert(paymentInfo1);
                throw new Exception("No exception was thrown.");
            }
            catch (RestException rex)
            {
                Assert.AreEqual("Incorrect transaction type. Use 'SP' for Sale Payment and 'PP' for purchase payment.", rex.Message, "Incorrect message.");
            }
        }
コード例 #6
0
        public void InsertInvoicePaymentIncorrectPaymentAccountType()
        {
            CrudProxy proxy = new InvoiceProxy();

            InvoiceDto sale1 = this.GetUnpaidItemSale();

            proxy.Insert(sale1);

            InvoicePaymentDto paymentInfo1 = new InvoicePaymentDto(TransactionType.SalePayment);
            paymentInfo1.Date = DateTime.Today.Date;
            paymentInfo1.PaymentAccountUid = this.AssetInventory.Uid;
            paymentInfo1.Reference = Guid.NewGuid().ToString();
            paymentInfo1.Summary = "Payment for Outstanding Invoice";
            paymentInfo1.Fee = 19.99m;

            InvoicePaymentItemDto item = null;

            item = new InvoicePaymentItemDto();
            item.InvoiceUid = sale1.Uid;
            item.Amount = 23.75M;
            paymentInfo1.Items.Add(item);

            proxy = new InvoicePaymentProxy();
            try
            {
                proxy.Insert(paymentInfo1);
                throw new Exception("No exception was thrown.");
            }
            catch (RestException rex)
            {
                Assert.AreEqual("The referenced Bank Account does not exist.", rex.Message, "Incorrect message.");
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
            }
        }