示例#1
0
        public void Should_Successfully_Issue_Full_Refund()
        {
            var amount = new System.Random().Next(10, 1000);
            var postTransactionRequestModel = new PostTransactionRequestModel
            {
                Payer                  = "John Smith",
                EmailAddress           = "*****@*****.**",
                Amount                 = amount,
                BankAccountInformation = new BankAccountInformationModel
                {
                    AccountHolder = "John Smith",
                    FirstName     = "John",
                    LastName      = "Smith",
                    AccountNumber = "4242424242424242",
                    RoutingNumber = "111000025",
                    AccountType   = AccountType.Personalsavings
                },
                Comments = "Sample comments"
            };

            var response = _transactionsApi.TransactionsPost(postTransactionRequestModel);

            // Should return a valid Id.
            Assert.IsTrue(response.Id > 0);

            var refundResponse = _transactionsApi.TransactionsRefund(response.Id.Value, new PostRefundTransactionRequestModel {
                SendReceipt = false
            });
            var refundTransaction = _transactionsApi.TransactionsGet(refundResponse.Id);

            Assert.IsNotNull(refundTransaction);
            Assert.AreEqual(refundTransaction.Amount * -1, postTransactionRequestModel.Amount + 3);
        }