Skip to content

Commit

Permalink
Revert "Improve payment request success URL parsing. (#453)" (#454)
Browse files Browse the repository at this point in the history
This reverts commit e966d6c.
  • Loading branch information
sipsorcery authored Nov 13, 2024
1 parent e966d6c commit 8ae6cc9
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions src/NoFrixion.MoneyMoov/Models/PaymentRequests/PaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

using System.ComponentModel.DataAnnotations;
using NoFrixion.MoneyMoov.Extensions;
using LanguageExt;

namespace NoFrixion.MoneyMoov.Models;

Expand Down Expand Up @@ -376,30 +375,23 @@ public bool HasWebHook()
return !string.IsNullOrEmpty(SuccessWebHookUrl);
}

public Either<NoFrixionProblem, Uri> GetSuccessWebhookUri()
public Uri GetSuccessWebhookUri()
{
if (string.IsNullOrWhiteSpace(SuccessWebHookUrl))
if (string.IsNullOrEmpty(SuccessWebHookUrl))
{
return new Uri(MoneyMoovConstants.WEBHOOK_BLACKHOLE_URI);
}
else
{
if (Uri.TryCreate(SuccessWebHookUrl, UriKind.Absolute, out Uri? uri))
{
var successWebHookUri = new UriBuilder(uri);

string successParams = $"id={ID}&orderid={OrderID ?? string.Empty}";

successWebHookUri.Query = string.IsNullOrEmpty(successWebHookUri.Query)
? successParams
: successWebHookUri.Query + "&" + successParams;

return successWebHookUri.Uri;
}
else
{
return new NoFrixionProblem($"The success web hook URL {SuccessWebHookUrl} for payment request ID {ID} is not a valid URL.");
}
var successWebHookUri = new UriBuilder(SuccessWebHookUrl);

string successParams = $"id={ID}&orderid={OrderID ?? string.Empty}";

successWebHookUri.Query = string.IsNullOrEmpty(successWebHookUri.Query)
? successParams
: successWebHookUri.Query + "&" + successParams;

return successWebHookUri.Uri;
}
}

Expand Down

0 comments on commit 8ae6cc9

Please sign in to comment.