コード例 #1
0
        public void DeleteInvoicePayment()
        {
            var invoice             = GetInvoiceTransaction01();
            var invoiceProxy        = new InvoiceProxy();
            var insertInvoiceResult = invoiceProxy.InsertInvoice(invoice);

            Assert.IsTrue(insertInvoiceResult.DataObject.InsertedEntityId > 0,
                          "There was an error creating the invoice for payment test.");

            var invoicePayment = new PaymentTransaction
            {
                TransactionDate = DateTime.Now,
                TransactionType = "SP",
                Currency        = "AUD",
                Summary         =
                    string.Format("Test Update Payment for Inv# {0}",
                                  insertInvoiceResult.DataObject.GeneratedInvoiceNumber),
                PaymentAccountId = _bankAccount01Id,
                PaymentItems     = new List <PaymentItem>
                {
                    new PaymentItem
                    {
                        InvoiceTransactionId =
                            insertInvoiceResult.DataObject.InsertedEntityId,
                        AmountPaid = 30.00M
                    }
                }
            };

            var invoicePaymentProxy          = new PaymentProxy();
            var insertInvoicePaymentResponse = invoicePaymentProxy.InsertInvoicePayment(invoicePayment);

            Assert.IsNotNull(insertInvoicePaymentResponse);
            Assert.IsTrue(insertInvoicePaymentResponse.IsSuccessfull);
            Assert.IsNotNull(insertInvoicePaymentResponse.RawResponse);

            var deleteInvoicePaymentResponse =
                invoicePaymentProxy.DeleteInvoicePayment(insertInvoicePaymentResponse.DataObject.InsertedEntityId);

            Assert.IsNotNull(deleteInvoicePaymentResponse);
            Assert.IsTrue(deleteInvoicePaymentResponse.IsSuccessfull, "Invoice payment was not deleted successfully.");
        }
コード例 #2
0
        private void CreatePayments()
        {
            CreateAccounts();

            var proxy = new PaymentProxy();

            var salePayment1 = new PaymentTransaction
            {
                TransactionDate  = DateTime.Now,
                TransactionType  = "SP",
                Currency         = "AUD",
                Summary          = string.Format("Test deleted entities_{0}", _testIdentifier),
                PaymentAccountId = _assetAccountId,
                PaymentItems     = new List <PaymentItem>
                {
                    new PaymentItem()
                    {
                        InvoiceTransactionId = _NotDeletedSaleTranId,
                        AmountPaid           = 10.00M
                    }
                }
            };

            var salePayment2 = new PaymentTransaction
            {
                TransactionDate  = DateTime.Now,
                TransactionType  = "SP",
                Currency         = "AUD",
                Summary          = string.Format("Test deleted entities_{0}", _testIdentifier),
                PaymentAccountId = _assetAccountId,
                PaymentItems     = new List <PaymentItem>
                {
                    new PaymentItem()
                    {
                        InvoiceTransactionId = _NotDeletedSaleTranId,
                        AmountPaid           = 10.00M
                    }
                }
            };

            var purchasePayment1 = new PaymentTransaction
            {
                TransactionDate  = DateTime.Now,
                TransactionType  = "PP",
                Currency         = "AUD",
                Summary          = string.Format("Test deleted entities_{0}", _testIdentifier),
                PaymentAccountId = _liabilityAccountId,
                PaymentItems     = new List <PaymentItem>
                {
                    new PaymentItem()
                    {
                        InvoiceTransactionId = _NotDeletedPurchaseTranId,
                        AmountPaid           = 10.00M
                    }
                }
            };

            var purchasePayment2 = new PaymentTransaction
            {
                TransactionDate  = DateTime.Now,
                TransactionType  = "PP",
                Currency         = "AUD",
                Summary          = string.Format("Test deleted entities_{0}", _testIdentifier),
                PaymentAccountId = _liabilityAccountId,
                PaymentItems     = new List <PaymentItem>
                {
                    new PaymentItem()
                    {
                        InvoiceTransactionId = _NotDeletedPurchaseTranId,
                        AmountPaid           = 10.00M
                    }
                }
            };

            //Create payments.
            _DeletedSalePaymentTranId        = proxy.InsertInvoicePayment(salePayment1).DataObject.InsertedEntityId;
            _NotDeletedSalePaymentTranId     = proxy.InsertInvoicePayment(salePayment2).DataObject.InsertedEntityId;
            _DeletedPurchasePaymentTranId    = proxy.InsertInvoicePayment(purchasePayment1).DataObject.InsertedEntityId;
            _NotDeletedPurchasePaymentTranId = proxy.InsertInvoicePayment(purchasePayment2).DataObject.InsertedEntityId;

            //Delete only first of each.
            proxy.DeleteInvoicePayment(_DeletedSalePaymentTranId);
            proxy.DeleteInvoicePayment(_DeletedPurchasePaymentTranId);
        }