Esempio n. 1
0
        public void charge_visa_EMV_Prev_Chip_Card_Read_Failed()
        {
            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_FAILED,
                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);
        }
Esempio n. 2
0
        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 HpsAuthorization Authorize(decimal amount, string currency, HpsTrackData trackData, HpsEncryptionData encryptionData = null,
            decimal gratuity = 0, bool allowPartialAuthorization = false, bool requestMultiUseToken = false, HpsDirectMarketData directMarketData = null, HpsEmvDataType emvData = null)
        {
            HpsInputValidation.CheckAmount(amount);
            HpsInputValidation.CheckCurrency(currency);

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

            return SubmitAuthorize(transaction, amount, currency);
        }
        /// <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>
        /// <param name="emvData">Optional EMV card data</param>
        /// <returns>The <see cref="HpsAccountVerify"/>.</returns>
        public HpsAccountVerify Verify(HpsTrackData trackData, HpsEncryptionData encryptionData = null,
            bool requestMultiUseToken = false, long? clientTransactionId = null, HpsEmvDataType emvData = 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)
                        },
                        EMVData = HydrateEmvData(emvData)
                    }
                },
                ItemElementName = ItemChoiceType1.CreditAccountVerify
            };

            return SubmitVerify(transaction, clientTransactionId);
        }
Esempio n. 5
0
        public void charge_visa_EMV_Issuer_Response_is_Present()
        {
            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 emvData = new HpsEmvDataType
            {
                TagData = "9F4005F000F0A0019F02060000000025009F03060000000000009F2608D90A06501B48564E82027C005F3401019F360200029F0702FF009F0802008C9F0902008C9F34030403029F2701809F0D05F0400088009F0E0508000000009F0F05F0400098005F280208409F390105FFC605DC4000A800FFC7050010000000FFC805DC4004F8009F3303E0B8C89F1A0208409F350122950500000080005F2A0208409A031409109B02E8009F21030811539C01009F37045EED3A8E4F07A00000000310109F0607A00000000310108407A00000000310109F100706010A03A400029F410400000001"
            };

            var typeBuilder = _creditService.Charge(17.01m);
            var builder = typeBuilder.WithTrackData(trackData);

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

            Assert.IsNotNull(chargeResponse);
            Assert.IsNotNull(chargeResponse.EMVIssuerResp);
        }