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()); }); }
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); }
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()); }); }
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()); }); }
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()); }); }
public void LoadHostedPayment_WithMakePaymentReturnToken_ReturnsIdentifier() { var service = new BillPayService(); var hostedPaymentData = new HostedPaymentData() { Bills = new List <Bill>() { blindBill }, CustomerAddress = new Address { StreetAddress1 = "123 Drive", City = "Auburn", State = "AL", PostalCode = "36830", CountryCode = "US", }, CustomerEmail = "*****@*****.**", CustomerFirstName = "Test", CustomerLastName = "Tester", CustomerPhoneMobile = "800-555-5555", CustomerIsEditable = true, HostedPaymentType = HostedPaymentType.MakePaymentReturnToken }; var response = service.LoadHostedPayment(hostedPaymentData); Assert.IsTrue(!string.IsNullOrEmpty(response.PaymentIdentifier)); }
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()); }); }
public EditModel( BillPayService billPayService, PaymentService paymentService, ExpenseService expenseService, BillService billService) { _billPayService = billPayService; _paymentService = paymentService; _expenseService = expenseService; _billService = billService; }
public void Load_WithOneBill_DoesNotThrow() { try { var service = new BillPayService(); service.LoadBills(new List <Bill>() { billLoad }, "billload"); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Load_WithDuplicateBills_ThrowsGatewayException() { Assert.ThrowsException <GatewayException>(() => { var service = new BillPayService(); var bills = new List <Bill>() { billLoad, billLoad }; service.LoadBills(bills, "billload"); }); }
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()); }); }
public void LoadHostedPayment_WithoutBills_ThrowsValidationException() { var service = new BillPayService(); var hostedPaymentData = new HostedPaymentData() { CustomerAddress = new Address { StreetAddress1 = "123 Drive" }, CustomerEmail = "*****@*****.**", CustomerFirstName = "Alex", HostedPaymentType = HostedPaymentType.MakePayment }; Assert.ThrowsException <ValidationException>(() => { var response = service.LoadHostedPayment(hostedPaymentData); }); }
public void Load_WithFiveThousandBills_DoesNotThrow() { try { var service = new BillPayService(); service.LoadBills(Enumerable.Range(0, 5000).Select(x => new Bill() { Amount = billLoad.Amount, BillPresentment = billLoad.BillPresentment, BillType = billLoad.BillType, Customer = billLoad.Customer, DueDate = billLoad.DueDate, Identifier1 = x.ToString(), Identifier2 = x.ToString() }), "billload"); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Load_WithInvalidBillType_ThrowsGatewayException() { Assert.ThrowsException <GatewayException>(() => { var service = new BillPayService(); var bills = new List <Bill>() { billLoad, new Bill() { Amount = billLoad.Amount, BillPresentment = billLoad.BillPresentment, BillType = "InvalidBillType", Customer = billLoad.Customer, DueDate = billLoad.DueDate, Identifier1 = billLoad.Identifier1 } }; service.LoadBills(bills, "billload"); }); }
public void LoadHostedPayment_WithMakePaymentType_ReturnsIdentifier() { var service = new BillPayService(); var data = new HostedPaymentData() { Bills = new List <Bill>() { blindBill }, CustomerAddress = new Address { StreetAddress1 = "123 Drive", PostalCode = "12345" }, CustomerEmail = "*****@*****.**", CustomerFirstName = "Test", CustomerLastName = "Tester", HostedPaymentType = HostedPaymentType.MakePayment }; var response = service.LoadHostedPayment(data); Assert.IsTrue(!string.IsNullOrEmpty(response.PaymentIdentifier)); }
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); }
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); }
public DetailsModel(BillPayService billPayService) { _billPayService = billPayService; }
public CreateModel(UserManager <User> userManager, BillPayService billPayService) { _userManager = userManager; _billPayService = billPayService; }
public IndexModel(BillPayService billPayService) { _billPayService = billPayService; }
public DeleteModel(BillPayService billPayService) { _billPayService = billPayService; }