public async Task <IActionResult> PayInvoices([FromBody] PayInvoicesRequest model) { var validationResult = await ValidateForPayingInvoicesAsync(model); if (validationResult.HasError) { return(validationResult.ActionResult); } try { await _invoiceService.PayInvoicesAsync(validationResult.Employee, validationResult.Invoices, validationResult.AssetForPay, model.Amount); } catch (InvalidOperationException ex) { _log.ErrorWithDetails(ex, model); return(BadRequest(ErrorResponse.Create(ex.Message))); } return(Accepted()); }
public Task PayInvoicesAsync(PayInvoicesRequest model) { return(_runner.RunAsync(() => _invoicesApi.PayInvoicesAsync(model))); }