From 4bab5f5931be58fd3bf7781026beb70c4262c832 Mon Sep 17 00:00:00 2001 From: Vitalii Dasaev Date: Fri, 8 May 2020 11:02:30 +0300 Subject: [PATCH] fix log for ClientApiException --- .../Controllers/PayrexxIntegrationController.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/MAVN.Service.PayrexxIntegration/Controllers/PayrexxIntegrationController.cs b/src/MAVN.Service.PayrexxIntegration/Controllers/PayrexxIntegrationController.cs index e304a98..0e49856 100644 --- a/src/MAVN.Service.PayrexxIntegration/Controllers/PayrexxIntegrationController.cs +++ b/src/MAVN.Service.PayrexxIntegration/Controllers/PayrexxIntegrationController.cs @@ -15,6 +15,7 @@ using System.Net; using MAVN.Service.PayrexxIntegration.Domain.Enums; using Common; +using Lykke.Common.ApiLibrary.Exceptions; namespace MAVN.Service.PayrexxIntegration.Controllers { @@ -125,10 +126,10 @@ public async Task GeneratePaymentAsync([FromBody] GeneratePayme SkipResultPage = true }; - var res = await client.Api.CreatePaymentGatewayAsync(paymentGatewayRequest); - _log.Info("Call CreatePaymentGatewayAsync with data: " + paymentGatewayRequest.ToJson()); + var res = await client.Api.CreatePaymentGatewayAsync(paymentGatewayRequest); + var payment = res.Data[0]; return new PaymentResponse @@ -137,6 +138,14 @@ public async Task GeneratePaymentAsync([FromBody] GeneratePayme PaymentPageUrl = payment.Link, }; } + catch (ClientApiException e) + { + _log.Warning("ClientApiException with data: " + e.ToJson(), exception: e); + return new PaymentResponse + { + ErrorCode = CheckIntegrationErrorCode.Fail, + }; + } catch (Exception e) { _log.Warning(null, exception: e);