Beispiel #1
0
        public InvoicePaymentDto Delete(IObjectIdentifier <ulong> id)
        {
            var payment = _repository.FindById(id);

            _repository.Delete(payment.Id);
            return(InvoicePaymentDto.FromDomain(payment));
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
 protected static void AssertEqual(InvoicePaymentDto expected, InvoicePaymentDto actual)
 {
     Assert.AreEqual(expected.Uid, actual.Uid, "Different uid.");
     Assert.AreEqual(expected.LastUpdatedUid, actual.LastUpdatedUid, "Different last updated uid.");
     Assert.AreEqual(expected.TransactionType, actual.TransactionType, "Different transaction type.");
     Assert.AreEqual(expected.Date, actual.Date, "Different date.");
     Assert.AreEqual(expected.Reference, actual.Reference, "Different reference.");
     Assert.AreEqual(expected.Summary, actual.Summary, "Different summary.");
     Assert.AreEqual(expected.Notes, actual.Notes, "Different notes.");
     Assert.AreEqual(expected.RequiresFollowUp, actual.RequiresFollowUp, "Different requires follow up.");
     Assert.AreEqual(expected.PaymentAccountUid, actual.PaymentAccountUid, "Different payment account uid.");
     Assert.AreEqual(expected.DateCleared, actual.DateCleared, "Different date cleared.");
     Assert.AreEqual(expected.Fee, actual.Fee, "Fee values not the same.");
     AssertEqualForInvoicePaymentItems(expected.Items, actual.Items);
 }
Beispiel #4
0
 public InvoicePaymentDto Delete(InvoicePaymentDto payment)
 {
     _repository.Delete(payment.Id);
     return(payment);
 }
Beispiel #5
0
 public InvoicePaymentDto Create(InvoicePaymentDto entity)
 {
     throw new System.NotImplementedException();
 }
Beispiel #6
0
 public InvoicePaymentDto GetById(IObjectIdentifier <ulong> id) => InvoicePaymentDto.FromDomain(_repository.FindById(id));