예제 #1
0
        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())
                       ));
        }
예제 #2
0
 private LocalCompany(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address)
 {
     TaxpayerId = taxpayerId;
     Name       = name;
     Address    = address;
 }
예제 #3
0
        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)
                       ));
        }
예제 #4
0
 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));
 }
예제 #5
0
 private ForeignCompany(Name name, SimpleAddress address, TaxpayerIdentificationNumber taxpayerId = null)
 {
     Name       = name;
     Address    = address;
     TaxpayerId = taxpayerId.ToOption();
 }
예제 #6
0
 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))));
 }
예제 #7
0
 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))));
 }
예제 #8
0
 public SupplierInfo(TaxpayerIdentificationNumber taxpayerId, Name name, SimpleAddress address, VatCode vatCode)
     : base(taxpayerId, name, address)
 {
     VatCode = Check.IsNotNull(vatCode, nameof(vatCode));
 }