コード例 #1
0
        private async Task <ResponseResult <string, ResultErrorCode> > ManageInvoicesAsync <TDocument>(Dto.ManageInvoiceRequest request, ISequentialEnumerable <TDocument> invoices)
        {
            if (invoices.Count > ServiceInfo.MaxInvoiceBatchSize)
            {
                throw new ArgumentException($"Max invoice batch size ({ServiceInfo.MaxInvoiceBatchSize}) exceeded.", nameof(invoices));
            }

            if (invoices.StartIndex != 1)
            {
                throw new ArgumentException("Items need to be indexed from 1.", nameof(invoices));
            }

            return(await Client.ProcessRequestAsync <Dto.ManageInvoiceRequest, Dto.ManageInvoiceResponse, string, ResultErrorCode>(
                       endpoint : "manageInvoice",
                       request : request,
                       successFunc : response => ModelMapper.MapManageInvoice(response)
                       ).ConfigureAwait(continueOnCapturedContext: false));
        }
コード例 #2
0
        private Task <ResponseResult <string, ResultErrorCode> > ManageInvoicesAsync <TDocument>(Dto.ManageInvoiceRequest request, ISequence <TDocument> invoices)
        {
            if (invoices.Values.Count() > ServiceInfo.MaxInvoiceBatchSize)
            {
                throw new ArgumentException($"Max invoice batch size ({ServiceInfo.MaxInvoiceBatchSize}) exceeded.", nameof(invoices));
            }

            if (invoices.StartIndex != 1)
            {
                throw new ArgumentException("Items need to be indexed from 1.", nameof(invoices));
            }

            return(Client.ProcessRequestAsync <Dto.ManageInvoiceRequest, Dto.ManageInvoiceResponse, string, ResultErrorCode>(
                       endpoint: "manageInvoice",
                       request: request,
                       successFunc: response => ModelMapper.MapManageInvoice(response)
                       ));
        }