当前位置: 首页>>代码示例>>C#>>正文


C# Entities.HpsCreditCard类代码示例

本文整理汇总了C#中SecureSubmit.Entities.HpsCreditCard的典型用法代码示例。如果您正苦于以下问题:C# HpsCreditCard类的具体用法?C# HpsCreditCard怎么用?C# HpsCreditCard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HpsCreditCard类属于SecureSubmit.Entities命名空间,在下文中一共展示了HpsCreditCard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TokenizeCard

        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;
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:12,代码来源:TestData.cs

示例2: Validation_TooLongCardNumber_ShouldReturnError

        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);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:12,代码来源:TokenServiceTests.cs

示例3: CvvWithLeadingZeros

        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);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:13,代码来源:GeneralTests.cs

示例4: moto_002_verify_master_card

        public void moto_002_verify_master_card() {
            var card = new HpsCreditCard {
                Number = "5473500000000014",
                ExpMonth = 12,
                ExpYear = 2025
            };

            var response = _creditService.Verify()
                .WithCard(card)
                .WithRequestMultiUseToken(UseTokens)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:15,代码来源:MOTO.cs

示例5: ecomm_002_verify_master_card

        public void ecomm_002_verify_master_card() {
            var card = new HpsCreditCard {
                Number = "5473500000000014",
                ExpMonth = 12,
                ExpYear = 2025
            };

            // ReSharper disable once RedundantArgumentDefaultValue
            var response = _creditService.Verify()
                .WithCard(card)
                .WithRequestMultiUseToken(UseTokens)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("85", response.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:16,代码来源:eCommerce.cs

示例6: AddPaymentMethodWithToken

        public void AddPaymentMethodWithToken()
        {
            // Create Customer
            var customer = new HpsPayPlanCustomer
            {
                CustomerIdentifier = GetIdentifier("Person"),
                FirstName = "John",
                LastName = "Doe",
                CustomerStatus = HpsPayPlanCustomerStatus.Active,
                PrimaryEmail = "[email protected]",
                AddressLine1 = "123 Main St",
                City = "Dallas",
                StateProvince = "TX",
                ZipPostalCode = "98765",
                Country = "USA",
                PhoneDay = "5551112222"
            };
            HpsPayPlanService payPlanService = new HpsPayPlanService(TestServicesConfig.ValidTokenServiceConfig());
            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);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:46,代码来源:GeneralTests.cs

示例7: Authorize

        /// <summary>
        /// A <b>credit authorization</b> transaction authorizes a credit card transaction. The authorization is NOT placed
        /// in the batch. The <b>credit authorization</b> transaction can be committed by using the capture method.
        /// </summary>
        /// <param name="amount">Amount to verify.</param>
        /// <param name="currency">Currency to use (e.g. "USD").</param>
        /// <param name="card">The credit card information.</param>
        /// <param name="cardHolder">The card holder information (used for AVS).</param>
        /// <param name="requestMultiUseToken">Request a multi-use token</param>
        /// <param name="descriptor">Transaction description that is concatenated to a configurable
        /// merchant DBA name. The resulting string is sent to the card issuer for the Merchant Name.</param>
        /// <param name="allowPartialAuth">Indicated whether partial authorization is supported.</param>
        /// <param name="details">The transaction details.</param>
        /// <param name="gratuity">The gratuity amount.</param>
        /// <returns>The <see cref="HpsAuthorization"/>.</returns>
        public HpsAuthorization Authorize(decimal amount, string currency, HpsCreditCard card, HpsCardHolder cardHolder = null,
            bool requestMultiUseToken = false, string descriptor = null, bool allowPartialAuth = false,
            HpsTransactionDetails details = null, decimal gratuity = 0)
        {
            HpsInputValidation.CheckAmount(amount);
            HpsInputValidation.CheckCurrency(currency);

            /* Build the transaction request. */
            var transaction = new PosRequestVer10Transaction
            {
                Item = new PosCreditAuthReqType
                {
                    Block1 = new CreditAuthReqBlock1Type
                    {
                        AllowDup = booleanType.Y,
                        AllowDupSpecified = true,
                        AllowPartialAuth = allowPartialAuth ? booleanType.Y : booleanType.N,
                        AllowPartialAuthSpecified = true,
                        CardHolderData = cardHolder == null ? null : HydrateCardHolderData(cardHolder),
                        CardData = new CardDataType
                        {
                            TokenRequest = requestMultiUseToken ? booleanType.Y : booleanType.N,
                            Item = HydrateCardManualEntry(card)
                        },
                        Amt = amount,
                        GratuityAmtInfo = gratuity,
                        GratuityAmtInfoSpecified = gratuity != 0,
                        AdditionalTxnFields = HydrateAdditionalTxnFields(details),
                        TxnDescriptor = descriptor
                    }
                },
                ItemElementName = ItemChoiceType1.CreditAuth
            };

            return SubmitAuthorize(transaction, amount, currency, (details == null) ? null : details.ClientTransactionId);
        }
开发者ID:andreymir,项目名称:heartland-dotnet,代码行数:51,代码来源:HpsCreditService.cs

示例8: moto_019_partial_approval_discover

        public void moto_019_partial_approval_discover() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860", Zip = "75024" } };
            var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" };

            var card = new HpsCreditCard {
                Number = "6011000990156527",
                ExpMonth = 12,
                ExpYear = 2025,
                Cvv = "123"
            };

            var response = _creditService.Charge(145m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithDirectMarketData(directMarketData)
                .WithAllowPartialAuth(true)
                .Execute();

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

            Assert.IsNotNull(response);
            Assert.AreEqual(65.00m, response.AuthorizedAmount);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:24,代码来源:MOTO.cs

示例9: moto_017_authorization_discover

        public void moto_017_authorization_discover() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860", Zip = "75024" } };
            var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" };

            var card = new HpsCreditCard {
                Number = "6011000990156527",
                ExpMonth = 12,
                ExpYear = 2025,
                Cvv = "123"
            };

            var authResponse = _creditService.Authorize(17.07m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithDirectMarketData(directMarketData)
                .Execute();

            Assert.IsNotNull(authResponse);
            Assert.AreEqual("00", authResponse.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:20,代码来源:MOTO.cs

示例10: moto_016_authorization_master_card

        public void moto_016_authorization_master_card() {
            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)
                .Execute();

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

            // test 016b Capture/AddToBatch
            var captureResponse = _creditService.Capture(authResponse.TransactionId).Execute();

            Assert.IsNotNull(captureResponse);
            Assert.AreEqual("00", captureResponse.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:26,代码来源:MOTO.cs

示例11: moto_014_charge_jcb

        public void moto_014_charge_jcb() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "750241234" } };
            var directMarketData = new HpsDirectMarketData { InvoiceNumber = "123456" };

            var card = new HpsCreditCard {
                Number = "3566007770007321",
                ExpMonth = 12,
                ExpYear = 2025,
                Cvv = "123"
            };

            var chargeResponse = _creditService.Charge(17.05m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithDirectMarketData(directMarketData)
                .Execute();

            Assert.IsNotNull(chargeResponse);
            Assert.AreEqual("00", chargeResponse.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:20,代码来源:MOTO.cs

示例12: moto_023_level_ii_response_r

        public void moto_023_level_ii_response_r() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860", Zip = "75024" } };

            var card = new HpsCreditCard {
                Number = "4012002000060016",
                ExpMonth = 12,
                ExpYear = 2025,
                Cvv = "123"
            };

            var chargeResponse = _creditService.Charge(123.45m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithCpcReq(true)
                .Execute();

            Assert.IsNotNull(chargeResponse);
            Assert.AreEqual("00", chargeResponse.ResponseCode);
            Assert.AreEqual("R", chargeResponse.CpcIndicator);

            var cpcData = new HpsCpcData { TaxType = taxTypeType.TAXEXEMPT };

            var cpcResponse = _creditService.CpcEdit(chargeResponse.TransactionId)
                .WithCpcData(cpcData)
                .Execute();

            Assert.IsNotNull(cpcResponse);
            Assert.AreEqual("00", cpcResponse.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:29,代码来源:MOTO.cs

示例13: moto_027_level_ii_response_s

        public void moto_027_level_ii_response_s() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860", Zip = "75024" } };

            var card = new HpsCreditCard {
                Number = "5473500000000014",
                ExpMonth = 12,
                ExpYear = 2025,
                Cvv = "123"
            };

            var chargeResponse = _creditService.Charge(111.08m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithCpcReq(true)
                .Execute();

            Assert.IsNotNull(chargeResponse);
            Assert.AreEqual("00", chargeResponse.ResponseCode);
            Assert.AreEqual("S", chargeResponse.CpcIndicator);

            var cpcData = new HpsCpcData { CardHolderPoNumber = "9876543210", TaxAmount = 1.00m, TaxType = taxTypeType.SALESTAX };

            var cpcResponse = _creditService.CpcEdit(chargeResponse.TransactionId)
                .WithCpcData(cpcData)
                .Execute();

            Assert.IsNotNull(cpcResponse);
            Assert.AreEqual("00", cpcResponse.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:29,代码来源:MOTO.cs

示例14: moto_006_charge_visa_token

        public void moto_006_charge_visa_token() {
            var cardHolder = new HpsCardHolder { Address = new HpsAddress { Address = "6860 Dallas Pkwy", Zip = "75024" } };

            var card = new HpsCreditCard {
                Number = "4012002000060016",
                ExpMonth = 12,
                ExpYear = 2025
            };

            var response = _creditService.Charge(13.01m)
                .WithCard(card)
                .WithCardHolder(cardHolder)
                .WithRequestMultiUseToken(true)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
            visaToken = response.TokenData.TokenValue;
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:19,代码来源:MOTO.cs

示例15: moto_005_balance_inquiry_visa

        public void moto_005_balance_inquiry_visa() {
            var card = new HpsCreditCard {
                Number = "4012002000060016",
                ExpMonth = 12,
                ExpYear = 2025
            };

            var response = _creditService.PrePaidBalanceInquiry()
                .WithCard(card)
                .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
开发者ID:DenisPitcher,项目名称:heartland-dotnet,代码行数:14,代码来源:MOTO.cs


注:本文中的SecureSubmit.Entities.HpsCreditCard类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。