From 1af105a9e267d38ab26c1c921b5d8729b1df1916 Mon Sep 17 00:00:00 2001 From: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:15:33 -0400 Subject: [PATCH] [BEEEP] Update development and QA dashboard URLs for payment gateways (#3291) * Update development and QA dashboard URLs for payment gateways * Refactor gateway URL creation to utility method --------- Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com> --- .../Utilities/WebHostEnvironmentExtensions.cs | 24 +++++++++++++++++ .../Shared/_OrganizationFormScripts.cshtml | 16 ++++++----- src/Admin/Views/Users/Edit.cshtml | 27 +++++++++++++------ 3 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 src/Admin/Utilities/WebHostEnvironmentExtensions.cs diff --git a/src/Admin/Utilities/WebHostEnvironmentExtensions.cs b/src/Admin/Utilities/WebHostEnvironmentExtensions.cs new file mode 100644 index 0000000000..9602d4c76d --- /dev/null +++ b/src/Admin/Utilities/WebHostEnvironmentExtensions.cs @@ -0,0 +1,24 @@ +namespace Bit.Admin.Utilities; + +public static class WebHostEnvironmentExtensions +{ + public static string GetStripeUrl(this IWebHostEnvironment hostingEnvironment) + { + if (hostingEnvironment.IsDevelopment() || hostingEnvironment.IsEnvironment("QA")) + { + return "https://dashboard.stripe.com/test"; + } + + return "https://dashboard.stripe.com"; + } + + public static string GetBraintreeMerchantUrl(this IWebHostEnvironment hostingEnvironment) + { + if (hostingEnvironment.IsDevelopment() || hostingEnvironment.IsEnvironment("QA")) + { + return "https://www.sandbox.braintreegateway.com/merchants"; + } + + return "https://www.braintreegateway.com/merchants"; + } +} diff --git a/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml b/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml index 88dc8a78c1..69fd55dc21 100644 --- a/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml +++ b/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml @@ -1,3 +1,5 @@ +@inject IWebHostEnvironment HostingEnvironment +@using Bit.Admin.Utilities @model OrganizationEditModel