mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[fix] Address QA found defects for the Stripe Subscriptions admin tool (#2150)
* [fix] Clear the page on Stripe Subscription search change [SG-404] * [fix] Ensure page is null when selecting all Stripe Subscriptions for an action [SG-404] * [feat] Allow Stripe Subscriptions to be filtered by a test clock [SG-404]
This commit is contained in:
@ -453,6 +453,7 @@ namespace Bit.Admin.Controllers
|
||||
{
|
||||
Items = subscriptions.Select(s => new StripeSubscriptionRowModel(s)).ToList(),
|
||||
Prices = (await _stripeAdapter.PriceListAsync(new Stripe.PriceListOptions() { Limit = 100 })).Data,
|
||||
TestClocks = await _stripeAdapter.TestClockListAsync(),
|
||||
Filter = options
|
||||
};
|
||||
return View(model);
|
||||
@ -464,6 +465,7 @@ namespace Bit.Admin.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
model.Prices = (await _stripeAdapter.PriceListAsync(new Stripe.PriceListOptions() { Limit = 100 })).Data;
|
||||
model.TestClocks = await _stripeAdapter.TestClockListAsync();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@ -485,11 +487,11 @@ namespace Bit.Admin.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Action == StripeSubscriptionsAction.PreviousPage)
|
||||
if (model.Action == StripeSubscriptionsAction.PreviousPage || model.Action == StripeSubscriptionsAction.Search)
|
||||
{
|
||||
model.Filter.StartingAfter = null;
|
||||
}
|
||||
if (model.Action == StripeSubscriptionsAction.NextPage)
|
||||
if (model.Action == StripeSubscriptionsAction.NextPage || model.Action == StripeSubscriptionsAction.Search)
|
||||
{
|
||||
model.Filter.EndingBefore = null;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace Bit.Admin.Models
|
||||
public StripeSubscriptionsAction Action { get; set; } = StripeSubscriptionsAction.Search;
|
||||
public string Message { get; set; }
|
||||
public List<Stripe.Price> Prices { get; set; }
|
||||
public List<Stripe.TestHelpers.TestClock> TestClocks { get; set; }
|
||||
public StripeSubscriptionListOptions Filter { get; set; } = new StripeSubscriptionListOptions();
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
|
@ -112,6 +112,14 @@
|
||||
{<option asp-selected='@Model.Filter.Price == @price.Id' value="@price.Id">@price.Id</option>}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label asp-for="Filter.TestClock">Test Clock</label>
|
||||
<select asp-for="Filter.TestClock" name="filter.TestClock" class="form-control mr-2">
|
||||
<option asp-selected="Model.Filter.TestClock == null" value="@null">All</option>
|
||||
@foreach (var clock in Model.TestClocks)
|
||||
{<option asp-selected='@Model.Filter.TestClock == @clock.Id' value="@clock.Id">@clock.Name</option>}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row col-12 d-flex justify-content-end my-3">
|
||||
<button type="submit" class="btn btn-primary" title="Search" name="action" asp-for="Action" value="@StripeSubscriptionsAction.Search"><i class="fa fa-search"></i> Search</button>
|
||||
|
Reference in New Issue
Block a user