Beispiel #1
0
 private SalesInvoice(
     InvoiceInfo info,
     ISequenceStartingWithOne <NonNegativeRevenue> revenueItems,
     INonEmptyEnumerable <NonNegativePayment> payments,
     InvoiceParty counterpart)
 {
     Info         = info;
     RevenueItems = revenueItems;
     Payments     = payments;
     Counterpart  = counterpart;
 }
Beispiel #2
0
 private CreditInvoice(
     InvoiceInfo info,
     ISequenceStartingWithOne <NegativeRevenue> revenueItems,
     INonEmptyEnumerable <NegativePayment> payments,
     InvoiceParty counterpart,
     long?correlatedInvoice = null)
 {
     Info              = info;
     RevenueItems      = revenueItems;
     Payments          = payments;
     Counterpart       = counterpart;
     CorrelatedInvoice = correlatedInvoice.ToOption();
 }
Beispiel #3
0
 public SalesInvoice(
     InvoiceHeader header,
     LocalInvoiceParty issuer,
     ISequentialEnumerableStartingWithOne <NonNegativeRevenue> revenueItems,
     InvoiceParty counterpart,
     INonEmptyEnumerable <NonNegativePayment> payments)
     : base(header, issuer, revenueItems, payments, counterpart)
 {
     if (counterpart == null)
     {
         throw new ArgumentNullException(nameof(counterpart));
     }
 }
Beispiel #4
0
 public static ITry <SalesInvoice, IEnumerable <Error> > Create(
     InvoiceInfo info,
     ISequenceStartingWithOne <NonNegativeRevenue> revenueItems,
     INonEmptyEnumerable <NonNegativePayment> payments,
     InvoiceParty counterpart)
 {
     return(Try.Aggregate(
                ObjectValidations.NotNull(info),
                ObjectValidations.NotNull(revenueItems),
                ObjectValidations.NotNull(payments),
                ObjectValidations.NotNull(counterpart),
                (i, r, p, c) => new SalesInvoice(i, r, p, c)
                ));
 }
Beispiel #5
0
 public static ITry <CreditInvoice, IEnumerable <Error> > Create(
     InvoiceInfo info,
     ISequenceStartingWithOne <NegativeRevenue> revenueItems,
     INonEmptyEnumerable <NegativePayment> payments,
     InvoiceParty counterPart,
     long?correlatedInvoice = null)
 {
     return(Try.Aggregate(
                ObjectValidations.NotNull(info),
                ObjectValidations.NotNull(revenueItems),
                ObjectValidations.NotNull(payments),
                ObjectValidations.NotNull(counterPart),
                (i, r, p, c) => new CreditInvoice(i, r, p, c, correlatedInvoice)
                ));
 }
        public Invoice(
            InvoiceHeader header,
            LocalInvoiceParty issuer,
            ISequentialEnumerableStartingWithOne <Revenue> revenueItems,
            INonEmptyEnumerable <Payment> payments,
            InvoiceParty counterpart = null,
            long?correlatedInvoice   = null)
        {
            Header            = header ?? throw new ArgumentNullException(nameof(header));
            Issuer            = issuer ?? throw new ArgumentNullException(nameof(issuer));
            RevenueItems      = revenueItems ?? throw new ArgumentNullException(nameof(revenueItems));
            Payments          = payments ?? throw new ArgumentNullException(nameof(payments));
            Counterpart       = counterpart;
            CorrelatedInvoice = correlatedInvoice;

            if (!RevenueItems.Any())
            {
                throw new ArgumentException($"Minimal count of {nameof(revenueItems)} is 1.");
            }
        }
 private InvoiceInfo(InvoiceHeader header, InvoiceParty issuer)
 {
     Header = header;
     Issuer = issuer;
 }
 public static ITry <InvoiceInfo, INonEmptyEnumerable <Error> > Create(InvoiceHeader header, InvoiceParty issuer)
 {
     return(ObjectValidations.NotNull(header).FlatMap(h =>
     {
         var validIssuer = ObjectValidations.NotNull(issuer);
         return validIssuer.Map(i => new InvoiceInfo(h, i));
     }));
 }