public static IbanParts?Parse(string value) { if (value == null || !CheckLength(value)) { return(null); } string countryCode = CountryPart.FromIban(value); if (countryCode == null) { return(null); } string checkDigits = CheckDigitsPart.FromIban(value); if (checkDigits == null) { return(null); } string bban = BbanPart.FromIban(value); if (bban == null) { return(null); } return(new IbanParts(countryCode, checkDigits, bban, value)); }
public static Outcome <IbanParts> TryParse(string value) { if (value == null || !CheckLength(value)) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidIbanValue, value))); } string countryCode = CountryPart.FromIban(value); if (countryCode == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_CountryCode, value))); } string checkDigits = CheckDigitsPart.FromIban(value); if (checkDigits == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_CheckDigits, value))); } string bban = BbanPart.FromIban(value); if (bban == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_Bban, value))); } return(Outcome.Of(new IbanParts(countryCode, checkDigits, bban, value))); }
public static IbanParts Create(string countryCode, string checkDigits, string bban) { Require.NotNull(countryCode, nameof(countryCode)); Require.NotNull(checkDigits, nameof(checkDigits)); Require.NotNull(bban, nameof(bban)); Require.True(CountryPart.Validate(countryCode), nameof(countryCode)); Require.True(CheckDigitsPart.Validate(checkDigits), nameof(checkDigits)); Require.True(BbanPart.Validate(bban), nameof(bban)); return(new IbanParts(countryCode, checkDigits, bban)); }
public static IbanParts Build(string countryCode, string bban) { Require.NotNull(countryCode, nameof(countryCode)); Require.NotNull(bban, nameof(bban)); Require.True(CountryPart.Validate(countryCode), nameof(countryCode)); Require.True(BbanPart.Validate(bban), nameof(bban)); string checkDigits = IbanCheckDigits.Compute(countryCode, bban); return(new IbanParts(countryCode, checkDigits, bban)); }
public static Bic Create( string institutionCode, string countryCode, string locationCode, string branchCode, BicVersion version) { Require.NotNull(institutionCode, nameof(institutionCode)); Require.NotNull(countryCode, nameof(countryCode)); Require.NotNull(locationCode, nameof(locationCode)); Require.NotNull(branchCode, nameof(branchCode)); Require.True(InstitutionPart.Validate(institutionCode, version), nameof(institutionCode)); Require.True(CountryPart.Validate(countryCode), nameof(countryCode)); Require.True(LocationPart.Validate(locationCode), nameof(locationCode)); Require.True(BranchPart.Validate(branchCode), nameof(branchCode)); return(new Bic(institutionCode, countryCode, locationCode, branchCode)); }
public static Outcome <Bic> TryParse(string value, BicVersion version) { if (value == null || !CheckLength(value)) { return(Outcome <Bic> .FromError(Format.Current(Strings.InvalidBicValue, value))); } string institutionCode = InstitutionPart.FromBic(value, version); if (institutionCode == null) { return(Outcome <Bic> .FromError(Format.Current(Strings.InvalidInput_InstitutionCode, value))); } string countryCode = CountryPart.FromBic(value); if (countryCode == null) { return(Outcome <Bic> .FromError(Format.Current(Strings.InvalidInput_CountryCode, value))); } string locationCode = LocationPart.FromBic(value); if (locationCode == null) { return(Outcome <Bic> .FromError(Format.Current(Strings.InvalidInput_LocationCode, value))); } string branchCode = BranchPart.FromBic(value); if (branchCode == null) { return(Outcome <Bic> .FromError(Format.Current(Strings.InvalidInput_BranchCode, value))); } return(Outcome.Of(new Bic(institutionCode, countryCode, locationCode, branchCode, value))); }
public static Bic?Parse(string value, BicVersion version) { if (value == null || !CheckLength(value)) { return(null); } string institutionCode = InstitutionPart.FromBic(value, version); if (institutionCode == null) { return(null); } string countryCode = CountryPart.FromBic(value); if (countryCode == null) { return(null); } string locationCode = LocationPart.FromBic(value); if (locationCode == null) { return(null); } string branchCode = BranchPart.FromBic(value); if (branchCode == null) { return(null); } return(new Bic(institutionCode, countryCode, locationCode, branchCode, value)); }