public void charge_visa_EMV_Prev_Chip_Card_Read_Success()
        {
            var cardHolder = new HpsCardHolder {Address = new HpsAddress {Address = "6860 Dallas Pkwy", Zip = "75024"}};
            var directMarketData = new HpsDirectMarketData {InvoiceNumber = "123456"};
            var trackData = new HpsTrackData { Value = ";4761739001010036=15122011184404889?" };

            var typeBuilder = _creditService.Charge(17.01m);

            var emvData = new HpsEmvDataType
            {
                ChipCondition = emvChipConditionType.CHIP_FAILED_PREV_SUCCESS,
                ChipConditionSpecified = false,
                TagData = "9F4005F000F0A0019F02060000000025009F03060000000000009F2608D90A06501B48564E82027C005F3401019F360200029F0702FF009F0802008C9F0902008C9F34030403029F2701809F0D05F0400088009F0E0508000000009F0F05F0400098005F280208409F390105FFC605DC4000A800FFC7050010000000FFC805DC4004F8009F3303E0B8C89F1A0208409F350122950500000080005F2A0208409A031409109B02E8009F21030811539C01009F37045EED3A8E4F07A00000000310109F0607A00000000310108407A00000000310109F100706010A03A400029F410400000001"
            };

            var builder = typeBuilder.WithTrackData(trackData);

            var chargeResponse = builder
                .WithCardHolder(cardHolder)
                .WithDirectMarketData(directMarketData)
                .WithEMVData(emvData)
                .WithAllowDuplicates(true)
                .Execute();

            Assert.IsNotNull(chargeResponse);
            Assert.AreEqual("00", chargeResponse.ResponseCode);
        }
        public void RefundWithTrackData() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            };

            var creditService = new HpsCreditService(ServicesConfig);
            HpsRefund response = creditService.Refund(12.00M, "USD", trackData);
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
        public void retail_001_CardVerifyVisa() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsAccountVerify response = creditService.Verify()
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(useTokens)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
        public void authorize_visa_EMV()
        {
            var trackData = new HpsTrackData { Value = ";4761739001010036=15122011184404889?" };

            var emvData = new HpsEmvDataType
            {
                TagData = "9F4005F000F0A0019F02060000000025009F03060000000000009F2608D90A06501B48564E82027C005F3401019F360200029F0702FF009F0802008C9F0902008C9F34030403029F2701809F0D05F0400088009F0E0508000000009F0F05F0400098005F280208409F390105FFC605DC4000A800FFC7050010000000FFC805DC4004F8009F3303E0B8C89F1A0208409F350122950500000080005F2A0208409A031409109B02E8009F21030811539C01009F37045EED3A8E4F07A00000000310109F0607A00000000310108407A00000000310109F100706010A03A400029F410400000001"
            };

            // ReSharper disable once RedundantArgumentDefaultValue
            var response = _creditService.Authorize(25.00m)
                .WithTrackData(trackData)
                .WithEMVData(emvData)
                .WithAllowDuplicates(true)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
        public void retail_029_ChargeDiscoverContactless() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(18.03m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
        public void retail_028_ChargeMastercardContactless() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Proximity
            };

            HpsCharge response = creditService.Charge(18.02m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
        public HpsTransaction OfflineCharge(decimal amount, string currency, HpsTrackData trackData, HpsEncryptionData encryptionData = null,
            decimal gratuity = 0, decimal surcharge = 0, long? clientTransactionId = null)
        {
            HpsInputValidation.CheckAmount(amount);
            HpsInputValidation.CheckCurrency(currency);

            /* Build the transaction request. */
            var transaction = new PosRequestVer10Transaction
            {
                Item = new PosCreditOfflineSaleReqType
                {
                    Block1 = new CreditOfflineSaleReqBlock1Type
                    {
                        Amt = amount,
                        GratuityAmtInfo = gratuity,
                        GratuityAmtInfoSpecified = gratuity != 0,
                        SurchargeAmtInfo = surcharge,
                        SurchargeAmtInfoSpecified = surcharge != 0,
                        CardData = new CardDataType
                        {
                            Item = HydrateCardTrackData(trackData),
                            EncryptionData = HydrateEncryptionData(encryptionData)
                        }
                    }
                },
                ItemElementName = ItemChoiceType1.CreditOfflineSale
            };

            /* Submit the transaction. */
            var rsp = DoTransaction(transaction, clientTransactionId).Ver10;
            HpsGatewayResponseValidation.CheckResponse(rsp, ItemChoiceType2.CreditOfflineSale);

            return new HpsTransaction
            {
                Header = HydrateTransactionHeader(rsp.Header),
                TransactionId = rsp.Header.GatewayTxnId,
                ResponseCode = "00",
                ResponseText = string.Empty
            };
        }
        public void retail_006_ChargeVisaSwipeToken() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.01m)
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            visaToken = response.TokenData.TokenValue;
        }
        /// <summary>
        /// A <b>credit account verify</b> transaction is used to verify that the account is in good standing
        /// with the issuer. This is a zero dollar transaction with no associated authorization. Since VISA and
        /// other issuers have started assessing penalties for one dollar authorizations, this provides a way for
        /// merchants to accomplish the same task while avoiding these penalties.
        /// </summary>
        /// <param name="trackData">The CC track data.</param>
        /// <param name="encryptionData">Optional encryption data.</param>
        /// <param name="requestMultiUseToken">Request a multi-use token.</param>
        /// <param name="clientTransactionId">Optional client transaction ID.</param>
        /// <returns>The <see cref="HpsAccountVerify"/>.</returns>
        public HpsAccountVerify Verify(HpsTrackData trackData, HpsEncryptionData encryptionData = null,
            bool requestMultiUseToken = false, long? clientTransactionId = null)
        {
            var transaction = new PosRequestVer10Transaction
            {
                Item = new PosCreditAccountVerifyReqType
                {
                    Block1 = new CreditAccountVerifyBlock1Type
                    {
                        CardData = new CardDataType
                        {
                            TokenRequest = requestMultiUseToken ? booleanType.Y : booleanType.N,
                            Item = HydrateCardTrackData(trackData),
                            EncryptionData = HydrateEncryptionData(encryptionData)
                        }
                    }
                },
                ItemElementName = ItemChoiceType1.CreditAccountVerify
            };

            return SubmitVerify(transaction, clientTransactionId);
        }
Beispiel #10
0
        public void retail_009_ChargeAmexSwipeToken() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.04m)
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            amexToken = response.TokenData.TokenValue;
        }
Beispiel #11
0
        public void retail_033_AuthorizeMasterCardSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            };

            // 033a authorize
            HpsAuthorization response = creditService.Authorize(15.10m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            // 033b capture
            HpsTransaction captureResponse = creditService.Capture(response.TransactionId).Execute();
            Assert.IsNotNull(captureResponse);
            Assert.AreEqual("00", captureResponse.ResponseCode);
        }
Beispiel #12
0
        public void retail_008_ChargeDiscoverSwipeToken() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.03m)
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            discoverToken = response.TokenData.TokenValue;
        }
Beispiel #13
0
        public void retail_093_EbtBenefitWithDrawalVisaSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "&lt;E1050711%B4012001000000016^VI TEST CREDIT^251200000000000000000000?|LO04K0WFOmdkDz0um+GwUkILL8ZZOP6Zc4rCpZ9+kg2T3JBT4AEOilWTI|+++++++Dbbn04ekG|11;4012001000000016=25120000000000000000?|1u2F/aEhbdoPixyAPGyIDv3gBfF|+++++++Dbbn04ekG|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|&gt;",
                Method = HpsTrackDataMethod.Swipe,
                EncryptionData = new HpsEncryptionData {
                    Version = "01"
                }
            };

            HpsEbtAuthorization response = ebtService.CashBackPurchase(110.01m)
                    .WithTrackData(trackData)
                    .WithPinBlock("32539F50C245A6A93D123412324000AA")
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #14
0
        public void retail_007_ChargeMastercardSwipeToken() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.02m)
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            mastercardToken = response.TokenData.TokenValue;
        }
Beispiel #15
0
        public void retail_079_ChargeGsbSwipePartialReversal() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6277220572999800^   /                         ^49121010557010000016000000?F;6277220572999800=49121010557010000016?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(2.15m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            HpsTransaction reversalResponse = creditService.Reverse(2.15m)
                    .WithTransactionId(response.TransactionId)
                    .WithAuthAmount(1.15m)
                    .Execute();
            Assert.IsNotNull(reversalResponse);
            Assert.AreEqual("00", reversalResponse.ResponseCode);
        }
Beispiel #16
0
        public void retail_078_ChargeGsbSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6277220572999800^   /                         ^49121010557010000016000000?F;6277220572999800=49121010557010000016?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(2.10m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #17
0
        public void retail_030_ChargeAmexContactless() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?",
                Method = HpsTrackDataMethod.Proximity
            };

            HpsCharge response = creditService.Charge(18.04m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #18
0
        public void retail_002_CardVerifyMastercardSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsAccountVerify response = creditService.Verify()
                    .WithTrackData(trackData)
                    .WithRequestMultiUseToken(useTokens)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
Beispiel #19
0
        public void retail_032_AuthorizeVisaSwipeAdditionalAuth() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            // 032a authorize
            HpsAuthorization response = creditService.Authorize(15.09m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            // 032b Additional Auth (restaurant only)

            // 032c Add to batch
            HpsTransaction captureResponse = creditService.Capture(response.TransactionId).Execute();
            Assert.IsNotNull(captureResponse);
            Assert.AreEqual("00", captureResponse.ResponseCode);
        }
Beispiel #20
0
        public void retail_042_ChargeDiscoverSwipePartialApproval() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(155.00m)
                    .WithTrackData(trackData)
                    .WithAllowPartialAuth(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("10", response.ResponseCode);
            Assert.AreEqual(100.00m, response.AuthorizedAmount);
            test042TransactionId = response.TransactionId;
        }
Beispiel #21
0
        public void retail_011_ChargeMastercardSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.02m)
                    .WithTrackData(trackData)
                    .WithAllowDuplicates(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #22
0
        public void retail_075_AddValueGsbSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B6277220572999800^   /                         ^49121010557010000016000000?F;6277220572999800=49121010557010000016?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsAuthorization response = creditService.PrePaidAddValue(5.00m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #23
0
        public void retail_040_ChargeVisaSwipePartialApproval() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(130.00m)
                    .WithTrackData(trackData)
                    .WithAllowPartialAuth(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("10", response.ResponseCode);
            Assert.AreEqual(110.00m, response.AuthorizedAmount);
        }
Beispiel #24
0
        public void retail_013_ChargeAmexSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.04m)
                    .WithTrackData(trackData)
                    .WithAllowDuplicates(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #25
0
        public void retail_043_ChargeVisaSwipeEditGratuity() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.11m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            HpsTransaction editResponse = creditService.Edit()
                .WithTransactionId(response.TransactionId)
                .WithAmount(18.11m)
                .WithGratuity(3.00m)
                .Execute();
            Assert.IsNotNull(editResponse);
            Assert.AreEqual("00", editResponse.ResponseCode);
        }
Beispiel #26
0
        public void retail_014_ChargeJbcSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B3566007770007321^JCB TEST CARD^2512101100000000000000000064300000?;3566007770007321=25121011000000076435?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.05m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            test014TransactionId = response.TransactionId;
        }
        public HpsCharge Charge(decimal amount, string currency, HpsTrackData trackData, HpsEncryptionData encryptionData = null,
            decimal gratuity = 0, bool allowPartialAuthorization = false, bool requestMultiUseToken = false,
            HpsDirectMarketData directMarketData = null, string emvData = "", bool allowDuplicates = false)
        {
            HpsInputValidation.CheckAmount(amount);
            HpsInputValidation.CheckCurrency(currency);

            /* Build the transaction request. */
            var transaction = new PosRequestVer10Transaction
            {
                Item = new PosCreditSaleReqType
                {
                    Block1 = new CreditSaleReqBlock1Type
                    {
                        Amt = amount,
                        GratuityAmtInfo = gratuity,
                        GratuityAmtInfoSpecified = gratuity != 0,
                        AllowPartialAuth = allowPartialAuthorization ? booleanType.Y : booleanType.N,
                        AllowPartialAuthSpecified = true,
                        AllowDup = allowDuplicates ? booleanType.Y : booleanType.N,
                        AllowDupSpecified = true,
                        CardData = new CardDataType
                        {
                            TokenRequest = requestMultiUseToken ? booleanType.Y : booleanType.N,
                            Item = HydrateCardTrackData(trackData),
                            EncryptionData = HydrateEncryptionData(encryptionData)
                        },
                        DirectMktData = HydrateDirectMktData(directMarketData),
                        EMVData = HydrateEmvData(emvData)
                    }
                },
                ItemElementName = ItemChoiceType1.CreditSale
            };

            return SubmitCharge(transaction, amount, currency);
        }
Beispiel #28
0
        public void retail_015_ChargeVisaSwipe() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Swipe
            };

            HpsCharge response = creditService.Charge(15.06m)
                    .WithTrackData(trackData)
                    .WithAllowDuplicates(true)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            test015TransactionId = response.TransactionId;
        }
Beispiel #29
0
        public void moto_038_add_value_gsb() {
            var trackData = new HpsTrackData {
                Value = "%B6277220572999800^   /                         ^49121010557010000016000000?F;6277220572999800=49121010557010000016?"
            };

            var response = _creditService.PrePaidAddValue(15.00m)
                .WithTrackData(trackData)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Beispiel #30
0
        public void retail_027_ChargeVisaContactless() {
            HpsTrackData trackData = new HpsTrackData {
                Value = "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?",
                Method = HpsTrackDataMethod.Proximity
            };

            HpsCharge response = creditService.Charge(18.01m)
                    .WithTrackData(trackData)
                    .Execute();
            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }