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


C# TransactionRequest.Add方法代码示例

本文整理汇总了C#中TransactionRequest.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TransactionRequest.Add方法的具体用法?C# TransactionRequest.Add怎么用?C# TransactionRequest.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransactionRequest的用法示例。


在下文中一共展示了TransactionRequest.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HashIsComputedCorrectly0_EvenWithExistingHash

        public void HashIsComputedCorrectly0_EvenWithExistingHash()
        {
            var request = new TransactionRequest();
            request.Add("KEY1", "VALUE1");
            request.Add("HASH", "HASH");
            var client = GetClient();
            client.SetHash(request);

            Assert.AreEqual("05b2372310c2897729f9c185517a25168e6891f2c7749329255f494e1483f181", request["HASH"]);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:10,代码来源:Be2BillClientTests.cs

示例2: HashIsComputedCorrectly1

        public void HashIsComputedCorrectly1()
        {
            var request = new TransactionRequest();
            request.Add("ORDERID", "VALUE1");
            request.Add("DATE", "VALUE2");
            var client = GetClient();
            client.SetHash(request);

            Assert.AreEqual("b7c312f5d79aebc472d91b7395ba855b00bcfee5e15b13a01af85a9f64737a89", request["HASH"]);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:10,代码来源:Be2BillClientTests.cs

示例3: HashIsComputedCorrectly0_DoesNotHashNonUpperKeys

        public void HashIsComputedCorrectly0_DoesNotHashNonUpperKeys()
        {
            var request = new TransactionRequest();
            request.Add("KEY1", "VALUE1");
            request.Add("yop", "VALUE2");
            var client = GetClient();
            client.SetHash(request);

            Assert.AreEqual("05b2372310c2897729f9c185517a25168e6891f2c7749329255f494e1483f181", request["HASH"]);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:10,代码来源:Be2BillClientTests.cs

示例4: CreateAuthorizationParameters

        /// <summary>
        /// Creates the authorization/payment parameters. You have to call SetPayWithForm or SetPayWithAlias after.
        /// </summary>
        /// <param name="uniqueOrderId">The unique order unique identifier (you have to create it).</param>
        /// <param name="userId">The user unique identifier.</param>
        /// <param name="userEmail">The user email.</param>
        /// <param name="description">The description of the payment.</param>
        /// <param name="amountInEuro">The amount information euro (not in cents).</param>
        /// <param name="createAlias">if set to <c>true</c> [create alias] (to do oneclick later).</param>
        /// <param name="displayCreateAlias">if set to <c>true</c> the payment form will ask whether to save the card information.</param>
        /// <param name="authorizationInsteadOfPayment">if set to <c>true</c> [authorization instead of payment]. Call Capture to complete the transaction.</param>
        /// <param name="language">The language.</param>
        /// <returns></returns>
        public TransactionRequest CreateAuthorizationParameters(
            string uniqueOrderId,
            string userId,
            string userEmail,
            string description,
            decimal amountInEuro,
            bool createAlias = false,
            bool displayCreateAlias = false,
            bool authorizationInsteadOfPayment = false,
            Be2BillLanguage language = Be2BillLanguage.EN)
        {
            // http://developer.be2bill.com/platform

            var collection = new TransactionRequest();

            if (authorizationInsteadOfPayment)
            {
                collection.Add(Names.Params.OperationType, Names.Params.OperationTypeAuthorization);
            }
            else
            {
                collection.Add(Names.Params.OperationType, Names.Params.OperationTypePayment);
            }

            collection.Add(Names.Params.Description, description);
            collection.Add(Names.Params.OrderId, uniqueOrderId); // be2bill seems to accept only 1 tentative per ORDERID
            collection.Add(Names.Params.Amount, Math.Round(amountInEuro * 100).ToString());
            collection.Add(Names.Params.Version, Names.ApiVersion);
            collection.Add(Names.Params.ClientIdent, userId);
            collection.Add(Names.Params.Language, language.ToString());

            if (createAlias)
            {
                collection.Add(Names.Params.CreateAlias, Names.Params.Yes); // allow one-click for later transactions (force)
            }

            if (displayCreateAlias)
            {
                collection.Add(Names.Params.DisplayCreateAlias, Names.Params.Yes); // allow one-click for later transactions (ask user)
            }

            collection.Add(Names.Params.Identifier, configuration.ApiIdentifier);

            if (userEmail != null)
            {
                collection.Add(Names.Params.ClientEmail, userEmail);
            }

            return collection;
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:63,代码来源:Be2BillClient.cs

示例5: HashIsComputedCorrectly0_Verify

        public void HashIsComputedCorrectly0_Verify()
        {
            var hash = "05b2372310c2897729f9c185517a25168e6891f2c7749329255f494e1483f181";
            var request = new TransactionRequest();
            request.Add("KEY1", "VALUE1");
            var client = GetClient();
            var result = client.VerifyParameters(request, GetClientConfiguration().ApiKey, hash);

            Assert.IsTrue(result);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:10,代码来源:Be2BillClientTests.cs

示例6: HashIsComputedCorrectly1_Verify

        public void HashIsComputedCorrectly1_Verify()
        {
            var hash = "b7c312f5d79aebc472d91b7395ba855b00bcfee5e15b13a01af85a9f64737a89";
            var request = new TransactionRequest();
            request.Add("ORDERID", "VALUE1");
            request.Add("DATE", "VALUE2");
            var client = GetClient();
            var result = client.VerifyParameters(request, GetClientConfiguration().ApiKey, hash);

            Assert.IsTrue(result);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:11,代码来源:Be2BillClientTests.cs

示例7: SetPayWithForm

        /// <summary>
        /// Sets the pay with form. Call CreateAuthorizationParameters first.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="allow3dSecure">if set to <c>true</c> [allow3d secure].</param>
        /// <param name="hideClientEmail">if set to <c>true</c> [hide client email].</param>
        /// <exception cref="System.ArgumentNullException">collection</exception>
        public void SetPayWithForm(
            TransactionRequest collection,
            bool allow3dSecure = true,
            bool hideClientEmail = false)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            collection.Add(Names.Params.Use3DSecure, allow3dSecure ? Names.Params.Yes : Names.Params.No);
            collection.Add(Names.Params.HideClientEmail, hideClientEmail ? Names.Params.Yes : Names.Params.No);
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:18,代码来源:Be2BillClient.cs

示例8: SetPayWithAlias

        /// <summary>
        /// Sets the pay with alias. Call CreateAuthorizationParameters first.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="alias">The alias.</param>
        /// <param name="userAddress">The user address.</param>
        /// <param name="userAgent">The user agent.</param>
        /// <exception cref="System.ArgumentNullException">collection</exception>
        /// <exception cref="System.ArgumentException">
        /// The value cannot be empty;alias
        /// or
        /// The value cannot be empty;userAddress
        /// or
        /// The value cannot be empty;userAgent
        /// </exception>
        public void SetPayWithAlias(TransactionRequest collection, string alias, string userAddress, string userAgent)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");
            if (string.IsNullOrEmpty(alias))
                throw new ArgumentException("The value cannot be empty", "alias");
            if (string.IsNullOrEmpty(userAddress))
                throw new ArgumentException("The value cannot be empty", "userAddress");
            if (string.IsNullOrEmpty(userAgent))
                throw new ArgumentException("The value cannot be empty", "userAgent");

            collection.Add(Names.Params.Alias, alias);
            collection.Add(Names.Params.AliasMode, Names.Params.AliasModeOneClick);
            collection.Add(Names.Params.ClientIP, userAddress);
            collection.Add(Names.Params.ClientUserAgent, userAgent);

            // some keys are not allowed when paying with alias
            string[] removeKeys = new string[]
            {
                Names.Params.Language,
                Names.Params.Use3DSecure,
                Names.Params.HideClientEmail,
            };
            foreach (var key in removeKeys)
            {
                if (collection.ContainsKey(key))
                    collection.Remove(key);
            }
        }
开发者ID:gitter-badger,项目名称:Be2BillNet,代码行数:44,代码来源:Be2BillClient.cs


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