public RetailSalesReceipt( InvoiceHeader header, LocalInvoiceParty issuer, ISequentialEnumerableStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments) : base(header, issuer, revenueItems, payments) { }
private SalesInvoice( InvoiceInfo info, ISequenceStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments, InvoiceParty counterpart) { Info = info; RevenueItems = revenueItems; Payments = payments; Counterpart = counterpart; }
private async Task AssertNifLookup(INonEmptyEnumerable <NifInfoEntry> entries, NifSearchResult expectedResult) { var validator = new NifValidator(Certificate, httpTimeout: TimeSpan.FromSeconds(30)); var response = await validator.CheckNif(new Request(entries)); Assert.AreEqual(response.Results.Count(), entries.Count()); foreach (var result in response.Results) { Assert.AreEqual(expectedResult, result.Result); } }
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."); } }
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(); }
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 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) )); }
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."); } }
public static ISequenceStartingWithZero <T> FromPreordered(INonEmptyEnumerable <T> values) { var sequence = Sequence <T> .FromPreordered(values, startIndex : 0); return(new SequenceStartingWithZero <T>(sequence)); }
private RetailSalesReceipt(InvoiceInfo info, ISequenceStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments) { Info = info; RevenueItems = revenueItems; Payments = payments; }
private TaxSummary(INonEmptyEnumerable <TaxExemptItem> taxExempt = null, INonEmptyEnumerable <TaxRateSummary> taxed = null) { TaxExempt = taxExempt.ToOption(); Taxed = taxed.ToOption(); }
private SimplifiedInvoice(InvoiceInfo info, ISequenceStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments) { Info = info; RevenueItems = revenueItems; Payments = payments; }
public Request(INonEmptyEnumerable <NifInfoEntry> entries) { Entries = entries; }
public static ISequence <T> FromPreordered(INonEmptyEnumerable <T> values, int startIndex) { var result = Create(values.Select((value, index) => new Indexed <T>(startIndex + index, value))); return(result.Get(e => throw new Exception($"{nameof(FromPreordered)} resulted in an invalid sequence."))); }
private Sequence(INonEmptyEnumerable <Indexed <T> > values) { Values = values; }
public static ITry <RetailSalesReceipt, IEnumerable <Error> > Create(InvoiceInfo info, ISequenceStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments) { return(Try.Aggregate( ObjectValidations.NotNull(info), ObjectValidations.NotNull(revenueItems), ObjectValidations.NotNull(payments), (i, r, p) => new RetailSalesReceipt(i, r, p) )); }
public static ITry <SimplifiedInvoice, IEnumerable <Error> > Create(InvoiceInfo info, ISequenceStartingWithOne <NonNegativeRevenue> revenueItems, INonEmptyEnumerable <NonNegativePayment> payments) { var result = Try.Aggregate( ObjectValidations.NotNull(info), ObjectValidations.NotNull(revenueItems), ObjectValidations.NotNull(payments), (i, r, p) => IsValidSimplifiedInvoice(i, r).ToTry( t => new SimplifiedInvoice(i, r, p), f => new Error($"{nameof(SimplifiedInvoice)} can only be below or equal to 100 EUR.").ToEnumerable() ) ); return(result.FlatMap(r => r)); }