btcpayserver/BTCPayServer/Extensions/UrlHelperExtensions.cs

67 lines
2.7 KiB
C#
Raw Normal View History

2020-06-29 04:44:35 +02:00
using BTCPayServer;
2017-09-13 08:47:34 +02:00
using BTCPayServer.Controllers;
using BTCPayServer.Services.Apps;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
2017-09-13 08:47:34 +02:00
namespace Microsoft.AspNetCore.Mvc
{
public static class UrlHelperExtensions
{
public static string EmailConfirmationLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase)
2017-09-13 08:47:34 +02:00
{
2020-06-28 10:55:27 +02:00
return urlHelper.GetUriByAction(nameof(AccountController.ConfirmEmail), "Account",
new { userId, code }, scheme, host, pathbase);
2017-09-13 08:47:34 +02:00
}
public static string ResetPasswordCallbackLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase)
2017-09-13 08:47:34 +02:00
{
return urlHelper.GetUriByAction(
action: nameof(AccountController.SetPassword),
2017-09-13 08:47:34 +02:00
controller: "Account",
values: new { userId, code },
scheme: scheme,
host:host,
pathBase: pathbase
);
2017-09-13 08:47:34 +02:00
}
2020-06-28 10:55:27 +02:00
public static string PaymentRequestLink(this LinkGenerator urlHelper, string paymentRequestId, string scheme, HostString host, string pathbase)
{
return urlHelper.GetUriByAction(
action: nameof(PaymentRequestController.ViewPaymentRequest),
controller: "PaymentRequest",
2020-06-28 10:55:27 +02:00
values: new { id = paymentRequestId },
scheme, host, pathbase);
}
public static string AppLink(this LinkGenerator urlHelper, string appId, string scheme, HostString host, string pathbase)
{
return urlHelper.GetUriByAction(
action: nameof(AppsPublicController.RedirectToApp),
controller: "AppsPublic",
values: new { appId },
scheme, host, pathbase);
}
2020-06-28 10:55:27 +02:00
public static string InvoiceLink(this LinkGenerator urlHelper, string invoiceId, string scheme, HostString host, string pathbase)
{
return urlHelper.GetUriByAction(
action: nameof(InvoiceController.Invoice),
controller: "Invoice",
2020-06-28 10:55:27 +02:00
values: new { invoiceId = invoiceId },
scheme, host, pathbase);
}
public static string PayoutLink(this LinkGenerator urlHelper, string walletId,string pullPaymentId, string scheme, HostString host, string pathbase)
{
return urlHelper.GetUriByAction(
action: nameof(WalletsController.Payouts),
controller: "Wallets",
values: new {walletId, pullPaymentId},
scheme, host, pathbase);
}
2017-09-13 08:47:34 +02:00
}
}