public void Discover_Verify_ShouldReturnOk()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Verify(TestCreditCard.ValidDiscover, TestCardHolder.ValidCardHolder);

            Assert.AreEqual("85", response.ResponseCode);
        }
        public void List_WhenConfigValidNoTxn_ShouldListCharges()
        {
            var chargeSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var items     = chargeSvc.List(DateTime.UtcNow.AddDays(-10), DateTime.UtcNow);

            Assert.IsNotNull(items);
        }
        public void Discover_Authorize_ShouldReturnOk()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Authorize(50, "usd", TestCreditCard.ValidDiscover, TestCardHolder.ValidCardHolder);

            Assert.AreEqual("00", response.ResponseCode);
        }
        public void Amex_Manual_ShouldVerify()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Verify(TestCreditCard.ValidAmex, TestCardHolder.CertCardHolderShortZip, true);

            Assert.AreEqual("00", response.ResponseCode);
        }
Exemple #5
0
        public void Amex_WhenCardIsOk_ShouldAuthorize()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Authorize(50).WithCard(TestCreditCard.ValidAmex).Execute();

            Assert.IsNotNull(response);
            StringAssert.Matches(response.ResponseCode, new Regex("00"));
        }
Exemple #6
0
        public void Amex_WhenCardIsOk_ShouldCharge()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Charge(50).WithCard(TestCreditCard.ValidAmex).AllowPartialAuth(true).WithClientTransactionId(12345).Execute();

            Assert.IsNotNull(response);
            StringAssert.Matches(response.ResponseCode, new Regex("00"));
        }
        public void Mastercard_Debit_WhenValidTrackData_ShouldChargeOk()
        {
            var service = new HpsDebitService(TestServicesConfig.ValidServicesConfig());
            var charge  = service.Charge(50, "usd", "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?", "F505AD81659AA42A3D123412324000AB", null, true);

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("00"));
        }
        public void Visa_Debit_WhenValidTrackData_ShouldChargeOk()
        {
            var service = new HpsDebitService(TestServicesConfig.ValidSecretKeyConfig());
            var charge  = service.Charge(50, "usd", "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?", "32539F50C245A6A93D123412324000AA", null, true);

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("00"));
        }
        public void Cc_ShouldOfflineCharge_Ok()
        {
            var chargeSvc = new HpsCreditService(TestServicesConfig.ValidServicesConfig());
            var charge    = chargeSvc.OfflineCharge(20, "usd", TestCreditCard.ValidVisa, "654321", true);

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("^00$"));
        }
        public void MasterCard_ShouldRefund_Ok()
        {
            var creditSvc      = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var creditResponse = creditSvc.Charge(25.00m, "usd", TestCreditCard.ValidMasterCard, TestCardHolder.CertCardHolderShortZipNoStreet);
            var refundResponse = creditSvc.Refund(25.00m, "usd", creditResponse.TransactionId);

            StringAssert.Matches(refundResponse.ResponseCode, new Regex("^00$"));
        }
        public void Cc_ShouldOPartialApprove_Ok()
        {
            var chargeSvc = new HpsCreditService(TestServicesConfig.ValidServicesConfig());
            var charge    = chargeSvc.Authorize(20, "usd", TestCreditCard.ValidVisa, TestCardHolder.ValidCardHolder, false, null, true);

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("^00$"));
        }
        public void Discover_AuthorizeAndRequestToken_ShouldGetTokenAndReturnOk()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Authorize(50, "usd", TestCreditCard.ValidDiscover, TestCardHolder.ValidCardHolder, true);

            Assert.AreEqual(0, response.TokenData.TokenRspCode);
            Assert.AreEqual("00", response.ResponseCode);
        }
        public void List_WhenConfigValid_ShouldListTransactions()
        {
            var chargeSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());

            List <HpsReportTransactionSummary> items = chargeSvc.List(DateTime.Today.AddDays(-10), DateTime.Today);

            Assert.IsNotNull(items);
        }
        public void Discover_ShouldVoid_Ok()
        {
            var creditSvc      = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var creditResponse = creditSvc.Charge(25.00m, "usd", TestCreditCard.ValidDiscover, TestCardHolder.CertCardHolderShortZipNoStreet);
            var voidResponse   = creditSvc.Void(creditResponse.TransactionId).Execute();

            StringAssert.Matches(voidResponse.ResponseCode, new Regex("^00$"));
        }
        public void Jcb_NotPresentManual_ShouldCharge()
        {
            var service  = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response = service.Charge(17.05m, "usd", TestCreditCard.ValidJcb,
                                          TestCardHolder.CertCardHolderLongZip, false, TestDescriptor);

            Assert.IsNotNull(response);
            StringAssert.Matches(response.ResponseCode, new Regex("^00$"));
        }
        public void MasterCard_PresentManual_ShouldCharge()
        {
            var service  = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response = service.Charge(16.02m, "usd", TestCreditCard.ValidMasterCard,
                                          TestCardHolder.CertCardHolderShortZipNoStreet, false, TestDescriptor);

            Assert.IsNotNull(response);
            StringAssert.Matches(response.ResponseCode, new Regex("^00$"));
        }
        public void GiftCard_ManualCard_ShouldVoid()
        {
            var giftCardSvc  = new HpsGiftCardService(TestServicesConfig.ValidSecretKeyConfig());
            var saleResponse = giftCardSvc.Sale(TestGiftCard.Manual.validGiftCardNotEncrypted, 10.00m);

            StringAssert.Matches(saleResponse.ResponseCode, new Regex("^0$"));
            var voidResponse = giftCardSvc.Void(saleResponse.TransactionId).Execute();

            StringAssert.Matches(voidResponse.ResponseCode, new Regex("^0$"));
        }
        public void GiftCard_ManualCard_ShouldReverseUsingGiftCard()
        {
            var giftCardSvc  = new HpsGiftCardService(TestServicesConfig.ValidSecretKeyConfig());
            var saleResponse = giftCardSvc.Sale(TestGiftCard.Manual.validGiftCardNotEncrypted, 10.00m);

            StringAssert.Matches(saleResponse.ResponseCode, new Regex("^0$"));
            var reverseResponse = giftCardSvc.Reverse(TestGiftCard.Manual.validGiftCardNotEncrypted, 10.00m);

            StringAssert.Matches(reverseResponse.ResponseCode, new Regex("^0$"));
        }
        public void Cc_ShouldPartialReverse_Ok()
        {
            var chargeSvc = new HpsCreditService(TestServicesConfig.ValidServicesConfig());
            var charge    = chargeSvc.Charge(20, "usd", TestCreditCard.ValidVisa,
                                             TestCardHolder.CertCardHolderShortZip);

            var response = chargeSvc.Reverse(charge.TransactionId, 20, "usd", null, 10);

            Assert.IsNotNull(response);
            StringAssert.Matches(response.ResponseCode, new Regex("^00$"));
        }
Exemple #20
0
        public void Batch_WhenOpen_ShouldClose()
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());

            creditSvc.Charge(50).WithCard(TestCreditCard.ValidAmex).AllowDuplicates().Execute();

            var batchSvc = new HpsBatchService(TestServicesConfig.ValidSecretKeyConfig());
            var response = batchSvc.Close().WithClientTransactionId(12345).Execute();

            Assert.IsNotNull(response);
        }
        public void Cc_ShouldTipEdit_Ok()
        {
            var creditSvc    = new HpsCreditService(TestServicesConfig.ValidServicesConfig());
            var authResponse = creditSvc.Authorize(50, "usd", TestCreditCard.ValidVisa, TestCardHolder.ValidCardHolder);

            Assert.AreEqual("00", authResponse.ResponseCode);

            var captureResponse = creditSvc.Capture(authResponse.TransactionId, null, 5);

            Assert.AreEqual("00", captureResponse.ResponseCode);
        }
        public void Mastercard_Swipe_ShouldVerify()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var verify  = service.Verify(new HpsTrackData
            {
                Value  = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            });

            Assert.IsNotNull(verify);
            StringAssert.Matches(verify.ResponseCode, new Regex("85"));
        }
Exemple #23
0
        public void Check_ShouldSale()
        {
            var checkSvc = new HpsCheckService(TestServicesConfig.ValidSecretKeyConfig());
            var response = checkSvc.Sale(checkActionType.SALE, TestCheck.Approve, 5.00m);

            if (response == null)
            {
                Assert.Fail("Response is null.");
            }

            StringAssert.Matches(response.ResponseCode, new Regex("^0$"));
        }
        public void Discover_Swipe_ShouldVerify()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var verify  = service.Verify(new HpsTrackData
            {
                Value  = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?",
                Method = HpsTrackDataMethod.Swipe
            });

            Assert.IsNotNull(verify);
            StringAssert.Matches(verify.ResponseCode, new Regex("85"));
        }
Exemple #25
0
        public void GiftCard_ManualCard_ShouldActivate()
        {
            var giftCardSvc = new HpsGiftCardService(TestServicesConfig.ValidSecretKeyConfig());
            var response    = giftCardSvc.Activate(100.00M, "usd", TestGiftCard.Manual.validGiftCardNotEncrypted);

            if (response == null)
            {
                Assert.Fail("Response is null.");
            }

            StringAssert.Matches(response.ResponseCode, new Regex("^0$"));
        }
        public void Visa_Swipe_ShouldVerify()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var verify  = service.Verify(new HpsTrackData
            {
                Value  = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            });

            Assert.IsNotNull(verify);
            StringAssert.Matches(verify.ResponseCode, new Regex("85"));
        }
        public void Discover_WhenValidProximityTrackData_ShouldReturnValidResult()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidServicesConfig());
            var charge  = service.Charge(50, "usd", new HpsTrackData
            {
                Value  = "%B6011000990156527^DIS TEST CARD^25122011000062111401?;6011000990156527=25122011000062111401?",
                Method = HpsTrackDataMethod.Proximity
            });

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("00"));
        }
Exemple #28
0
        public void Amex_WhenValidTrackData_ShouldReturnValidResult()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var charge  = service.Charge(50, "usd", new HpsTrackData
            {
                Value  = "%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?",
                Method = HpsTrackDataMethod.Swipe
            });

            Assert.IsNotNull(charge);
            StringAssert.Matches(charge.ResponseCode, new Regex("00"));
        }
        /// <summary>Charge a Discover with a valid config and valid Discover info.</summary>
        /// <param name="amt">Amount to charge</param>
        /// <returns>The HPS Charge.</returns>
        private static HpsCharge ChargeValidDiscover(decimal amt)
        {
            var creditSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var response  = creditSvc.Charge(amt, "usd", TestCreditCard.ValidDiscover, TestCardHolder.ValidCardHolder);

            if (response == null)
            {
                Assert.Fail("Response is null.");
            }

            return(response);
        }
        public void Mastercard_Manual_ShouldPartiallyApproveAndCapture()
        {
            var service = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig());
            var auth    = service.Authorize(65, "usd", TestCreditCard.ValidMasterCard, TestCardHolder.CertCardHolderShortZip);

            Assert.AreEqual("00", auth.ResponseCode);

            var capture = service.Capture(auth.TransactionId, 145);

            Assert.IsNotNull(capture);
            StringAssert.Matches(capture.ResponseCode, new Regex("00"));
        }