public override async Task <GetPaymentsQueryResponse> Handle(GetPaymentsQuery request, CancellationToken cancellationToken) { var payments = await _paymentQueryInterface.Query(p => true) .Select(payment => new BasicPaymentResult { Uid = payment.Uid, PaymentStatus = payment.PaymentStatus }).ToListAsync(cancellationToken); return(Success(new GetPaymentsQueryResponse { PaymentResults = payments })); }
public override async Task <GetPaymentQueryResult> Handle(GetPaymentQuery request, CancellationToken cancellationToken) { var paymentResponse = await _paymentQueryInterface.Query(p => p.Uid == request.PaymentUid) .Select(p => new GetPaymentQueryResult { Amount = p.Amount, Currency = p.Currency, Uid = p.Uid, PaymentStatus = p.PaymentStatus, CreatedDateUtc = p.CreatedDateUtc, ObfuscatedCardNumber = p.ObfuscatedCardNumber }).SingleOrDefaultAsync(cancellationToken); if (paymentResponse == null) { return(Error(ErrorCode.NotFound, "We were not able to find the payment")); } return(Success(paymentResponse)); }