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); }
public void AuthMasterConvenienceAmt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "750241234" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var card = new HpsCreditCard { Number = "5473500000000014", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var authResponse = _creditService.Authorize(17.07m) .WithCard(card) .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithConvenienceAmt(10m) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(authResponse); Assert.AreEqual("00", authResponse.ResponseCode); var transactionDetails = _creditService.Get(authResponse.TransactionId).Execute(); Assert.IsNotNull(transactionDetails); Assert.AreEqual(10m, transactionDetails.ConvenienceAmount); }
public void OfflineSaleConvenienceAmt() { var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var response = _creditService.OfflineCharge(17.10m) .WithCard(card) .WithOfflineAuthCode("654321") .WithConvenienceAmt(10m) .WithDirectMarketData(directMarketData) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); var transactionDetails = _creditService.Get(response.TransactionId).Execute(); Assert.IsNotNull(transactionDetails); Assert.AreEqual(10m, transactionDetails.ConvenienceAmount); }
public void Void() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var card = new HpsCreditCard { Number = "4005554444444460", ExpMonth = 12, ExpYear = 17, Cvv = "123" }; var address = new HpsAddress { Address = "1 Heartland Way", Zip = "95124" }; var saleResponse = _device.CreditSale(1, 16m) .WithCard(card) .WithAddress(address) .WithAllowDuplicates(true) .WithRequestMultiUseToken(true) .Execute(); Assert.IsNotNull(saleResponse); Assert.AreEqual("00", saleResponse.ResponseCode); var voidResponse = _device.CreditVoid(1).WithTransactionId(saleResponse.TransactionId).Execute(); Assert.IsNotNull(voidResponse); Assert.AreEqual("00", voidResponse.ResponseCode); }
public void VerifyManual() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var card = new HpsCreditCard { Number = "4005554444444460", ExpMonth = 12, ExpYear = 17, Cvv = "123" }; var address = new HpsAddress { Address = "1 Heartland Way", Zip = "95124" }; var response = _device.CreditVerify(1) .WithCard(card) .WithAddress(address) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("85", response.ResponseCode); }
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); }
public void SaleWithSignatureCapture() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var card = new HpsCreditCard { Number = "4005554444444460", ExpMonth = 12, ExpYear = 17, Cvv = "123" }; var address = new HpsAddress { Address = "1 Heartland Way", Zip = "95124" }; var response = _device.CreditSale(1, 12m) .WithAllowDuplicates(true) .WithCard(card) .WithAddress(address) .WithSignatureCapture(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
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); }
public void ChargeMasterNegativeShippingamt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "750241234" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var typeBuilder = _creditService.Charge(17.02m); var card = new HpsCreditCard { Number = "5473500000000014", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var builder = UseTokens ? typeBuilder.WithToken(masterCardToken) : typeBuilder.WithCard(card); var chargeResponse = builder .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithShippingAmt(-10m) .WithAllowDuplicates(true) .Execute(); }
public void AuthVisaNegativeShippingAmt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "75024" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var authResponse = _creditService.Authorize(17.06m) .WithCard(card) .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithShippingAmt(-10m) .WithAllowDuplicates(true) .Execute(); }
public void ChargeVisaNegativeConvenienceAmt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "75024" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var typeBuilder = _creditService.Charge(17.01m); var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var builder = UseTokens ? typeBuilder.WithToken(visaToken) : typeBuilder.WithCard(card); var chargeResponse = builder .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithConvenienceAmt(-10m) .WithAllowDuplicates(true) .Execute(); }
public void AuthMasterNegativeConvenienceAmt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "750241234" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var card = new HpsCreditCard { Number = "5473500000000014", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var authResponse = _creditService.Authorize(17.07m) .WithCard(card) .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithConvenienceAmt(-10m) .WithAllowDuplicates(true) .Execute(); }
public void Init() { _tokenService = new HpsTokenService("pkapi_cert_jKc1FtuyAydZhZfbB3"); _card = new HpsCreditCard { Cvv = "123", ExpMonth = 12, ExpYear = 2025, Number = "4012002000060016" }; }
public static HpsToken TokenizeCard(HpsCreditCard card) { if (Tokens.ContainsKey(card.Number)) { return(Tokens[card.Number]); } var token = _tokenService.GetToken(card); Tokens.Add(card.Number, token); return(token); }
internal CardDataTypeManualEntry HydrateCardManualEntry(HpsCreditCard card, bool cardPresent = false, bool readerPresent = false) { return(new CardDataTypeManualEntry { CardNbr = card.Number, ExpMonth = card.ExpMonth, ExpYear = card.ExpYear, CVV2 = card.Cvv, CVV2StatusSpecified = false, CardPresent = cardPresent ? booleanType.Y : booleanType.N, CardPresentSpecified = true, ReaderPresent = readerPresent ? booleanType.Y : booleanType.N, ReaderPresentSpecified = true, }); }
public void Validation_TooLongCardNumber_ShouldReturnError() { var card = new HpsCreditCard { Number = "11111111111111111111111111111111111" }; var response = _tokenService.GetToken(card); var error = response.error; Assert.IsNotNull(error); Assert.AreEqual("2", error.code); Assert.AreEqual("card.number", error.param); Assert.AreEqual("Card number is invalid.", error.message); }
public void CvvWithLeadingZeros() { var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2025, Cvv = "012" }; var creditService = new HpsCreditService(ServicesConfig); var response = creditService.Charge(15.15m, "usd", card); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void CreditAuthWithNegativeConvenienceAmt_1() { var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2014, Cvv = "123" }; var creditService = new HpsCreditService(new HpsServicesConfig { SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w" }); var response = creditService.Authorize(10m, "usd", card, null, false, null, false, null, 0, -2m); }
public void CreditOfflineChargeWithNegativeConvenienceAmt() { var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var creditService = new HpsCreditService(new HpsServicesConfig { SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w" }); var response = creditService.OfflineCharge(10m, "usd", card, "654321", false, false, null, false, null, null, 0, 0, null, -2m); }
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); }
public void SecretKeyWithExtraSpaces() { var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2025, Cvv = "012" }; ServicesConfig.SecretApiKey += " "; var creditService = new HpsCreditService(ServicesConfig); var response = creditService.Charge(15.15m, "usd", card); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
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); }
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); }
public void ReturnByCard() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var card = new HpsCreditCard { Number = "4005554444444460", ExpMonth = 12, ExpYear = 17, Cvv = "123" }; var returnResponse = _device.CreditReturn(2, 14m) .WithCard(card) .Execute(); Assert.IsNotNull(returnResponse); Assert.AreEqual("00", returnResponse.ResponseCode); }
public void ChargeWithOutRewards() { var client = new HpsFluentCreditService(new HpsServicesConfig { SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A" }); var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2020, Cvv = "123" }; var response = client.Charge(11m) .WithCard(card) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); Assert.IsNull(response.RewardsResponse); }
public void OfflineSaleNegativeConvenienceAmt() { var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var response = _creditService.OfflineCharge(17.10m) .WithCard(card) .WithOfflineAuthCode("654321") .WithConvenienceAmt(-10m) .WithDirectMarketData(directMarketData) .WithAllowDuplicates(true) .Execute(); }
public void ChargeVisaConvenienceAmt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "75024" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var typeBuilder = _creditService.Charge(17.01m); var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var builder = UseTokens ? typeBuilder.WithToken(visaToken) : typeBuilder.WithCard(card); var chargeResponse = builder .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithConvenienceAmt(10m) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(chargeResponse); Assert.AreEqual("00", chargeResponse.ResponseCode); test10TransactionId = chargeResponse.TransactionId; var transactionDetails = _creditService.Get(chargeResponse.TransactionId).Execute(); Assert.IsNotNull(transactionDetails); Assert.AreEqual(10m, transactionDetails.ConvenienceAmount); }
public void CreditOfflineChargeWithConvenienceAmt() { var card = new HpsCreditCard { Number = "4012002000060016", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var creditService = new HpsCreditService(new HpsServicesConfig { SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w" }); var response = creditService.OfflineCharge(10m, "usd", card, "654321", false, false, null, false, null, null, 0, 0, null, 2m); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); var transactionDetails = creditService.Get(response.TransactionId); Assert.IsNotNull(transactionDetails); Assert.AreEqual(2m, transactionDetails.ConvenienceAmount); }
public void CreditAuthWithConvenienceAmt_1() { var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2014, Cvv = "123" }; var creditService = new HpsCreditService(new HpsServicesConfig { SecretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w" }); var response = creditService.Authorize(10m, "usd", card, null, false, null, false, null, 0, 2m); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); var transactionDetails = creditService.Get(response.TransactionId); Assert.IsNotNull(transactionDetails); Assert.AreEqual(2m, transactionDetails.ConvenienceAmount); }
public void ChargeMasterShippingamt() { var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "750241234" } }; var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" }; var typeBuilder = _creditService.Charge(17.02m); var card = new HpsCreditCard { Number = "5473500000000014", ExpMonth = 12, ExpYear = 2025, Cvv = "123" }; var builder = UseTokens ? typeBuilder.WithToken(masterCardToken) : typeBuilder.WithCard(card); var chargeResponse = builder .WithCardHolder(cardHolder) .WithDirectMarketData(directMarketData) .WithShippingAmt(10m) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(chargeResponse); Assert.AreEqual("00", chargeResponse.ResponseCode); var transactionDetails = _creditService.Get(chargeResponse.TransactionId).Execute(); Assert.IsNotNull(transactionDetails); Assert.AreEqual(10m, transactionDetails.ShippingAmount); }