Skip to content

Commit

Permalink
Fix - Correction de la redirection lors d'une erreur de paiement
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Nov 7, 2020
1 parent ed55db4 commit f86a70a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sheaft.Web.Payment/Controllers/PaymentsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,14 +85,15 @@ public async Task<IActionResult> 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));
}
}
Expand Down

0 comments on commit f86a70a

Please sign in to comment.