From f86a70a9cf5afedc432086514e06fcf48864ff66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Sat, 7 Nov 2020 19:44:24 +0100 Subject: [PATCH] Fix - Correction de la redirection lors d'une erreur de paiement --- Sheaft.Web.Payment/Controllers/PaymentsController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sheaft.Web.Payment/Controllers/PaymentsController.cs b/Sheaft.Web.Payment/Controllers/PaymentsController.cs index 72bf3bf3f..564f79fab 100644 --- a/Sheaft.Web.Payment/Controllers/PaymentsController.cs +++ b/Sheaft.Web.Payment/Controllers/PaymentsController.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using System.Web; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -84,14 +85,15 @@ public async Task Transaction(string transactionId, CancellationT if (payin.Data.Status == TransactionStatus.Failed) { _logger.LogInformation($"Transaction {transactionId} failed, redirecting to failed page."); - return RedirectPreserveMethod(_pspOptions.AppRedirectFailedUrl.Replace("{transactionId}", transactionId).Replace("{message}", payin.Data.ResultMessage)); + return RedirectPreserveMethod(_pspOptions.AppRedirectFailedUrl.Replace("{transactionId}", transactionId).Replace("{message}", HttpUtility.UrlEncode(payin.Data.ResultMessage))); } } catch(Exception e) { - _logger.LogError(e, $"Unexpected error occured while processing transaction {transactionId} informations, redirecting to pending page."); + _logger.LogError(e, $"Unexpected error occured while processing transaction {transactionId} informations."); } + _logger.LogInformation($"Transaction {transactionId} pending, redirecting to pending page."); return RedirectPreserveMethod(_pspOptions.AppRedirectPendingUrl.Replace("{transactionId}", transactionId)); } }