Beispiel #1
0
        public async Task <IActionResult> IncluiPagamentoPayPalAsync([FromBody] IncluiPagamentoPayPalPost incluiPagamentoPayPalPost)
        {
            var pagamento = Mapper.Map <PayPal>(incluiPagamentoPayPalPost);

            try
            {
                await pagamentoService.IncluiPagamentoPayPalAsync(pagamento);

                return(Ok(pagamento));
            }
            catch (ClienteCoreException ex) when(ex.Errors.Any(c => c.Key == ClienteCoreError.ClienteNaoEncontrado.Key))
            {
                return(NotFound(ClienteCoreError.ClienteNaoEncontrado));
            }
            catch (AssinaturaCoreException ex) when(ex.Errors.Any(c => c.Key == AssinaturaCoreError.AssinaturaNaoEncontrada.Key))
            {
                return(NotFound(AssinaturaCoreError.AssinaturaNaoEncontrada));
            }
        }