Ejemplo n.º 1
0
        public EstornoResponse Response(ResponseEnvelope <comum.dto.externo.EstornoResponse> envelope)
        {
            var response = new EstornoResponse
            {
                HttpStatusCode = (int)envelope.HttpStatusCode,
                TransacaoId    = string.Empty
            };

            if (envelope.Success)
            {
                response.TransacaoId = envelope.Item.Id.ToString();
            }
            else if (envelope.Error.Messages.Any())
            {
                response.Erro = envelope.Error.Messages.First();
            }

            return(response);
        }
Ejemplo n.º 2
0
        public override Task <EstornoResponse> Estornar(EstornoRequest request, ServerCallContext context)
        {
            var response = new EstornoResponse();

            try
            {
                var envelope = estornoServico.Processar(
                    request.TransacaoId.ToGuid(),
                    request.ParceiroId.ToGuid());

                response = estornoParser.Response(envelope);
            }
            catch (Exception ex)
            {
                //## TODO log

                response.HttpStatusCode = (int)HttpStatusCode.InternalServerError;
            }

            return(Task.FromResult(response));
        }