slack-strava icon indicating copy to clipboard operation
slack-strava copied to clipboard

Warn that a subscription expires within two weeks and offer to renew

Open dblock opened this issue 1 year ago • 2 comments

If you cancel a subscription at period end, but keep using the bot, it won't warn you that the subscription is going to expire. It will then cancel and it's not obvious that a user needs to subscribe again.

  1. Warn that the subscription is going to expire.
  2. Change the expired text to say to use subscribe to create a new subscription.

dblock avatar Jun 15 '24 12:06 dblock

For starters, do #163

dblock avatar Jul 08 '24 02:07 dblock

Something like

      logger.info "Checking Stripe subscriptions for #{Team.striped.count} team(s)."
      Team.active.striped.each do |team|
        customer = Stripe::Customer.retrieve(team.stripe_customer_id)
        if customer.subscriptions.none? && team.subscribed?
          logger.info "No active subscriptions for #{team} (#{team.stripe_customer_id}), downgrading."
        else
          customer.subscriptions.each do |subscription|
            subscription_name = "#{subscription.plan.name} (#{ActiveSupport::NumberHelper.number_to_currency(subscription.plan.amount.to_f / 100)})"
            logger.info "Checking #{team} subscription to #{subscription_name}, #{subscription.status}."
            case subscription.status
            when 'active'
              if subscription.cancel_at_period_end && (Time.now + 2.weeks > subscription.current_period_end)
                logger.warn "Subscription for #{team} is active, but expires in under two weeks on #{subscription.current_period_end}."
              end
            end
          end
        end
      end

Likely not worth it, out of hundreds of subscriptions not one active is not set to auto-renew.

dblock avatar Feb 02 '25 13:02 dblock