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