/// <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); }
/// <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; }