Merge pull request #867 from makeplane/uat

release: v1.3.0-rc31
This commit is contained in:
sriram veeraghanta
2024-08-19 16:13:56 +05:30
committed by GitHub
3 changed files with 25 additions and 9 deletions

View File

@@ -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(

View File

@@ -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

View File

@@ -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>