Пример #1
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);
        }
Пример #2
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);
            }
        }
        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);
            }
        }