Exemplo n.º 1
0
        public async Task Execute(RetrievePaymentInput input)
        {
            if (input is null)
            {
                _retrievePaymentOutputPort.BadRequest("Input is null");
                return;
            }

            var paymentDetail = await _paymentRepository.GetPaymenDetailById(input.PaymentId);

            if (paymentDetail is null)
            {
                _retrievePaymentOutputPort.NotFound($"Payment with Id {input.PaymentId.ToGuid()} does not exist");
                return;
            }

            _retrievePaymentOutputPort.OK(paymentDetail);
        }
Exemplo n.º 2
0
        public async Task Execute(RetrievePaymentInput input)
        {
            if (input is null)
            {
                _retrievePaymentOutputPort.BadRequest("Input is null");
                return;
            }

            var paymentDetail = await _paymentProjection.GetById(input.PaymentId.Value);

            if (paymentDetail is null)
            {
                _retrievePaymentOutputPort.NotFound($"Payment with Id {input.PaymentId.ToGuid()} does not exist");
                return;
            }

            _retrievePaymentOutputPort.OK(
                paymentDetail
                .ConvertFromPaymentModelToPaymentDto()
                );
        }