public static ITry <ForeignCompany, IEnumerable <Error> > Create(Name name, SimpleAddress address, TaxpayerIdentificationNumber taxpayerId = null) { var optionalForeignTaxPayerId = taxpayerId.ToOption().ToOption().Where(i => i.Match( identifier => !identifier.Country.Equals(Countries.Hungary), _ => true )); return(optionalForeignTaxPayerId.ToTry(_ => Error.Create($"{nameof(TaxpayerIdentificationNumber)} must be a foreign (non-Hungarian) taxpayer number.")).Map( i => new ForeignCompany(name, address, i.GetOrNull()) )); }
private LocalCompany(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address) { TaxpayerId = taxpayerId; Name = name; Address = address; }
public static ITry <LocalCompany, IEnumerable <Error> > Create(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address) { var localTaxPayerId = taxpayerId.ToOption().Where(i => i.Country.Equals(Countries.Hungary)); return(localTaxPayerId.ToTry(_ => Error.Create($"{nameof(TaxpayerIdentificationNumber)} must be a Hungarian taxpayer number.")).Map( i => new LocalCompany(i, name, address) )); }
public Info(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address) { TaxpayerId = Check.IsNotNull(taxpayerId, nameof(taxpayerId)); Name = Check.IsNotNull(name, nameof(name)); Address = Check.IsNotNull(address, nameof(address)); }
private ForeignCompany(Name name, SimpleAddress address, TaxpayerIdentificationNumber taxpayerId = null) { Name = name; Address = address; TaxpayerId = taxpayerId.ToOption(); }
public static ITry <Receiver, IEnumerable <Error> > ForeignCompany(Name name, SimpleAddress address, TaxpayerIdentificationNumber taxpayerId = null) { return(Models.ForeignCompany.Create(name, address, taxpayerId).Map(c => new Receiver(new Company(c)))); }
public static ITry <Receiver, IEnumerable <Error> > LocalCompany(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address) { return(Models.LocalCompany.Create(taxpayerId, name, address).Map(c => new Receiver(new Company(c)))); }
public SupplierInfo(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address, VatCode vatCode) : base(taxpayerId, name, address) { VatCode = Check.IsNotNull(vatCode, nameof(vatCode)); }