public void Can_convert_to_string() { BankAccountType accountType = BankAccountType.Parse("Current"); string description = accountType; accountType.ToString().ShouldBe("Current"); description.ShouldBe("Current"); }
/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (IdempotencyKey != null) { p.Add(new KeyValuePair <string, string>("IdempotencyKey", IdempotencyKey)); } if (StatusCallback != null) { p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback))); } if (BankAccountType != null) { p.Add(new KeyValuePair <string, string>("BankAccountType", BankAccountType.ToString())); } if (ChargeAmount != null) { p.Add(new KeyValuePair <string, string>("ChargeAmount", ChargeAmount.Value.ToString())); } if (Currency != null) { p.Add(new KeyValuePair <string, string>("Currency", Currency)); } if (Description != null) { p.Add(new KeyValuePair <string, string>("Description", Description)); } if (Input != null) { p.Add(new KeyValuePair <string, string>("Input", Input)); } if (MinPostalCodeLength != null) { p.Add(new KeyValuePair <string, string>("MinPostalCodeLength", MinPostalCodeLength.ToString())); } if (Parameter != null) { p.Add(new KeyValuePair <string, string>("Parameter", Serializers.JsonObject(Parameter))); } if (PaymentConnector != null) { p.Add(new KeyValuePair <string, string>("PaymentConnector", PaymentConnector)); } if (PaymentMethod != null) { p.Add(new KeyValuePair <string, string>("PaymentMethod", PaymentMethod.ToString())); } if (PostalCode != null) { p.Add(new KeyValuePair <string, string>("PostalCode", PostalCode.Value.ToString().ToLower())); } if (SecurityCode != null) { p.Add(new KeyValuePair <string, string>("SecurityCode", SecurityCode.Value.ToString().ToLower())); } if (Timeout != null) { p.Add(new KeyValuePair <string, string>("Timeout", Timeout.ToString())); } if (TokenType != null) { p.Add(new KeyValuePair <string, string>("TokenType", TokenType.ToString())); } if (ValidCardTypes != null) { p.Add(new KeyValuePair <string, string>("ValidCardTypes", ValidCardTypes)); } return(p); }
public Status<BankAccount> Create(string bankAccountUri, string name, string accountNumber, string routingNumber, BankAccountType type, Dictionary<string, string> meta = null) { Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add("name", name); parameters.Add("account_number", accountNumber); parameters.Add("routing_number", routingNumber); parameters.Add("type", type.ToString().ToLower()); if (meta != null) foreach (var key in meta.Keys) parameters.Add(string.Format("meta[{0}]", key), meta[key]); return this.rest.GetResult<BankAccount>(this.Service.BaseUrl + bankAccountUri, this.Service.Key, null, "post", parameters).AttachService(this.Service); }
public void RenderBankAccountOnFile(BankAccountType bankAccountType) { if (IsBankAccountOnFileValid(bankAccountType)) { StringBuilder html = new StringBuilder(); var bankAccountOnFile = BankAccountsOnFile.Where(b => b.AccountType == bankAccountType).FirstOrDefault(); html.Append(@" <tr> <td class='options'> <a href=""" + Page.ClientScript.GetPostBackClientHyperlink(this, "UseBankAccount|" + bankAccountType.ToString()) + @""" class='btn btn-success Next'> " + Resources.Shopping.UseThisCheckingAccount + @"</a> </td> <td class='description'> <span class='producttitle'> " + Resources.Shopping.CheckingAccountEndingIn + " " + bankAccountOnFile.AccountNumberDisplay.Replace("*", "") + @"</span> </td> <td class='nameoncard'> " + bankAccountOnFile.BillingName + @" </td> <td class='expirationdate'> --- </td> </tr> "); HtmlTextWriter writer = new HtmlTextWriter(Response.Output); writer.Write(html.ToString()); } }
public static AbstractBankAccount Create(BankAccountType typeName, string number) { Type type = Type.GetType(typeof(AbstractBankAccount).Namespace + "." + typeName.ToString()); return((AbstractBankAccount)Activator.CreateInstance(type, number)); }