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));
     }));
 }
Esempio n. 2
0
 public RetailSalesReceipt(
     InvoiceHeader header,
     LocalInvoiceParty issuer,
     ISequentialEnumerableStartingWithOne <NonNegativeRevenue> revenueItems,
     INonEmptyEnumerable <NonNegativePayment> payments)
     : base(header, issuer, revenueItems, payments)
 {
 }
 public SimplifiedInvoice(
     InvoiceHeader header,
     LocalInvoiceParty issuer,
     ISequentialEnumerableStartingWithOne <NonNegativeRevenue> revenueItems,
     INonEmptyEnumerable <NonNegativePayment> payments)
     : base(header, issuer, revenueItems, payments)
 {
     if (header.CurrencyCode.IsNull() || header.CurrencyCode.Value == "EUR")
     {
         Check.Condition(revenueItems.Sum(i => i.Value.NetValue.Value + i.Value.VatValue.Value) <= 100, "Simplified Invoice can only be below 100 EUR.");
     }
 }
Esempio n. 4
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));
     }
 }
        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.");
            }
        }
Esempio n. 6
0
        public Invoice(
            LocalCompany issuer,
            InvoiceHeader header,
            IEnumerable <Revenue> revenueItems,
            StringIdentifier invoiceIdentifier = null,
            InvoiceRegistrationNumber invoiceRegistrationNumber            = null,
            InvoiceRegistrationNumber cancelledByInvoiceRegistrationNumber = null,
            ForeignCompany counterpart     = null,
            IEnumerable <Payment> payments = null)
        {
            Issuer                              = issuer ?? throw new ArgumentNullException(nameof(issuer));
            Header                              = header ?? throw new ArgumentNullException(nameof(header));
            InvoiceIdentifier                   = invoiceIdentifier;
            InvoiceRegistrationNumber           = invoiceRegistrationNumber;
            CanceledByInvoiceRegistrationNumber = cancelledByInvoiceRegistrationNumber;
            Counterpart                         = counterpart;
            RevenueItems                        = revenueItems;
            Payments                            = payments;

            if (revenueItems.Count() == 0)
            {
                throw new ArgumentException($"Minimal count of {nameof(revenueItems)} is 1.");
            }
        }
 private InvoiceInfo(InvoiceHeader header, InvoiceParty issuer)
 {
     Header = header;
     Issuer = issuer;
 }