public async Task SimulateReceivePayment(ReceivePaymentRequest request) { var payment = await _queryProcessor.ProcessAsync(new GetPaymentByInvoiceIdQuery(request.InvoiceId), CancellationToken.None); if (payment == null) { throw new ArgumentException($"No payment found for invoice {request.InvoiceId}"); } await _commandBus.PublishAsync(new ReceivePaymentCommand(PaymentId.With(payment.PaymentId), payment.InvoiceId, request.Amount), CancellationToken.None); }
public async Task SimulateReceivePayment([FromBody] ReceivePaymentRequest request) { await _paymentService.SimulateReceivePayment(request); }