diff --git a/apiserver/plane/payment/utils/workspace_license_request.py b/apiserver/plane/payment/utils/workspace_license_request.py index e0967f91da..06a9fe2e5c 100644 --- a/apiserver/plane/payment/utils/workspace_license_request.py +++ b/apiserver/plane/payment/utils/workspace_license_request.py @@ -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( diff --git a/apiserver/plane/payment/views/product.py b/apiserver/plane/payment/views/product.py index ad100a3192..0b89a7c8f9 100644 --- a/apiserver/plane/payment/views/product.py +++ b/apiserver/plane/payment/views/product.py @@ -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 diff --git a/web/ee/components/license/plane-cloud-billing.tsx b/web/ee/components/license/plane-cloud-billing.tsx index b1ea1c6740..fe895e2c19 100644 --- a/web/ee/components/license/plane-cloud-billing.tsx +++ b/web/ee/components/license/plane-cloud-billing.tsx @@ -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(() => {