public async Task <bool> Handle(PayPaymentCommand request, CancellationToken cancellationToken) { Payment payment = await _paymentRepository.FindPayment(request.Id, cancellationToken); payment.PayPayment(); await _paymentRepository.Save(payment, cancellationToken, request.MessageData); return(true); }
public async Task <CreatePaymentOutputModel> Handle( CreatePaymentCommand request, CancellationToken cancellationToken) { var payment = _paymentFactory .WithTitle(request.Title) .WithAmount(request.Amount) .WithPaymentDue(request.PaymentDue) .WithStudent(request.StudentId) .Build(); await _paymentRepository.Save(payment, cancellationToken, request.MessageData); return(new CreatePaymentOutputModel(payment.Id)); }