auto-downgrade-logic
Auto Downgrade Logic​
FILE: pro_subscription.rb and app_subscription.rb METHOD: create_transaction DESCRIPTION: When a subscription is ready to be charged again (eg 1 month or 1 year after first charge), this creates pending transactions. WHEN: Gets run every night during create_subscription_transactions
FILE: reconcile_payments.rb METHOD: create_charge DESCRIPTION: When a transaction is attempting to be charged, if it's status is pending and it is older than 3 months, then set its status to 'ignored' WHEN: Gets run every night during charge_transactions
FILE: admin_braintree_transaction METHOD: braintree_transaction_search DESCRIPTION: When a wobbly cancels in paypal directly, then paypal sends an email to [email protected]. This method finds these tickets in zendesk and then dowgrades the corresponding subscription. WHEN: Gets run every day as part of handle_paypal_cancellations
FILE: scheduler.rake METHOD: downgrade_pending_subscriptions DESCRIPTION: Finds subscriptions with to_downgrade_at less than today and cancels them WHEN: Gets run every day as part of downgrade_pending_subscriptions
FILE: user.rb METHOD: shopify_uninstall DESCRIPTION: When we get a webhook from shopify that a user has uninstalled then we call this function to attempt to downgrade the corresponding pro_subscription. Does NOT deal with AppSubscriptions WHEN: Gets run from Shopify callback
Why are to_downgrade_at dates close to each other on many subscriptions? When user cancels the to_downgrade_at date is set based on when user is last charged. Because users are all charged at the same time of day, downgrade_at_dates will tend to be within a few seconds of each other.