INNER CODE UNIT · JavaScript

expectedDuration

adeekshith/watomatic · functions/index.js:441

        const expectedDuration = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds
        const actualDuration = expiryTime - purchaseTime;

        if (Math.abs(actualDuration - expectedDuration) > 1000) { // Allow 1 second tolerance
            console.error(`Invalid duration: expected ${expectedDuration}, got ${actualDuration}`);
            return {
                isValid: false,
                expiryTime: 0,
                autoRenewing: false,
                planType: '',
                error: 'Invalid subscription duration'
            };
        }

        // STEP 4: Ensure it's a FREE plan product
        if (!productId.toLowerCase().includes('free')) {
            console.error('Product ID does not indicate FREE plan');
            return {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…