Beispiel #1
0
        public void PartialReversal_WithCreditCard_ReturnsSuccessfulTransaction()
        {
            var service     = new BillPayService();
            var totalAmount = bills.Sum(x => x.Amount);
            var fee         = service.CalculateConvenienceAmount(clearTextCredit, totalAmount);

            // Make transaction to reverse
            var transaction = RunAndValidateTransaction(() => {
                return(clearTextCredit
                       .Charge(totalAmount)
                       .WithAddress(address)
                       .WithBills(bills)
                       .WithPaymentMethod(clearTextCredit)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .Execute());
            });

            // Now reverse it
            var reversal = RunAndValidateTransaction(() => {
                var billsToPariallyReverse = bills.Select(x => new Bill {
                    BillType    = x.BillType,
                    Identifier1 = x.Identifier1,
                    Amount      = x.Amount - 5
                }).ToArray();

                var newFees = service.CalculateConvenienceAmount(clearTextCredit, totalAmount - 10);

                return(Transaction.FromId(transaction.TransactionId)
                       .Reverse(totalAmount - 10)
                       .WithBills(billsToPariallyReverse)
                       .WithConvenienceAmount(fee - newFees)
                       .Execute());
            });
        }
Beispiel #2
0
        public void ReversePayment_WithPreviousMultiBillTransaction_ReturnsSuccessfulTransaction()
        {
            var service     = new BillPayService();
            var totalAmount = bills.Sum(x => x.Amount);
            var fee         = service.CalculateConvenienceAmount(clearTextCredit, totalAmount);

            // Make transaction to reverse
            var transaction = RunAndValidateTransaction(() => {
                return(clearTextCredit
                       .Charge(totalAmount)
                       .WithAddress(address)
                       .WithBills(bills)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .Execute());
            });

            // Now reverse it
            var reversal = RunAndValidateTransaction(() => {
                return(Transaction.FromId(transaction.TransactionId)
                       .Reverse(totalAmount)
                       .WithConvenienceAmount(fee)
                       .Execute());
            });
        }
Beispiel #3
0
        public void Charge_UsingTokenizedACH_ReturnsSuccessfulTransaction()
        {
            var service       = new BillPayService();
            var result        = ach.Tokenize();
            var fee           = service.CalculateConvenienceAmount(ach, bill.Amount);
            var paymentMethod = new eCheck()
            {
                AccountType     = AccountType.CHECKING,
                CheckType       = CheckType.BUSINESS,
                SecCode         = "WEB",
                CheckHolderName = "Tester",
                Token           = result
            };

            Assert.IsFalse(string.IsNullOrWhiteSpace(result));

            RunAndValidateTransaction(() => {
                return(paymentMethod
                       .Charge(bill.Amount)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .WithAddress(address)
                       .Execute());
            });
        }
Beispiel #4
0
        public void Charge_UsingTokenFromPreviousPayment_ReturnsSuccessfulTransaction()
        {
            var service = new BillPayService();
            var fee     = service.CalculateConvenienceAmount(clearTextCredit, bill.Amount);

            var transaction = RunAndValidateTransaction(() => {
                return(clearTextCredit
                       .Charge(bill.Amount)
                       .WithAddress(address)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .WithRequestMultiUseToken(true)
                       .Execute());
            });

            Assert.IsFalse(string.IsNullOrWhiteSpace(transaction.Token));

            var transaction2 = RunAndValidateTransaction(() => {
                var tokenizedCard = new CreditCardData()
                {
                    Token    = transaction.Token,
                    ExpYear  = clearTextCredit.ExpYear,
                    ExpMonth = clearTextCredit.ExpMonth
                };
                return(tokenizedCard.Charge(bill.Amount)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .Execute());
            });
        }
Beispiel #5
0
        public void Charge_UsingTokenizedCreditCard_ReturnsSuccessfulTransaction()
        {
            var service  = new BillPayService();
            var response = clearTextCredit.Verify()
                           .WithAddress(new Address {
                PostalCode = "12345"
            })
                           .WithRequestMultiUseToken(true)
                           .Execute();

            Assert.IsFalse(string.IsNullOrWhiteSpace(response.Token));

            var token = response.Token;
            var fee   = service.CalculateConvenienceAmount(clearTextCredit, bill.Amount);

            var paymentMethod = new CreditCardData()
            {
                Token    = token,
                ExpMonth = clearTextCredit.ExpMonth,
                ExpYear  = clearTextCredit.ExpYear
            };

            Assert.IsFalse(string.IsNullOrWhiteSpace(token));

            RunAndValidateTransaction(() => {
                return(paymentMethod
                       .Charge(bill.Amount)
                       .WithAddress(address)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .Execute());
            });
        }
Beispiel #6
0
        public void Charge_UsingSingleUseToken_ReturnsSuccessfulTransactionWithToken()
        {
            var service = new BillPayService();
            var fee     = service.CalculateConvenienceAmount(clearTextCredit, bill.Amount);

            var paymentMethod = new CreditCardData()
            {
                Token    = "ENTER SINGLE USE TOKEN VALUE",
                ExpMonth = 01,
                ExpYear  = 25
            };

            var transaction = RunAndValidateTransaction(() => {
                return(paymentMethod
                       .Charge(bill.Amount)
                       .WithAddress(address)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .WithRequestMultiUseToken(true)
                       .WithPaymentMethodUsageMode(PaymentMethodUsageMode.Single)
                       .Execute());
            });

            Assert.IsNotNull(transaction.Token);
        }
Beispiel #7
0
        public void Charge_WithSingleBill_ReturnsSuccessfulTransaction()
        {
            var service = new BillPayService();
            var fee     = service.CalculateConvenienceAmount(clearTextCredit, bill.Amount);

            RunAndValidateTransaction(() => {
                return(clearTextCredit
                       .Charge(bill.Amount)
                       .WithAddress(address)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithCurrency("USD")
                       .Execute());
            });
        }
Beispiel #8
0
        public void GetTransactionByOrderID_SingleBill()
        {
            var service  = new BillPayService();
            var response = clearTextCredit.Verify()
                           .WithAddress(new Address {
                PostalCode = "12345"
            })
                           .WithRequestMultiUseToken(true)
                           .Execute();

            Assert.IsFalse(string.IsNullOrWhiteSpace(response.Token));

            var token = response.Token;
            var fee   = service.CalculateConvenienceAmount(clearTextCredit, bill.Amount);

            var paymentMethod = new CreditCardData()
            {
                Token    = token,
                ExpMonth = clearTextCredit.ExpMonth,
                ExpYear  = clearTextCredit.ExpYear
            };

            Assert.IsFalse(string.IsNullOrWhiteSpace(token));

            var orderID             = Guid.NewGuid().ToString();
            var transactionResponse = RunAndValidateTransaction(() => {
                return(paymentMethod
                       .Charge(bill.Amount)
                       .WithAddress(address)
                       .WithBills(bill)
                       .WithConvenienceAmount(fee)
                       .WithOrderId(orderID)
                       .WithCurrency("USD")
                       .Execute());
            });

            TransactionSummary summary = ReportingService.TransactionDetail(orderID).Execute();

            Assert.IsNotNull(summary);
        }
Beispiel #9
0
        public void GetTransactionByOrderID_MultipleBills()
        {
            var service     = new BillPayService();
            var totalAmount = bills.Sum(x => x.Amount);
            var fee         = service.CalculateConvenienceAmount(clearTextCredit, totalAmount);

            var orderID             = Guid.NewGuid().ToString();
            var transactionResponse = RunAndValidateTransaction(() => {
                return(clearTextCredit
                       .Charge(totalAmount)
                       .WithAddress(address)
                       .WithBills(bills)
                       .WithConvenienceAmount(fee)
                       .WithOrderId(orderID)
                       .WithCurrency("USD")
                       .Execute());
            });

            TransactionSummary summary = ReportingService.TransactionDetail(orderID).Execute();

            Assert.IsNotNull(summary);
        }