Пример #1
0
 public static Iban Create(string iban)
 {
     var result = new Iban();
     result.CountryCode = iban.Substring(0, 2);
     result.CheckDigit = iban.Substring(2, 2);
     if (result.CountryCode == "DE")
     {
         result.BIC = BIC.Create(iban.Substring(4, 8), result.CountryCode);
         result.AccountNumber = AccountNumber.Create(iban.Substring(12), result.CountryCode);
     }
     else if (result.CountryCode == "FR")
     {
         result.BIC = null;
         result.AccountNumber = AccountNumber.Create(iban.Substring(4), result.CountryCode);
     }
     else if (result.CountryCode == "AT")
     {
         result.BIC = BIC.Create(iban.Substring(4, 5), result.CountryCode);
         result.AccountNumber = AccountNumber.Create(iban.Substring(9), result.CountryCode);
     }
     else if (result.CountryCode == "CH")
     {
         result.BIC = BIC.Create(iban.Substring(4, 5), result.CountryCode);
         result.AccountNumber = AccountNumber.Create(iban.Substring(9), result.CountryCode);
     }
     return result;
 }
Пример #2
0
 /// <summary>
 /// Creates an 
 /// </summary>
 /// <param name="countryCode">ISO 3166-1 country code</param>
 /// <param name="bic">bank identifier code</param>
 /// <param name="accountNumber">an account number</param>
 public static Iban Create(string countryCode, string bic, string accountNumber)
 {
     var iban = new Iban();
     iban.CountryCode = countryCode;
     iban.BIC = BIC.Create(bic, countryCode);
     iban.AccountNumber = AccountNumber.Create(accountNumber, iban.CountryCode);
     iban.CheckDigit = CalculateCheckDigits(bic, iban.AccountNumber.ToString(), iban.CountryCode);
     return iban;
 }
Пример #3
0
 public static bool IsValid(Iban iban)
 {
     return IsValid(iban.ToString());
 }
Пример #4
0
 public static BankAccount FromIban(Iban iban)
 {
     return Create(iban.AccountNumber.ToString(), iban.BIC.ToString());
 }