예제 #1
0
        public void CreditChargeWithConvenienceAmt()
        {
            var card = new HpsCreditCard
            {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2014,
                Cvv      = "123"
            };

            var tokenService  = new HpsTokenService("pkapi_cert_m0e9bI2WbBHk0ALyQL");
            var token_reponse = tokenService.GetToken(card);

            var creditService = new HpsCreditService(new HpsServicesConfig
            {
                SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w"
            });
            var response = creditService.Charge(10m, "usd", token_reponse.token_value, null, false, null, false, null, 0, null, 12, 2025, 2m);

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            var transactionDetails = creditService.Get(response.TransactionId);

            Assert.IsNotNull(transactionDetails);
            Assert.AreEqual(2m, transactionDetails.ConvenienceAmount);
        }
예제 #2
0
        public void CreditVerifyWithTagData()
        {
            var card = new HpsCreditCard
            {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2014,
                Cvv      = "123"
            };

            var tokenService  = new HpsTokenService("pkapi_cert_m0e9bI2WbBHk0ALyQL");
            var token_reponse = tokenService.GetToken(card);

            var creditService = new HpsCreditService(new HpsServicesConfig
            {
                SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w"
            });
            var trackData = new HpsTrackData {
                Value = ";4761739001010036=15122011184404889?"
            };
            var tagData = new HpsTagDataType
            {
                TagData = "9F4005F000F0A0019F02060000000025009F03060000000000009F2608D90A06501B48564E82027C005F3401019F360200029F0702FF009F0802008C9F0902008C9F34030403029F2701809F0D05F0400088009F0E0508000000009F0F05F0400098005F280208409F390105FFC605DC4000A800FFC7050010000000FFC805DC4004F8009F3303E0B8C89F1A0208409F350122950500000080005F2A0208409A031409109B02E8009F21030811539C01009F37045EED3A8E4F07A00000000310109F0607A00000000310108407A00000000310109F100706010A03A400029F410400000001",
                Source  = TagDataTypeTagValuesSource.chip
            };
            var response = creditService.Verify(trackData, null, false, null, tagData);

            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
예제 #3
0
        public void CreditOfflineChargeWithTagData()
        {
            var card = new HpsCreditCard
            {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2014,
                Cvv      = "123"
            };

            var tokenService  = new HpsTokenService("pkapi_cert_m0e9bI2WbBHk0ALyQL");
            var token_reponse = tokenService.GetToken(card);

            var creditService = new HpsCreditService(new HpsServicesConfig
            {
                SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w"
            });
            var trackData = new HpsTrackData {
                Value = ";4761739001010036=15122011184404889?"
            };
            var tagData = new HpsTagDataType
            {
                TagData = "9F4005F000F0A0019F02060000000001219F03060000000000009F260816AC7EB8C0DFC40982027C005F3401019F360203869F0702FF009F0802008C9F0902008C8A0259319F34031E03009F2701409F0D05F0400088009F0E0500100000009F0F05F0400098005F280208409F390105FFC605DC4000A800FFC7050010000000FFC805DC4004F8009F3303E0B8C89F1A0208409F350122950500000800005F2A0208409A031409029B02E8009F21031145219C01009F3704BEBD49924F07A00000000310109F0607A00000000310108407A00000000310109F100706010A039000029F410400000001",
                Source  = TagDataTypeTagValuesSource.chip
            };
            var response = creditService.OfflineCharge(10m, "usd", trackData, null, 0, 0, null, tagData, 0, 0);

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
예제 #4
0
 public void Init()
 {
     _tokenService = new HpsTokenService("pkapi_cert_jKc1FtuyAydZhZfbB3");
     _card         = new HpsCreditCard {
         Cvv      = "123",
         ExpMonth = 12,
         ExpYear  = 2025,
         Number   = "4012002000060016"
     };
 }
예제 #5
0
        public void AddPaymentMethodWithToken()
        {
            // Create Customer
            var customer = new HpsPayPlanCustomer
            {
                CustomerIdentifier = GetIdentifier("Person"),
                FirstName          = "John",
                LastName           = "Doe",
                CustomerStatus     = HpsPayPlanCustomerStatus.Active,
                PrimaryEmail       = "*****@*****.**",
                AddressLine1       = "123 Main St",
                City          = "Dallas",
                StateProvince = "TX",
                ZipPostalCode = "98765",
                Country       = "USA",
                PhoneDay      = "5551112222"
            };
            HpsPayPlanService payPlanService = new HpsPayPlanService(TestServicesConfig.ValidPayplanServiceConfig());
            var response    = payPlanService.AddCustomer(customer);
            var customerKey = response.CustomerKey;

            // Create Card & Token
            var card = new HpsCreditCard
            {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2020,
                Cvv      = "123"
            };
            var tokenService  = new HpsTokenService("pkapi_cert_jKc1FtuyAydZhZfbB3");
            var tokenResponse = tokenService.GetToken(card);

            // Create & Add Payment via Token
            var newPaymentMethod = new HpsPayPlanPaymentMethod
            {
                CustomerKey       = customerKey,
                NameOnAccount     = "Bill Johnson",
                PaymentToken      = tokenResponse.token_value,
                PaymentMethodType = HpsPayPlanPaymentMethodType.CreditCard,
                Country           = "USA"
            };

            var result = payPlanService.AddPaymentMethod(newPaymentMethod);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.PaymentMethodKey);
        }
예제 #6
0
        public void CreditChargeWithNegativeConvenienceAmt()
        {
            var card = new HpsCreditCard
            {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2014,
                Cvv      = "123"
            };

            var tokenService  = new HpsTokenService("pkapi_cert_m0e9bI2WbBHk0ALyQL");
            var token_reponse = tokenService.GetToken(card);

            var creditService = new HpsCreditService(new HpsServicesConfig
            {
                SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w"
            });
            var response = creditService.Charge(10m, "usd", token_reponse.token_value, null, false, null, false, null, 0, null, 12, 2025, -2m);
        }
예제 #7
0
        public void CreditVerifyWithTokenExpiry()
        {
            var card = new HpsCreditCard {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2014,
                Cvv      = "123"
            };

            var tokenService  = new HpsTokenService("pkapi_cert_m0e9bI2WbBHk0ALyQL");
            var token_reponse = tokenService.GetToken(card);

            var creditService = new HpsCreditService(new HpsServicesConfig {
                SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w"
            });
            var response = creditService.Verify(token_reponse.token_value, null, false, null, 12, 2025);

            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
예제 #8
0
 public TestData(string publicApiKey)
 {
     _tokenService = new HpsTokenService(publicApiKey);
 }