mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
@@ -45,7 +45,7 @@ def resync_workspace_license(workspace_slug, force=False):
|
||||
# If the last sync is more than 1 hour, then sync the license
|
||||
if (
|
||||
workspace_license.last_synced_at - timezone.now()
|
||||
).seconds > 3600 or force:
|
||||
).total_seconds() > 3600 or force:
|
||||
|
||||
# Fetch the workspace license
|
||||
response = fetch_workspace_license(
|
||||
|
||||
@@ -230,6 +230,7 @@ class WorkspaceLicenseSyncEndpoint(BaseAPIView):
|
||||
workspace_license.has_added_payment_method = request.data.get(
|
||||
"has_added_payment_method", False
|
||||
)
|
||||
workspace_license.subscription = request.data.get("subscription")
|
||||
workspace_license.save()
|
||||
# If the workspace license is not present, then fetch the license from the payment server and create it
|
||||
else:
|
||||
@@ -252,6 +253,7 @@ class WorkspaceLicenseSyncEndpoint(BaseAPIView):
|
||||
has_added_payment_method=request.data.get(
|
||||
"has_added_payment_method", False
|
||||
),
|
||||
subscription=request.data.get("subscription"),
|
||||
)
|
||||
|
||||
# Return the response
|
||||
|
||||
@@ -26,6 +26,9 @@ export const PlaneCloudBilling: React.FC = observer(() => {
|
||||
// derived values
|
||||
const endDate = currentWorkspaceSubscribedPlanDetail?.current_period_end_date;
|
||||
const isSubscriptionCancelled = currentWorkspaceSubscribedPlanDetail?.is_canceled;
|
||||
const isInTrialPeriod =
|
||||
!currentWorkspaceSubscribedPlanDetail?.has_added_payment_method &&
|
||||
!!currentWorkspaceSubscribedPlanDetail?.trial_end_date;
|
||||
|
||||
const handleSubscriptionPageRedirection = () => {
|
||||
setIsLoading(true);
|
||||
@@ -102,15 +105,26 @@ export const PlaneCloudBilling: React.FC = observer(() => {
|
||||
<div className="flex items-center gap-2">
|
||||
<Image src={PlaneLogo} alt="Plane pro" width={24} height={24} />
|
||||
<h4 className="text-2xl mb-1 leading-6 font-bold">Plane Pro</h4>
|
||||
{isSubscriptionCancelled ? (
|
||||
<div className="text-center text-sm text-red-500 font-medium">
|
||||
(Expires on: {renderFormattedDate(endDate)})
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center text-sm text-custom-text-200 font-medium">
|
||||
(Renew on: {renderFormattedDate(endDate)})
|
||||
</div>
|
||||
{isInTrialPeriod && (
|
||||
<>
|
||||
<div className="flex-shrink-0 p-1 px-2 uppercase bg-custom-primary-100/20 text-custom-primary-100 text-xs rounded-full font-medium">
|
||||
Free Trial
|
||||
</div>
|
||||
<div className="text-center text-sm text-custom-text-200 font-medium">
|
||||
(Free trial ends on: {renderFormattedDate(currentWorkspaceSubscribedPlanDetail?.trial_end_date)})
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{!isInTrialPeriod &&
|
||||
(isSubscriptionCancelled ? (
|
||||
<div className="text-center text-sm text-red-500 font-medium">
|
||||
(Expires on: {renderFormattedDate(endDate)})
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center text-sm text-custom-text-200 font-medium">
|
||||
(Renew on: {renderFormattedDate(endDate)})
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{!currentWorkspaceSubscribedPlanDetail.is_offline_payment && (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user