mirror of
https://github.com/bitwarden/server.git
synced 2025-01-29 23:01:46 +01:00
[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>
This commit is contained in:
parent
44c559c723
commit
1af105a9e2
24
src/Admin/Utilities/WebHostEnvironmentExtensions.cs
Normal file
24
src/Admin/Utilities/WebHostEnvironmentExtensions.cs
Normal file
@ -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";
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
@inject IWebHostEnvironment HostingEnvironment
|
||||||
|
@using Bit.Admin.Utilities
|
||||||
@model OrganizationEditModel
|
@model OrganizationEditModel
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -15,10 +17,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gateway.value === '@((byte)GatewayType.Stripe)') {
|
if (gateway.value === '@((byte)GatewayType.Stripe)') {
|
||||||
window.open('https://dashboard.stripe.com/customers/' + customerId.value, '_blank');
|
const url = `@(HostingEnvironment.GetStripeUrl())/customers/${customerId.value}/`;
|
||||||
|
window.open(url, '_blank');
|
||||||
} else if (gateway.value === '@((byte)GatewayType.Braintree)') {
|
} else if (gateway.value === '@((byte)GatewayType.Braintree)') {
|
||||||
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/'
|
const url = `@(HostingEnvironment.GetBraintreeMerchantUrl())/@Model.BraintreeMerchantId/${customerId.value}`;
|
||||||
+ customerId.value, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.getElementById('gateway-subscription-link')?.addEventListener('click', () => {
|
document.getElementById('gateway-subscription-link')?.addEventListener('click', () => {
|
||||||
@ -28,10 +31,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gateway.value === '@((byte)GatewayType.Stripe)') {
|
if (gateway.value === '@((byte)GatewayType.Stripe)') {
|
||||||
window.open('https://dashboard.stripe.com/subscriptions/' + subId.value, '_blank');
|
const url = `@(HostingEnvironment.GetStripeUrl())/subscriptions/${subId.value}/`;
|
||||||
|
window.open(url, '_blank');
|
||||||
} else if (gateway.value === '@((byte)GatewayType.Braintree)') {
|
} else if (gateway.value === '@((byte)GatewayType.Braintree)') {
|
||||||
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/' +
|
const url = `@(HostingEnvironment.GetBraintreeMerchantUrl())/@Model.BraintreeMerchantId/subscriptions/${subId.value}`;
|
||||||
'subscriptions/' + subId.value, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.getElementById('@(nameof(Model.UseSecretsManager))').addEventListener('change', (event) => {
|
document.getElementById('@(nameof(Model.UseSecretsManager))').addEventListener('change', (event) => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
@using Bit.Admin.Enums;
|
@using Bit.Admin.Enums;
|
||||||
@inject Bit.Admin.Services.IAccessControlService AccessControlService
|
@inject Bit.Admin.Services.IAccessControlService AccessControlService
|
||||||
|
@inject IWebHostEnvironment HostingEnvironment
|
||||||
@model UserEditModel
|
@model UserEditModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "User: " + Model.User.Email;
|
ViewData["Title"] = "User: " + Model.User.Email;
|
||||||
@ -10,7 +11,7 @@
|
|||||||
var canViewPremium = AccessControlService.UserHasPermission(Permission.User_Premium_View);
|
var canViewPremium = AccessControlService.UserHasPermission(Permission.User_Premium_View);
|
||||||
var canViewLicensing = AccessControlService.UserHasPermission(Permission.User_Licensing_View);
|
var canViewLicensing = AccessControlService.UserHasPermission(Permission.User_Licensing_View);
|
||||||
var canViewBilling = AccessControlService.UserHasPermission(Permission.User_Billing_View);
|
var canViewBilling = AccessControlService.UserHasPermission(Permission.User_Billing_View);
|
||||||
|
|
||||||
var canEditPremium = AccessControlService.UserHasPermission(Permission.User_Premium_Edit);
|
var canEditPremium = AccessControlService.UserHasPermission(Permission.User_Premium_Edit);
|
||||||
var canEditLicensing = AccessControlService.UserHasPermission(Permission.User_Licensing_Edit);
|
var canEditLicensing = AccessControlService.UserHasPermission(Permission.User_Licensing_Edit);
|
||||||
var canEditBilling = AccessControlService.UserHasPermission(Permission.User_Billing_Edit);
|
var canEditBilling = AccessControlService.UserHasPermission(Permission.User_Billing_Edit);
|
||||||
@ -45,10 +46,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
|
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
|
||||||
window.open('https://dashboard.stripe.com/customers/' + customerId.value, '_blank');
|
const url = '@(HostingEnvironment.IsDevelopment()
|
||||||
|
? "https://dashboard.stripe.com/test"
|
||||||
|
: "https://dashboard.stripe.com")';
|
||||||
|
window.open(`${url}/customers/${customerId.value}/`, '_blank');
|
||||||
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
|
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
|
||||||
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/' +
|
const url = '@(HostingEnvironment.IsDevelopment()
|
||||||
'customers/' + customerId.value, '_blank');
|
? $"https://www.sandbox.braintreegateway.com/merchants/{Model.BraintreeMerchantId}"
|
||||||
|
: $"https://www.braintreegateway.com/merchants/{Model.BraintreeMerchantId}")';
|
||||||
|
window.open(`${url}/${customerId.value}`, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -60,10 +66,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
|
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
|
||||||
window.open('https://dashboard.stripe.com/subscriptions/' + subId.value, '_blank');
|
const url = '@(HostingEnvironment.IsDevelopment() || HostingEnvironment.IsEnvironment("QA")
|
||||||
|
? "https://dashboard.stripe.com/test"
|
||||||
|
: "https://dashboard.stripe.com")'
|
||||||
|
window.open(`${url}/subscriptions/${subId.value}`, '_blank');
|
||||||
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
|
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
|
||||||
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/' +
|
const url = '@(HostingEnvironment.IsDevelopment() || HostingEnvironment.IsEnvironment("QA")
|
||||||
'subscriptions/' + subId.value, '_blank');
|
? $"https://www.sandbox.braintreegateway.com/merchants/{Model.BraintreeMerchantId}"
|
||||||
|
: $"https://www.braintreegateway.com/merchants/{Model.BraintreeMerchantId}")';
|
||||||
|
window.open(`${url}/subscriptions/${subId.value}`, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@ -80,7 +91,7 @@
|
|||||||
@if (canViewBillingInformation)
|
@if (canViewBillingInformation)
|
||||||
{
|
{
|
||||||
<h2>Billing Information</h2>
|
<h2>Billing Information</h2>
|
||||||
@await Html.PartialAsync("_BillingInformation",
|
@await Html.PartialAsync("_BillingInformation",
|
||||||
new BillingInformationModel { BillingInfo = Model.BillingInfo, UserId = Model.User.Id, Entity = "User" })
|
new BillingInformationModel { BillingInfo = Model.BillingInfo, UserId = Model.User.Id, Entity = "User" })
|
||||||
}
|
}
|
||||||
@if (canViewGeneral)
|
@if (canViewGeneral)
|
||||||
|
Loading…
Reference in New Issue
Block a user