mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 13:38:13 -05:00
handle sub incomplete status
This commit is contained in:
parent
41f9f6a7f0
commit
5c3bf78226
@ -21,7 +21,7 @@ namespace Bit.Core.Models.Business
|
|||||||
PeriodEndDate = sub.CurrentPeriodEnd;
|
PeriodEndDate = sub.CurrentPeriodEnd;
|
||||||
CancelledDate = sub.CanceledAt;
|
CancelledDate = sub.CanceledAt;
|
||||||
CancelAtEndDate = sub.CancelAtPeriodEnd;
|
CancelAtEndDate = sub.CancelAtPeriodEnd;
|
||||||
Cancelled = sub.Status == "canceled" || sub.Status == "unpaid";
|
Cancelled = sub.Status == "canceled" || sub.Status == "unpaid" || sub.Status == "incomplete_expired";
|
||||||
if(sub.Items?.Data != null)
|
if(sub.Items?.Data != null)
|
||||||
{
|
{
|
||||||
Items = sub.Items.Data.Select(i => new BillingSubscriptionItem(i));
|
Items = sub.Items.Data.Select(i => new BillingSubscriptionItem(i));
|
||||||
|
@ -976,7 +976,8 @@ namespace Bit.Core.Services
|
|||||||
throw new GatewayException("Subscription was not found.");
|
throw new GatewayException("Subscription was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sub.CanceledAt.HasValue || sub.Status == "canceled" || sub.Status == "unpaid")
|
if(sub.CanceledAt.HasValue || sub.Status == "canceled" || sub.Status == "unpaid" ||
|
||||||
|
sub.Status == "incomplete_expired")
|
||||||
{
|
{
|
||||||
// Already canceled
|
// Already canceled
|
||||||
return;
|
return;
|
||||||
@ -1021,7 +1022,8 @@ namespace Bit.Core.Services
|
|||||||
throw new GatewayException("Subscription was not found.");
|
throw new GatewayException("Subscription was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((sub.Status != "active" && sub.Status != "trialing") || !sub.CanceledAt.HasValue)
|
if((sub.Status != "active" && sub.Status != "trialing" && !sub.Status.StartsWith("incomplete")) ||
|
||||||
|
!sub.CanceledAt.HasValue)
|
||||||
{
|
{
|
||||||
throw new GatewayException("Subscription is not marked for cancellation.");
|
throw new GatewayException("Subscription is not marked for cancellation.");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user